Collect digits error

Version 1
    This document was generated from CDN thread

    Created by: Jean Lofrano on 27-07-2011 01:30:12 PM
    Hi,
     
    I have a script TCL IVR working very well...
     
    But the first prompt is: Option 1 to user unlock; Option 2 to password change and Option 3 to forward to help desk...
     
    And I don´t want wait to select a option... I would like to interrupt the prompt!!!
     
    My script is configured for that, but it is not working. See:
     
    proc ActionCollectQuestion1 { } {
        puts "IT7: collecting question 1"
        set Question1Param(interruptPrompt) true
        set Question1Param(terminationKey) #
        set Question1Param(enableReporting) true
        set Question1Param(maxDigits) 1
        set Question1Param(dialPlan) true
        set Question1Pattern(1) "1"
        set Question1Pattern(2) "2"
        set Question1Pattern(3) "3"
        leg collectdigits leg_incoming Question1Param
        puts "IT7: collected question 1"
    }
    #send collected digits through web
    proc Action1 { } {
        puts "IT7: try to send web"
        global WebServer
        global Response1
        global CallerID
        global count
        global count1
        set StatusCollectDigits [infotag get evt_status]
        puts "IT7: cpf $StatusCollectDigits"
        #matched pattern
        if {$StatusCollectDigits == "cd_005"} {
           puts "IT7: starting web"
           set Response1 [infotag get evt_dcdigits]
           puts "Choose: $Response1"
           if { $Response1 == "3"} {
           puts "aguarde, transferindo para o help-desk"
           media play leg_incoming "flash:/aguarde.wav"
           fsm setstate HELPDESK
          
           }
          
          if { $Response1 == "2"} {
          puts "password change"
          
           set count 0
           set count1 0
               
           media play leg_incoming "flash:/alteracao-cpf.wav"
           fsm setstate PLAYEDQUESTION2
           }

          if { $Response1 == "1"} {
          puts "user unlock"
         
          set count 0
          set count1 0
         
          media play leg_incoming "flash:/desbloqueio-cpf.wav"
          fsm setstate PLAYEDQUESTION2
         }

         if { $Response1 > "3"}  {
     
         puts "Invalid option"
         media play leg_incoming "flash:/opcao-invalida.wav"
         fsm setstate PLAYEDWRONG1

         }
    Could you help me please???
     
    Thanks.

    Subject: RE: Collect digits error
    Replied by: Jean Lofrano on 27-07-2011 02:46:40 PM
    Ok , So I´m going to do in the proc:

    #procedure to play audio file on incoming dial peer
    proc ActionPlayWelcome { } {
        puts "IT7: playing audio Welcome"

        global WelcomePrompt
        global CallerID

       >>>>> Question1Param(interrupPrompt)true

        leg setupack leg_incoming
        leg proceeding leg_incoming
        leg connect leg_incoming

        set CallerID [infotag get leg_ani]

        puts "IT7: Caller ID $CallerID"

       >>>>>leg collectdigits leg_incoming Question1Param

        media play leg_incoming $WelcomePrompt

        puts "IT7: Audio played Welcome"
    }

    Is it correct??

    thanks.

    Subject: RE: Collect digits error
    Replied by: Jean Lofrano on 27-07-2011 02:54:24 PM
    Hi, My prompt is WelcomePrompt... This proc run the option1 to... option 2 to.... and option3 to....

    Subject: RE: Collect digits error
    Replied by: Jean Lofrano on 27-07-2011 03:07:47 PM
    Ohh sorry,

    The proc ActionPlayWelcome just run "olá"....

    The proc correct is:

    proc ActionPlayQuestion1 { } {
       
        global counter

    >>>>> Question1Param(interrupPrompt)true

       set counter 0
       

        puts "IT7: playing question 1"

    >>>>>leg collectdigits leg_incoming Question1Param


        media play leg_incoming "flash:/opcoes.wav"

        puts "IT7: played question 1"
    }

    I´m going to add both command in this proc and test...

    Thanks...

    Subject: RE: Collect digits error
    Replied by: Yaw-Ming Chen on 27-07-2011 01:53:53 PM
    1. Try to do "set Question1Param(interruptPrompt) true" at INIT stae or when call setup event received
    2. Do leg collectdigits leg_incoming Question1Param commaqnd first
    3. Then play the prompt for this digit collection

    so it looks something like this:

        leg collectdigits leg_incoming PARAM
        media play leg_incoming $welcomePrompt

    Subject: RE: Collect digits error
    Replied by: Yaw-Ming Chen on 27-07-2011 02:50:47 PM
    In this case you should be   able to barge-in "WelcomePrompt"

    Subject: RE: Collect digits error
    Replied by: Raghavendra Gutty Veeranagappa on 03-08-2011 03:47:49 AM
    Hi Jean,

    Please use below command to Collect digits to match a dial plan with a pattern prefix:

    leg collectdigits leg_incoming Question1Param Question1Pattern

    Thanks,
    Raghavendra

    Subject: RE: Collect digits error
    Replied by: Jean Lofrano on 02-08-2011 04:47:30 PM
    Hi,

    I put the "leg collectdigits leg_incoming Question1Param" command before of "media play leg_incoming "flash:/opcoes.wav", but it does not work...

    Can you help me?

    Thanks..

    Subject: RE: Collect digits error
    Replied by: Jean Lofrano on 02-08-2011 04:52:34 PM
    Hi ,

    I wold like of collect the digits of proc "ActionPlayQuestion1"...

    The current flow is:

    proc ActionPlayQuestion1 { } {
       
        global counter

        set counter 0
       

        puts "IT7: playing question 1"

        media play leg_incoming "flash:/opcoes.wav"

        puts "IT7: played question 1"
    }

    proc ActionCollectQuestion1 { } {
        puts "IT7: collecting question 1"

        set Question1Param(interruptPrompt) true
        set Question1Param(terminationKey) #
        set Question1Param(enableReporting) true
        set Question1Param(maxDigits) 1
        set Question1Param(dialPlan) true
        set Question1Pattern(1) "1"
        set Question1Pattern(2) "2"
        set Question1Pattern(3) "3"

        leg collectdigits leg_incoming Question1Param

        puts "IT7: collected question 1"
    }

    proc Action1 { } {
        puts "IT7: try to send web"
        global WebServer
        global Response1
        global CallerID
        global count
        global count1

        set StatusCollectDigits [infotag get evt_status]

        puts "IT7: cpf $StatusCollectDigits"

        #matched pattern
        if {$StatusCollectDigits == "cd_005"} {

           puts "IT7: starting web"

           set Response1 [infotag get evt_dcdigits]
          

           puts "Choose: $Response1"

           if { $Response1 == "3"} {

    .
    .
    .
    .
    .


    set ScriptFSM(PLAYEDWELCOME,ev_media_done)              "ActionPlayQuestion1      PLAYEDQUESTION1"
    set ScriptFSM(PLAYEDWRONG1,ev_media_done)               "ActionPlayQuestion1Again PLAYEDQUESTION1"

    set ScriptFSM(PLAYEDQUESTION1,ev_media_done)            "ActionCollectQuestion1   COLLECTEDQUESTION1"
    set ScriptFSM(COLLECTEDQUESTION1,ev_collectdigits_done) "Action1                  CALLDISCONNECT"

    Subject: RE: Collect digits error
    Replied by: Jean Lofrano on 03-08-2011 10:46:43 AM
    Ok thanks. I´m going to test with Question1Pattern.

    Subject: RE: Collect digits error
    Replied by: Jean Lofrano on 03-08-2011 03:10:44 PM
    Hi,

    I put the new variable in the proc bellow, but it is not working yet...

    proc ActionCollectQuestion1 { } {
        puts "IT7: collecting question 1"

        set Question1Param(interruptPrompt) true
        set Question1Param(terminationKey) #
        set Question1Param(enableReporting) true
        set Question1Param(maxDigits) 1
        set Question1Param(dialPlan) true
        set Question1Pattern(1) "1"
        set Question1Pattern(2) "2"
        set Question1Pattern(3) "3"

        leg collectdigits leg_incoming Question1Param Question1Pattern

        puts "IT7: collected question 1"
    }


    On router I put the "dtmf-relay h245-alphanumeric", but I don´t have sucess...

    dial-peer voice 7067 voip
    service passwordreset
    incoming called-number 7077
    dtmf-relay h245-alphanumeric
    codec g711ulaw


    The debug voice application digitcollect is bellow:

    it7-rot-csc-03#
    028835: *Nov 16 01:37:37.487: //3255//Digi:/tcl_LegDigitCollectObjCmd: collectdigits leg_incoming Question1Param Question1Pattern
    028836: *Nov 16 01:37:37.491: //3255//Digi:/C_DigitCollect_Start: Leg=3255, Dialplan=True, Diaplanterm=False, DigitReport=True, DigitConsume=False IgnoreInitialKey=False, IgnoreDTMFacceptINFO=False, Abortkey=, Terminationkey=#, Numpatterns=3, Maxdigits=1, Mindigits=0, Interruptprompt=True, InterTimeout=-1000, Initialtimeout=-1000, Mask=0
    028837: *Nov 16 01:37:37.491: //-1//Digi:/AFW_DigitCollect_New:
    028838: *Nov 16 01:37:37.491: //-1//Digi:HN1585EEE3:/AFW_DigitCollect_New:
    it7-rot-csc-03#DialPlan=TRUE AbortKey= TermKey=# NumPatts=3
                  Enable=TRUE Consume=FALSE InterruptPrompt=TRUE minDigits=0 maxDigits=1 DialPlanTerm=FALSE
    028839: *Nov 16 01:37:37.495: //3255/806FF4A50401/Digi:/DigitCollectStart_UpdateStats:
    028840: *Nov 16 01:37:37.495: //3255//Digi:/AFW_M_DigitCollect_Action:
    028841: *Nov 16 01:37:37.499: //3255//Digi:/act_DCRunning_RDone: callid=3255 Enable succeeded.enable=1 matchDialplan=1 numPatterns=3matchDialplanTerm=0
    it7-rot-csc-03#
    028842: *Nov 16 01:37:43.921: //3255//Digi:/AFW_M_DigitCollect_Action:
    028843: *Nov 16 01:37:43.921: //3255//Digi:/act_DCRunning_Disconnected:
    028844: *Nov 16 01:37:43.921: //3255//Digi:/DigitCollect_Complete: Status 7=DC_DISCONNECTED. Digits=
    028845: *Nov 16 01:37:43.925: //3255//Digi:/AFW_M_DigitCollect_EventPreProcess:
    028846: *Nov 16 01:37:43.925: //3255//Digi:/DigitCollectEnd_UpdateStats:

    Subject: RE: Collect digits error
    Replied by: Raghavendra Gutty Veeranagappa on 04-08-2011 02:38:04 AM
    Hi Jean,

    media play command syntax is wrong please modify as below.

    media play leg_incoming flash:opcoes.wav

    Thanks,
    Raghavendra

    Subject: RE: Collect digits error
    Replied by: Jean Lofrano on 04-08-2011 12:07:16 PM
    Thanks, but the audio is working... My problem is in the proc "ActionCollectQuestion1".. It is not working...

    I need to wait full audio "opcoes.wav" for after digit a option...

    thanks.

    Subject: RE: Collect digits error
    Replied by: Jean Lofrano on 04-08-2011 02:54:48 PM
    I need wait terminate the audio to choose a option....

    Subject: RE: Collect digits error
    Replied by: Raghavendra Gutty Veeranagappa on 05-08-2011 01:25:28 AM
    Hi Jean,

    yes you need to wait to full audio to collect digit because you are issuing leg collect digits after ev_media_done event recieved, you can issue leg collect digits command after media play command and wait for ev_collectdigits_done event instead of ev_media_done event.

    proc ActionPlayQuestion1 { } {

    global counter

    set counter 0

    set Question1Param(interruptPrompt) true
    set Question1Param(terminationKey) #
    set Question1Param(enableReporting) true
    set Question1Param(maxDigits) 1
    set Question1Param(dialPlan) true
    set Question1Pattern(1) "1"
    set Question1Pattern(2) "2"
    set Question1Pattern(3) "3"

    puts "IT7: playing question 1"

    media play leg_incoming flash:opcoes.wav

    puts "IT7: played question 1"


    leg collectdigits leg_incoming Question1Param Question1Pattern

    }


    Thanks,
    Raghavendra

    Subject: RE: Collect digits error
    Replied by: Jean Lofrano on 05-08-2011 11:24:00 AM
    Thank you so much!

    The problem was solved.


    Att.