How TCL can speak a password for caller?

Version 1
    This document was generated from CDN thread

    Created by: Jean Lofrano on 17-05-2013 08:35:11 AM
    Hi team, I have a tcl script working properly. But, right now, my tcl ivr script receive a web return that is stored in a variable. So, the next step I need to do that TCL script speak for caller what is the file content. For example:  "Your password has been changed. Your new password is xk123"   thanks.    

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Jean Lofrano on 17-05-2013 09:02:20 AM
    Do you have any suggestion?
     
    Regards,

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Mark Alliban on 17-05-2013 09:15:36 AM
    It's not clear what your problem is. Getting the value from the web server, or speaking it?
    To get data from an HTTP server, you can use the httpios commands, such as httpios::geturl.
    To speak the password you can use media play leg_incoming @C$password
     

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Yaw-Ming Chen on 17-05-2013 10:44:00 AM
    Can not do text to speach

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Mark Alliban on 17-05-2013 10:56:57 AM
    Then yout TCL can build up a prompt file to play. You have a prompt file for each letter, number and character?
    set prmpt ""
    for {set i 1} {$i < [string length $password]} {incr i} {
    append prmpt "[string index $password $i].au "
    }
    media play yourpasswordis.au $prmpt
     

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Jean Lofrano on 17-05-2013 12:11:04 PM
    Hey Mark,

    I have used httpios::geturl to get the webreturn value, so it´s ok. 
    Now, I need to understand your suggestion:
    set prmpt ""
    for {set i 1} {$i < [string length $password]} {incr i} {
    append prmpt "[string index $password $i].au "
    }
    media play yourpasswordis.au $prmpt

    I need to create a prompt file for each letter, number and character. But what exactly you routine do?

    Regards.
     

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Jean Lofrano on 17-05-2013 01:24:42 PM
    Another solution is the TTS "loquendo", right?
    I ´m be able to use the loquendo, it is available in my environment...

    What solution will be better?

    regards,

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Mark Alliban on 20-05-2013 03:22:22 AM
    Jean Lofrano:
    I need to create a prompt file for each letter, number and character. But what exactly you routine do?

     
    You can plug a microphone into your PC and use free software on the internet or included Windows tools to record your voice, and save it in .au format. Or you can get someone with good "voice talent" to say them for you. Alternatively there are companies who can make professional voice prompts in a proper recording studio.
     
    TTS is another option but it's not something I am familiar with. I think it would not be economically viable unless it's a large project. If this is your only need for voice prompts then it's less complicated and easier to record them as .au files.
     

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Jean Lofrano on 20-05-2013 07:22:22 AM
    Hi Mark,

    I agree you, because I don´t have enough time to develop a TTS solution. 

    So, How Can I read each position of the webreturn?
    I didn´t understand your "for" routine above...

    For example:
    Webreturn = abcd123
     
    So, How can I separate webreturn variable like this:
    x = a
    y = b
    z = c
    ....
     
    regards

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Jean Lofrano on 20-05-2013 07:32:39 AM
    I have been thinking about, how can I get each position of the return. If the return was setparated by " | " I would get each letter like this:
    ReturnData = a|b|c|1|2|3
    puts "Return is $ReturnData"
    set x [lindex [split $ReturnData |] 0]
    set y [lindex [split $ReturnData |] 1]
    set z [lindex [split $ReturnData |] 3]
    ...
    What do you think about?
     
    regards,
     

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Mark Alliban on 20-05-2013 07:39:53 AM
    If you want to say the password abcd123, then you need to build the command "media play leg_incoming a.au b.au c.au d.au 1.au 2.au 3.au"
    This is what the for loop does. It goes through the $password variable, and adds a prompt for each letter onto the string $prmpt.
     

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Jean Lofrano on 20-05-2013 01:02:07 PM
    Ok Man! I will try do this.
    thanks.

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Jean Lofrano on 23-05-2013 03:38:32 PM
    Hey Mark,

    I have tried to use your suggestion, but I had the follow issue:

    000967: May 23 20:32:28.435: //176//TCL :/tcl_PutsObjCmd: IT7--------------------------------> OK FINAL !
    000968: May 23 20:32:28.439:
    000969: May 23 20:32:28.439: //176//PACK:/tclhttp_handle_httpcb_event: Tcl_Eval to drive http callback failed. code=1 code=ERROR
    it7-rot-csc-03#
    000970: May 23 20:32:28.439: TCL script failure
            Result:
                             expected integer but got "alteracao-ok.wav"Invalid Leg ID in List: alteracao-ok.wavIllegal Info Tag or not a Leg List: alteracao-ok.wav
    000971: May 23 20:32:28.443:    TCL script failure errorInfo:
                            expected integer but got "alteracao-ok.wav"Invalid Leg ID in List: alteracao-ok.wavIllegal Info Tag or not a Leg List: alteracao-ok.wav
        while executing
    "media play alteracao-ok.wav $prompt
        (procedure "httpCallback3" line 38)
        invoked from within
    "httpCallback3 ::httpios::httpios_36"


    can you help me please?
     
    regards,

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Lisandro Quinteros on 23-05-2013 08:30:24 PM
    Is this the same tcl which you where working before? Are you media playing inside the procedure of callback of http consult? 
     
    For what I read you have bad syntax of media play command...
    media play {legID | info-tag } { <url> | token }
    and you seems to wrote
    media play alteracao-ok.wav $prompt
    You are missing the legID or info-tag.
    Experts correct me if I am wrong..
     

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Yaw-Ming Chen on 23-05-2013 11:25:47 PM
    You are right !

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Lisandro Quinteros on 24-05-2013 09:03:03 AM
    Jean .. as mark said  puts $prmpt its a good way to check ift its working good..
    If you also need to add the first the flash:
    you could do something like this...
    set source "flash://"
    and then on the for loop
    append prmpt $source"[string index $password $i].au "

     
     

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Jean Lofrano on 24-05-2013 08:14:36 AM
     
    Hey team,

    Mark has suggested me to use like this:
    set prmpt ""
    for {set i 1} {$i < [string length $password]} {incr i} {
    append prmpt "[string index $password $i].au "
    }
    media play yourpasswordis.au $prmpt

    Ok, the correct syntax is  media play leg_incoming yourpasswordis.au $prmpt
    But, I have 2 problems:
    1 - For example, my webreturn is "12b" and I need to separate that like 1.wav 2.wav b.wav. It´s not working...   
    2 - How my script will know that the prompt files are stored in the flash:/... what is the correct syntax?
    The result should be: "media play leg_incoming a.au b.au c.au d.au 1.au 2.au"
    But, shouldn´t I point where is my prompt file like this: flash:/a.au? 
     
    regards,

     
     
     
     
     
     
     

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Mark Alliban on 24-05-2013 08:44:03 AM
    Jean Lofrano:
    1 - For example, my webreturn is "12b" and I need to separate that like 1.wav 2.wav b.wav. It´s not working...

    This is esxactly what the "for" loop does. In what way is it "not working"? What output do you get if you insert command "puts $prmpt" after the for loop?

    Jean Lofrano:
    2 - How my script will know that the prompt files are stored in the flash:/... what is the correct syntax?

    Yes, if your prompt files are on flash then you can use "flash:a.au". It's quite simple to modify the for loop to do this.
     

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Lisandro Quinteros on 27-05-2013 02:03:00 PM
    Hi Jean.. you finally got it.. you did by the hardest way but you got it..
    Take care of this lines..
    if {[::httpios::status $token] == "ok"} {
          set WebReturn [string trim [::httpios::data $token]]
       } else {
          set WebReturn 0 
       }
    I have been working with this lines too.. but in my case..
    When the server is unrecheable (I intentionally shutdown so no ping is available) the tcl scrip got a Callback Status = "ERROR" so WebReturn is set to 0
    But when I shutdown the Webservice (but Still have ping to the ip) or when the file is not found on the directory (file deleted or with other name) the script got a Callback Status "OK" and I think Its not the expected status you are looking for when you make a web consult.
     
    I've send a request to join your TCL group on linkedin and add you on skype in case you need some help.
    Good luck
    Lisandro Quinteros
     

    Subject: RE: How TCL can speak a password for caller?
    Replied by: Jean Lofrano on 27-05-2013 01:30:46 PM
    Hey team,

    I´have solved the solution with the command lines:

    I haven´t enough time to think about your suggestions.. but You really helped me.. Thanks
     
    if {[::httpios::status $token] == "ok"} {
          set WebReturn [string trim [::httpios::data $token]]
       } else {
          set WebReturn 0
       }

       #set WebReturn d|2|1|2|3|4|3|b
      
       puts "Sua nova senha e:$WebReturn"
      
       set audiob [lindex [split $WebReturn |] 0]
       set audioc [lindex [split $WebReturn |] 1]
       set audiod [lindex [split $WebReturn |] 2]
       set audioe [lindex [split $WebReturn |] 3]
       set audiof [lindex [split $WebReturn |] 4]
       set audiog [lindex [split $WebReturn |] 5]
       set audioh [lindex [split $WebReturn |] 6]
       set audioi [lindex [split $WebReturn |] 7]
     
      
       puts "audiob is $audiob"
       puts "audioc is $audioc"
       puts "audioc is $audiod"
       puts "audioc is $audioe"
       puts "audioc is $audiof"
       puts "audioc is $audiog"
       puts "audioc is $audioh"
       puts "audioc is $audioi"


    proc Audiob { } {

        global audiob
        global audioc

        puts "IT7: PLaying audio 1"
        media play leg_incoming "flash:/$audiob.wav"
        fsm setstate PLAYEDLETTER2
    }

    proc Audioc { } {

        global audioc
       
        puts "IT7: PLaying audio 2"
        media play leg_incoming "flash:/$audioc.wav"
        fsm setstate PLAYEDLETTER3
       
    }

    proc Audiod { } {

        global audioc
        global audiod
       
        puts "IT7: PLaying audio 3"
        media play leg_incoming "flash:/$audiod.wav"
        fsm setstate PLAYEDLETTER4
       
    }

    proc Audioe { } {

        global audioe
       
       
        puts "IT7: PLaying audio 4"
        media play leg_incoming "flash:/$audioe.wav"
        fsm setstate PLAYEDLETTER5
       
    }

    proc Audiof { } {

        global audiof
       
        puts "IT7: PLaying audio 5"
        media play leg_incoming "flash:/$audiof.wav"
        fsm setstate PLAYEDLETTER6
       
    }

    proc Audiog { } {

        global audiog
       
        puts "IT7: PLaying audio 3"
        media play leg_incoming "flash:/$audiog.wav"
        fsm setstate PLAYEDLETTER7
       
    }

    proc Audioh { } {

        global audioh
       
        puts "IT7: PLaying audio 3"
        media play leg_incoming "flash:/$audioh.wav"
        fsm setstate PLAYEDLETTER8
       
    }

    proc Audioi { } {

        global audioi
       
        puts "IT7: PLaying audio 3"
        media play leg_incoming "flash:/$audioi.wav"
        fsm setstate CALLDISCONNECT
       
       
    }