Message Boards Message Boards
« Back to TCL-API

RE: TCL Media Play - Escape key to skip prompt

Combination View Flat View Tree View
Threads [ Previous | Next ]
Hey,
 
I'm working on a script where we want all incoming calls to the voice gateway hear a welcome prompt before the call gets connected to the CME phones.
 
We also want the ability to accept a escape key (say digit '5'). If the caller hits the escape key while the prompt is being played. the prompt will be skipped and call will be transferred to the phone.
 
If the caller doesn't hit the escape key they will hear the welcome prompt and then be transferred to the phone.
 
In our script, we can successfully play the welcome prompt and transfer the call to the phone. How do we incorporate the logic of the escape key?
Here is our script:
 
proc act_Setup { } {
   
    puts "\n PLAY WELCOME PROMPT"
    leg setupack leg_incoming
    leg proceeding leg_incoming
    leg connect leg_incoming
    media play leg_incoming flash:6900.au
}

proc act_GetDest { } {

    puts "\n COLLECT ESCAPE KEY FROM USER"
    set param(dialPlan) true
    set param(dialPlanTerm) true
    leg collectdigits leg_incoming param
}


proc act_GotDest { } {
    global dest
 
    puts "\n RECEIVED DIGITS"
    set status [infotag get evt_status]
    puts "\n DIGIT COLLECT STATUS = $status"
    set dest [infotag get evt_dcdigits]
    leg setup $dest callInfo leg_incoming
}

proc act_CallSetupDone { } {
 
    puts "\n CALL SETUP"
    set status [infotag get evt_status]
    puts "\n CALL STATUS = $status"
 
    if { $status == "ls_000"} {
        puts "\n You have sucessfully placed the call to the destination !"
    } else {       
        puts "\n Sorry your call was not connnected !"
        call close
    }
}

proc act_Cleanup { } {
   
    puts "\n DISCONNECTING CALL"
    set status [infotag get evt_status]
    puts "\n STATUS is $status"
    call close
}

#----------------------------------
#   State Machine
#----------------------------------
  set FSM(any_state,ev_disconnected) "act_Cleanup,same_state"
  set FSM(CALL_INIT,ev_setup_indication) "act_Setup,MEDIAPLAY"
  set FSM(MEDIAPLAY,ev_media_done)  "act_GetDest,GETDEST"
  set FSM(GETDEST,ev_collectdigits_done) "act_GotDest,PLACECALL"
  set FSM(PLACECALL,ev_setup_done)  "act_CallSetupDone,CALLDISCONNECTED"
  set FSM(CALLDISCONNECTED,ev_disconnected) "act_Cleanup,same_state"
  set FSM(CALLDISCONNECTED,ev_media_done)  "act_Cleanup,same_state"
  set FSM(CALLDISCONNECTED,ev_disconnect_done) "act_Cleanup,same_state"

fsm define FSM  CALL_INIT
 
 
 
I tried to include the act_GetDest and act_GotDest functions, but now every caller has to hit the escape key ('0') to get the call connected after the prompt is played. I was the escape key to be more of a hidden option.
 
Is it possible to do the above in a TCL script? Any assistance would be appreciated.
Hi Varun,

You can try setting the following param in your act_GetDest procedure

set params(interruptPrompt) true

param¿An array of parameters that defines how the digits are to be collected.
param(interruptPrompt)¿Whether to interrupt the prompt when a key is pressed. Possible values are true and false. The default is false.


Thanks,
Anusha
Hey Anusha,

We wouldn't get to the act_GetDest procedure until the Media play completes playing the prompt. So shouldn't I include the "set params(interruptPrompt) true" in the act_Setup procedure?
I did include the "set params(interruptPrompt) true" in the act_Setup procedure and still the prompt isn't interrupted after a key press..

Thanks,
Varun
remove
set param(dialPlan) true
set param(dialPlanTerm) true
If you don't need
set params(interruptPrompt) true" should be set before leg collectdigit
You can set maxDigit you like to collect then analyze digit(s) in script