| | 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.
|