cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2155
Views
0
Helpful
8
Replies

TCL Script issue on a cisco Gateway when incoming call with analog line

marc.obrecht
Level 1
Level 1

Hello every body, I have an issue with a tcl script.

I have created a script to play a welcome prompt on the incoming dial peer on a Cisco Gateway.

When a user with a voip phone or a gsm try to call a number behind the gateway, everything is fine the number entirely sended, the promt is played and the call goes out the gateway to the call manager.

When a user with a phone behind an old analog line try to call, the prompt is not played and we have a busy tone before we have dialed the last two digit.

I think it's the overlap which is not working fine because the script try to start before the gateway have collected the entire number but I do not know how to fix it.

Here is the configuration of the incoming dial peer :

dial-peer voice 102 pots

  trunkgroup 1

  description CALL_INCOMING_FROM_PSTN_POTS

  incoming called-number .T

service annonce

  direct-inward-dial

----------------------------------------------------------------

Here is the outgoing dial peer to the CUCM:

dial-peer voice 202 voip
  description CALL_OUTGOING_TO_CUCM

destination-pattern .T

  progress_ind setup enable 3
  voice-class codec 1
  voice-class h323 1
  session target ipv4:172.16.211.11
  dtmf-relay h245-alphanumeric
  ip qos dscp cs3 signaling
  no vad
--------------------------------------------

Here is the script :

proc init_configs { }  {

    global welcomePrompt

    if [infotag get cfg_avpair_exists welcome-prompt] {

       setwelcomePrompt [string trim [infotag get cfg_avpair welwome-prompt]]

    } else {

       set welcomePrompt flash:bcpannonce2.wav

    }

}

#procedure to play audio file on incoming dial peer

proc act_Media { } {

    global dest

    global welcomePrompt

    set dest [infotag get leg_dnis]

    leg setupack leg_incoming

    leg proceeding leg_incoming

    leg connect leg_incoming

    media play leg_incoming $welcomePrompt

}

# setup the call, connect caller to called party

proc act_Setup { } {

    global dest

    puts ">>> Tcl: proc act_Setup <<<"

    puts ">>> TCL:Final Dest: $dest <<<"

     handoff appl leg_incoming default "DESTINATION=$dest"

     act_Cleanup

}

# disconnect the call

proc act_Cleanup { } {

    puts ">>> Tcl: act_Cleanup <<<"

    call close

}

init_configs

set fsm(any_state,ev_disconnected)  "act_Cleanup  same_state"

set fsm(CALL_INIT,ev_setup_indication)   "act_Media PLAYPROMPT"

set fsm(PLAYPROMPT,ev_media_done) "act_Setup PLACECALL"

set fsm(PLACECALL,ev_disconnected)      "act_Cleanup CALLDISCONNECT"

set fsm(CALLDISCONNECT,ev_disconnected)   "act_Cleanup         same_state"

set fsm(CALLDISCONNECT,ev_media_done)     "act_Cleanup         same_state"

set fsm(CALLDISCONNECT,ev_disconnect_done) "act_Cleanup         same_state"

fsm define fsm CALL_INIT

-------------------------------------------

And here is the debug when the analog line try to call a phone behind the gateway:

.Jun  7 17:11:36: ISDN BR0/0/1 Q931: RX <- SETUP pd = 8  callref = 0x01

        Bearer Capability i = 0x9090A3

                Standard = CCITT

                Transfer Capability = 3.1kHz Audio

                Transfer Mode = Circuit

                Transfer Rate = 64 kbit/s

        Channel ID i = 0x89

        Progress Ind i = 0x8283 - Origination address is non-ISDN

        Calling Party Number i = 0x00A3, N/A

                Plan:Unknown, Type:Unknown

        Called Party Number i = 0x81, '2'

                Plan:ISDN, Type:Unknown

.Jun  7 17:11:36: //-1/xxxxxxxxxxxx/DPM/dpAssociateIncomingPeerCore:

   Calling Number=, Called Number=4040222, Voice-Interface=0x45D0C528,

   Timeout=FALSE, Peer Encap Type=ENCAP_VOICE, Peer Search Type=PEER_TYPE_VOICE,

   Peer Info Type=DIALPEER_INFO_SPEECH

.Jun  7 17:11:36: //-1/xxxxxxxxxxxx/DPM/dpAssociateIncomingPeerCore:

   Result=NO_MATCH(-1) After All Match Rules Attempt

.Jun  7 17:11:36: //-1/xxxxxxxxxxxx/DPM/dpAssociateIncomingPeerCore:

   Calling Number=, Called Number=4040222, Voice-Interface=0x0,

   Timeout=FALSE, Peer Encap Type=ENCAP_VOICE, Peer Search Type=PEER_TYPE_VOICE,

   Peer Info Type=DIALPEER_INFO_FAX

.Jun  7 17:11:36: //-1/xxxxxxxxxxxx/DPM/dpAssociateIncomingPeerCore:

   Result=NO_MATCH(-1) After All Match Rules Attempt

.Jun  7 17:11:36: //-1/xxxxxxxxxxxx/DPM/dpAssociateIncomingPeerCore:

   Calling Number=, Called Number=4040222, Voice-Interface=0x0,

   Timeout=FALSE, Peer Encap Type=ENCAP_VOICE, Peer Search Type=PEER_TYPE_VOICE,

   Peer Info Type=DIALPEER_INFO_SPEECH

.Jun  7 17:11:36: //-1/xxxxxxxxxxxx/DPM/dpAssociateIncomingPeerCore:

   Result=NO_MATCH(-1) After All Match Rules Attempt

.Jun  7 17:11:36: //-1/xxxxxxxxxxxx/DPM/dpAssociateIncomingPeerCore:

   Calling Number=, Called Number=4040222, Voice-Interface=0x45D0C528,

   Timeout=TRUE, Peer Encap Type=ENCAP_VOICE, Peer Search Type=PEER_TYPE_VOICE,

   Peer Info Type=DIALPEER_INFO_SPEECH

.Jun  7 17:11:36: //-1/xxxxxxxxxxxx/DPM/dpAssociateIncomingPeerCore:

   Result=Success(0) after DP_MATCH_INCOMING_DNIS; Incoming Dial-peer=102

.Jun  7 17:11:36: ISDN BR0/0/1 Q931: TX -> SETUP_ACK pd = 8  callref = 0x81

        Channel ID i = 0x89

.Jun  7 17:11:36: //-1//SERV:/AFW_Service_CCInterface: Received Event 24 for service annonce modulehandle NULL

.Jun  7 17:11:36: //-1//SERV:/AFW_Service_GetExecEnv: Script Name = annonce

.Jun  7 17:11:36: //-1//AFW_:/AFW_Process_New: annonce

.Jun  7 17:11:36: //-1//AFW_:/AFW_ExecEnv_New:

.Jun  7 17:11:36: //-1//AFW_:EE45929EF8000:/AFW_ExecEnv_SetRoot: Execenv = 0x45929EF8

.Jun  7 17:11:36: //-1//AFW_:/AFW_TclModule_New:

.Jun  7 17:11:36: //-1//AFW_:/AFW_Process_Lock: pProcess(0x4668030C)=1

.Jun  7 17:11:36: //-1//AFW_:LP:EE45929EF8000:HN25CBE4AC:/AFW_M_Object_SetExecEnv: ObjCount: 1, CmdPending 0

.Jun  7 17:11:36: //-1//AFW_:EE45929EF8000:/AFW_ExecEnv_SetScript:  Script Name = annonce,

.Jun  7 17:11:36: //-1//AFW_:EE45929EF8000:/AFW_ExecEnv_SetScript:     Script URI = flash:annoandforw3.tcl

.Jun  7 17:11:36: //-1//AFW_:EE45929EF8000:/Tcl_Link: Linking script annonce

.Jun  7 17:11:36: //-1//ACPK:EE45929EF8000:/AppCommon_SetSecurity: security = undefined

.Jun  7 17:11:36: //-1//ACPK:EE45929EF8000:/AppCommon_SetEventLog: event-log = unconfigured

.Jun  7 17:11:36: //-1//PACK:/CMeth_Httpios_Main: Main Executing

.Jun  7 17:11:36: //-1//TCL2:/Package_Tcl20Base_Load_Language:

.Jun  7 17:11:36: //-1//TCL :EE45929EF8000:/tcl_InfotagObjCmd:  infotag get cfg_avpair_exists welcome-prompt

.Jun  7 17:11:36: //-1//TCL :EE45929EF8000:/tcl_InfotagGetObjCmd: infotag get cfg_avpair_exists welcome-prompt

.Jun  7 17:11:36: //-1//AFW_:EE45929EF8000:/vtr_cf_avpair_exists: argc 3 argindex 2

.Jun  7 17:11:36: //-1//TCL :EE45929EF8000:/tcl_FSMObjCmd:  fsm define fsm CALL_INIT

.Jun  7 17:11:36: //-1//AFW_:/AFW_FSM_New:

.Jun  7 17:11:36: //-1//TCL :EE45929EF8000:/tcl_FSMDefineObjCmd: State Machine: Array fsm: Start State: CALL_INIT

.Jun  7 17:11:36: //-1//TCL :EE45929EF8000:/tcl_FSMDefineObjCmd: FSM Data structure

.Jun  7 17:11:36: (CALLDISCONNECT(2), ev_media_done(136)--(act_Cleanup)-->(any_state(0))

.Jun  7 17:11:36: (any_state(0), ev_disconnected(16)--(act_Cleanup)-->(any_state(0))

.Jun  7 17:11:36: (PLACECALL(3), ev_disconnected(16)--(act_Cleanup)-->(CALLDISCONNECT(2))

.Jun  7 17:11:36: (CALLDISCONNECT(2), ev_disconnect_done(17)--(act_Cleanup)-->(any_state(0))

.Jun  7 17:11:36: (CALLDISCONNECT(2), ev_disconnected(16)--(act_Cleanup)-->(any_state(0))

.Jun  7 17:11:36: (PLAYPROMPT(4), ev_media_done(136)--(act_Setup)-->(PLACECALL(3))

.Jun  7 17:11:36: (CALL_INIT(1), ev_setup_indication(29)--(act_Media)-->(PLAYPROMPT(4))

.Jun  7 17:11:36: FSM start state CALL_INIT(1)

.Jun  7 17:11:36: //-1//AFW_:EE45929EF8000:/Tcl_Link: Script annonce succesfully linked.

.Jun  7 17:11:36: //-1//AFW_:EE45929EF8000:/AFW_ExecEnv_SetScript: Num of packTable entries: 26

.Jun  7 17:11:36: //-1//AFW_:EE45929EF8000:/AFW_ExecEnv_Initiate: Execenv = 0x45929EF8

.Jun  7 17:11:36: //-1//AFW_:/AFW_Leg_New:

.Jun  7 17:11:36: //76628//AFW_:/AFW_M_Leg_SetExecEnv:

.Jun  7 17:11:36: //-1//AFW_:EE45929EF8000:/AFW_ExecEnv_IncrPendingCmd:  PendingCmdCount: 1

.Jun  7 17:11:36: //-1//AFW_:LP:EE45929EF8000:LG76628:/AFW_M_Object_SetExecEnv: ObjCount: 2, CmdPending 1

.Jun  7 17:11:36: //76628//AFW_:/AFW_M_Leg_GetHandle: Leg handle: LEG_76628

.Jun  7 17:11:36: //-1//AFW_:EE45929EF8000:/AFW_ExecEnv_AssignCall: Execenv = 0x45929EF8, Leg = 76628, Peer_Tag = 102

.Jun  7 17:11:36: //-1//SERV:/AFW_Service_Process_Space:

.Jun  7 17:11:36: Process Started

.Jun  7 17:11:36: //-1//AFW_:/AFW_Process_Register: ccAppInitialize(name: _ManagedAppProcess_annonce)

.Jun  7 17:11:36: //-1//AFW_:/AFW_Event_New:

.Jun  7 17:11:36: //76628//AFW_:/AFW_Process_GetCcqEvent: Received

.Jun  7 17:11:36: //-1//AFW_:/AFW_Process_GetCcqEvent:   Event[CC_EV_CALL_SETUP_IND(29)] {

.Jun  7 17:11:36: //-1//AFW_:/AFW_Process_GetCcqEvent:     EXECENV[0x45929EF8][annonce]

.Jun  7 17:11:36: //-1//AFW_:/AFW_Process_GetCcqEvent:     LEG[76628][LEG_INIT(0)][Cause(0)]

.Jun  7 17:11:36: //-1//AFW_:/AFW_Process_GetCcqEvent:   }

.Jun  7 17:11:36: //76628//SSIN:/AFW_SS_MapEvent:

.Jun  7 17:11:36: //76628//AFW_:/AFW_Leg_GetTypeDetail: invalid interface

.Jun  7 17:11:36: //-1//SSIN:/AFW_SS_Telephony_MapEvent:

.Jun  7 17:11:36: //-1//AFW_:/AFW_Util_SaveRawMsg:

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_UpdateStats: Updating stats for ID 9695 type 0

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Object_WalkListeners:

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_M_Object_ShowListeners: START

.Jun  7 17:11:36: //-1//AFW_:/AFW_M_Object_ShowListeners:

.Jun  7 17:11:36: //76628//AFW_:/AFW_M_Module_GetHandle: Module handle: TclModule_46686354_14_634119340MOD[TclModule_46686354_14_634119340                    ]  (

.Jun  7 17:11:36: //-1//AFW_:/AFW_M_Object_ShowListeners:     LEG[76628][LEG_INCINIT(1)][Cause(0)]

.Jun  7 17:11:36: //-1//AFW_:/AFW_M_Object_ShowListeners:   )

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_M_Object_ShowListeners: END

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Object_WalkListeners: Entering Module : TclModule

.Jun  7 17:11:36: //76628//AFW_:/AFW_ExecEnv_SetModuleScope: TclModule_46686354_14_634119340 ---> TclModule_46686354_14_634119340

.Jun  7 17:11:36: //76628//AFW_:/AFW_M_TclModule_Action:

.Jun  7 17:11:36: //76628//AFW_:/AFW_TclModule_DefaultEvHandling:

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_CheckIncomingCallBlock:

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_IncomingCallBlock: type=0,profile=0x460DC248

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_IncomingCallBlock: cllng() clld(4040222) redirect()

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_IncomingCallBlock: xrule:org_num() type(0) plan(0)

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_IncomingCallBlock: type=1,profile=0x460DC248

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_IncomingCallBlock: cllng() clld(4040222) redirect()

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_IncomingCallBlock: xrule:org_num(4040222) type(0) plan(1)

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_IncomingCallBlock: type=2,profile=0x460DC248

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_IncomingCallBlock: cllng() clld(4040222) redirect()

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_IncomingCallBlock: xrule:org_num() type(-1) plan(-1)

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_SettlementValidateCall: target=, tokenp=0x0

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_IncomingTranslate:

.Jun  7 17:11:36: //76628//AFW_:/AFW_FSM_Drive: ACTION BEGIN: ------(CALL_INIT[1],ev_setup_indication[29])---[act_Media]------

.Jun  7 17:11:36: //76628//TCL :/tcl_InfotagObjCmd:  infotag get leg_dnis

.Jun  7 17:11:36: //76628//TCL :/tcl_InfotagGetObjCmd: infotag get leg_dnis

.Jun  7 17:11:36: //76628//AFW_:/vtr_lg_dnis: argc 2 argindex 2

.Jun  7 17:11:36: //76628//TCL :/tcl_LegObjCmd:  leg setupack leg_incoming

.Jun  7 17:11:36: //76628//TCL :/tcl_LegSetupAckObjCmd: setupack leg_incoming

.Jun  7 17:11:36: //76628//AFW_:/vtd_lg_incoming: argc 2

.Jun  7 17:11:36: //76628//AFW_:/vtd_lg_incoming: Legs [76628 ]

.Jun  7 17:11:36: //76628//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1

.Jun  7 17:11:36: //76628//AFW_:/AFW_FSM_Drive: Tcl_Eval to drive FSM inside Tcl modulespace. code=1 code=ERROR

.Jun  7 17:11:36: TCL script failure

        Result:

                         Illegal Operation: Leg not incoming or in wrong state

.Jun  7 17:11:36:       TCL script failure errorInfo:

                        Illegal Operation: Leg not incoming or in wrong state

    while executing

"leg setupack leg_incoming

    (procedure "act_Media" line 7)

    invoked from within

"act_Media"

.Jun  7 17:11:36: //76628//AFW_:/AFW_FSM_Drive: ACTION END: -------------(PLAYPROMPT[4])---------------

.Jun  7 17:11:36: //-1//AFW_:/AFW_ExecEnv_CallClose:  Exec Env state: 1

.Jun  7 17:11:36: //-1//AFW_:/AFW_ExecEnv_CallClose:  Terminating ExecEnv's root module

.Jun  7 17:11:36: //76628//AFW_:/AFW_Module_Terminate:  Terminating Module: TclModule_46686354_14_634119340

.Jun  7 17:11:36: //76628//AFW_:/AFW_M_TclModule_Terminate:  Module is in the state: ACTIVE

.Jun  7 17:11:36: //76628//AFW_:/AFW_TclModule_Cleaner: lastFailureCause 0

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_Disconnect: Disconnecting Leg: LEG_76628, Cause 16

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_Leg_UpdateStats: Updating stats for ID 9695 type 2

.Jun  7 17:11:36: //76628//AFW_:/AFW_ExecEnv_SetModuleScope: TclModule_46686354_14_634119340 ---> TclModule_46686354_14_634119340

.Jun  7 17:11:36: //-1//AFW_:/AFW_Instance_DecrRefCount: Object: 0x466B1A64, Type: Event, RefCount: 0

.Jun  7 17:11:36: //76628/4AA30BF4B70C/AFW_:/AFW_M_Event_Free:

.Jun  7 17:11:36: //76628//AFW_:/AFW_ExecEnv_CloseIfDone: Cmd Count: 1

.Jun  7 17:11:36: ISDN BR0/0/1 Q931: TX -> DISCONNECT pd = 8  callref = 0x81

        Cause i = 0x8090 - Normal call clearing

.Jun  7 17:11:36: ISDN BR0/0/1 Q931: RX <- INFORMATION pd = 8  callref = 0x01

        Sending Complete

        Called Party Number i = 0x81, '4'

                Plan:ISDN, Type:Unknown

------------------------------------------------------------------------------

We tried to call the number 40402224

As you can see, the last digit which is a "4", is collected after the beginning of the application...

Could someone help me please ?

8 Replies 8

tjohannessen
Level 1
Level 1

Hi Marc,

I am facing the same problem.

Did you resolve this? Care to share? :-)

br,

Trond

You must configure the complete incoming called number in DP, so the script is invoked when all digits have been received.

Hello TJ,

I resolved this issue by creating a new dial peer beetween the "pstn pots dial peer" and the "CUCM dial peer".

The service which will run the tcl script must be launch on the last dial peer to CUCM.

So I created the dial peer 200 which collect the entire calling number and don't launch the tcl script.

After that, you can translate or manipulate the number to match  with the dial peer to the CUCM. In my exemple, I matched and stripped  the first 6 digits in dial peer 200, and matched with the 3 last digits  in dial peer 300, the annonce will run...

Here is my config :

dial-peer voice 100 pots

trunkgroup 1

description CALL_INCOMING_FROM_PSTN

call-block translation-profile incoming PROF10

incoming called-number .T

direct-inward-dial

!

dial-peer voice 300 voip

description CALL_OUTGOING_TO_CUCM

service annonce

destination-pattern 2..

progress_ind setup enable 3

session target ipv4:172.16.211.11

incoming called-number 2..

!

dial-peer voice 200 voip

description DIAL-PEER to prevent OVERLAP issue

translation-profile outgoing PROF1

destination-pattern 404022T //that is the root number which I will strip to last 3 digit to match with dial peer 300

session target ipv4:172.16.211.12 //IP Adress of the gateway to loop to the dial peer 300

Hi!

Thanks for the answers! For some reason Paolos suggestion did not work, I was not able to get a match with the incoming called-number command. But looping over IP as Marc suggested worked nicely. Needed g711u codec in addition.

br,

Trond

tjohannessen
Level 1
Level 1

Hi, Just wanted to share my final solution to this.

I first got it working doing the loop over IP solution, but the problem was that the next calleg also needed to be g729 sometimes. So to avoid using a transcoder to to this I managed to collect the digits inside the scrips instead, and then removed the need for looping over IP.

I can mail you the script i you want it.

regards,

Trond

Trond,

I am trying to do something very similar could you email me the script?

Thanks

Hi Trond, 

can you please send us the modified script you've created. We face the same issue as mentioned.

Best regards,

Matt

Hi,

Some years ago now, but I think it is this is the correct one. This accepts call on analogue port, plays amessage, accepts digit input, and forwards the call. You also needs that wav file correctly formatted of course. tcl attached but renamed for upload

good luck!

IOS config:

application

service spillmeldingcollect flash:spillmeldingcollect.tcl

  paramspace english index 0

  paramspace english language en

  paramspace english location flash:

 param welcome-prompt flash:ulawtest.wav

 

dial-peer voice 991 pots

 service spillmeldingcollect

 

dial-peer voice 990 pots

 service spillmeldingcollect