call getting kicked out to upstream peer on cannection destroy

Version 1
    This document was generated from CDN thread

    Created by: Dan Armstrong on 26-01-2010 10:11:50 PM
    As I read the docs, I should be able to to do a 'connection destroy' without effecting call legs.  But, when I do the connection destroy, the inbound call gets a generic call failure message from our upstream peer.
     
    I am trying to reroute the call on fax detection, and my script is fine until the 'connection destroy'
     

    proc act_destroy_connection {} {
     connection destroy [lindex [infotag get evt_connections] 0]
    }
     
    proc act_disconnect_outbound_leg {} {
    timer stop leg_timer leg_incoming
    leg tonedetect leg_incoming disable cng
    leg disconnect leg_outgoing 16
    }

    Subject: RE: call getting kicked out to upstream peer on cannection destroy
    Replied by: Yawming Chen on 27-01-2010 12:19:50 AM
    What error message you got ?
     
    Before you do  "connection destroy" you might want check connection status to make sure there is a connection to destroy.
     
    Also make sure your "proc act_destroy_connection {} is called upon those event listed in "scope" and wait for ev_destroy_done to do next
     
    Here is an example to check status before destroy

           set con_status [infotag get con_all]

     
           if {$con_status != ""} {
                connection destroy con_all
           # Still has a connection, connection destroy will get ev_destroy_done which will call act_Destroyed
           } else {
           # if there is no connect, this is the way to go to act_Destroyed
               act_Destroyed
               fsm setstate PLACECALL2
           }
      
      
      
     

    Subject: RE: call getting kicked out to upstream peer on cannection destroy
    Replied by: Dan Armstrong on 27-01-2010 07:20:12 PM
    Actually, I think I found my problem earlier than the 'connection destroy'.
     
    Bad call:
    Jan 27 18:48:33.124: //128437//TCL :/tcl_LegObjCmd:  leg setup 4165832182 callInfo leg_incoming
    Jan 27 18:48:33.124: //128437//AFW_:/vtd_lg_incoming: argc 4
    Jan 27 18:48:33.124: //128437//AFW_:/vtd_lg_incoming: Legs [128437 ]
    Jan 27 18:48:33.124: //128437//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    Jan 27 18:48:33.128: //128437//AFW_:/AFW_M_TclModule_Action: 
    Jan 27 18:48:33.128: //128437//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Jan 27 18:48:38.868: //-1//SERV:/AFW_Service_CheckExecEnvCache: Script Name = Default Freeing.. 0x66292C44
    Jan 27 18:48:38.868: //-1//SCRI:/cam_sa_stopped: Instance: [] ExecEnv: 0x66292C44
    Jan 27 18:48:38.868: //-1//AFW_:HN4469F800:/AFW_M_TclModule_Free:  MOD[TclModule_65DF6D94_2_1147795456] ( )
     
    Good call:
    Jan 27 18:48:49.624: //128439//TCL :/tcl_LegObjCmd:  leg setup 4166206773 callInfo leg_incoming
    Jan 27 18:48:49.624: //128439//AFW_:/vtd_lg_incoming: argc 4
    Jan 27 18:48:49.624: //128439//AFW_:/vtd_lg_incoming: Legs [128439 ]
    Jan 27 18:48:49.624: //128439//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    Jan 27 18:48:49.628: //128439//AFW_:/AFW_M_TclModule_Action: 
    Jan 27 18:48:49.628: //128439//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Jan 27 18:48:49.744: //128439//AFW_:/AFW_M_TclModule_Action: 
    Jan 27 18:48:49.744: //128439//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Jan 27 18:48:49.744: //128439//TCL :/tcl_InfotagObjCmd:  infotag get evt_status
     
    I just captured these, so I've still got to look up those last three funny messages of the bad call.  I can say this; where this leg setup is going, knows nothing about this DID.
     
     

    Subject: RE: call getting kicked out to upstream peer on cannection destroy
    Replied by: Vijay Prasad Neelamegam on 28-01-2010 05:43:02 AM
    Hi Dan,
     
    Bad call:
    Jan 27 18:48:33.124: //128437//TCL :/tcl_LegObjCmd:  leg setup 4165832182 callInfo leg_incoming
     
    Good call:
    Jan 27 18:48:49.624: //128439//TCL :/tcl_LegObjCmd:  leg setup 4166206773 callInfo leg_incoming
     
    Here leg setup has different numbers,Have you configure the dest-pattern in such away to match these 2  number to same dial-peer?
    if no,then check the dial-peer which is matching this 4165832182 number,if there any other script deployed.
     
    its just my thought
     
    Thanks
    Vijay

    Subject: RE: call getting kicked out to upstream peer on cannection destroy
    Replied by: Dan Armstrong on 28-01-2010 04:40:31 PM
    In thinking about it, I think I figured out my problem.  I was assuming (Something we should never do ;^) that the target of the dial-peer would just magically be dumb, which it isn't.  The target of the dial-peer knows nothing about the "bad" number, and is cause a ls_004 status, and I'm trying to setup the leg with an associated leg_incoming.  So, what I'm writing right now, is I try to setup the leg_outgoing without an associated leg_incoming, and if I get a ls_000 I know it's a voice call, at the least, and if I get a ls_004, I know that it isn't a voice call at all.
     
    Then, if it was a ls_000, I'll do a connection create to finish the call setup, and if I get a ls_004, I'll look in a list to see if it's a fax-only DNIS, and handoff to fax_on_vfc_onramp_app.  If it is a valid voice call, I'll do the CNG detection for customers with shared voice/fax DID's.
     
    I'll let you know how it works out, and I can post the code, if anyone is interested.
     
    On a side note, in looking at the debug out put, I see that the TCL code gets relinked periotically.
     
    1)Is it relinked for each call, or just at some interval?
    2) If it gets relinked only at an interval, could I simply overwrite the TCL source file whenever I need to update the list of fax-only DNIS's?
     
    I would like to be able to update the list of fax-only DNIS's with as little interaction with the CLI as possible.  I don't want the code to reference the list externally, by HTTP for example, because I want this script to run as quick as possible.

    Subject: RE: call getting kicked out to upstream peer on cannection destroy
    Replied by: Dan Armstrong on 01-02-2010 09:35:54 PM
    Ok, I am now officailly stumped.  Now, my TCL script isn't even going into the first routine:
     
    Feb  1 21:20:16.039: //-1//SERV:/AFW_Service_CCInterface: Received Event 24 for service Default modulehandle NULL
    Feb  1 21:20:16.039: //-1//SERV:/AFW_Service_GetExecEnv: Script Name = Default
    Feb  1 21:20:16.039: //-1//SERV:/AFW_Service_GetExecEnv: Using Cached ExecEnv
    Feb  1 21:20:16.039: //-1//AFW_:/AFW_M_TclModule_NewDup: 
    Feb  1 21:20:16.039: //-1//AFW_:HN5EB33030:/AFW_M_TclModule_Free:  MOD[TclModule_65DF60A4_2_1588801584] ( )
    Feb  1 21:20:16.039: //-1//AFW_:EE66292FE4000:/AFW_ExecEnv_RestoreDataBackup: Restore DataArea from Script
    Feb  1 21:20:16.039: //-1//AFW_:EE66292FE4000:/AFW_ExecEnv_RestoreDataBackup: Restore TokenTable from Script
    Feb  1 21:20:16.039: //134518//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:20:16.039: //134518//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:20:16.115: //134518//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:20:16.115: //134518//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:20:25.583: //134516//AFW_:/Session_Cleaner: lastFailureCause 16
    Feb  1 21:20:25.583: //134516//AFW_:/Session_Cleaner: lastFailureCause 16
    Feb  1 21:20:25.583: //134516//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:20:25.583: //134516//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:20:25.631: //134516//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:20:25.631: //134516//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:20:25.631: //-1//AFW_:/AFW_ExecEnv_CallClose:  Exec Env state: 1
    Feb  1 21:20:25.631: //-1//AFW_:/AFW_ExecEnv_CallClose:  Terminating ExecEnv's root module
    Feb  1 21:20:25.631: //134516//AFW_:/AFW_M_TclModule_Terminate:  Module is in the state: ACTIVE
    Feb  1 21:20:25.631: //134516//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:20:25.631: //134516//AFW_:/AFW_M_TclModule_Action: Module is Terminating
    Feb  1 21:20:25.631: //134516//AFW_:/AFW_TclModule_ReturnIfDone:  Sending Out APP_EV_TCLMODULE_DONE event
    Feb  1 21:20:25.631: //-1//AFW_:/AFW_ExecEnv_CallClose:  Exec Env state: 3
    Feb  1 21:20:25.631: //134516//AFW_:/AFW_M_TclModule_EventPreProcess: 
    Feb  1 21:20:25.631: //-1//SERV:/AFW_Service_ReleaseExecEnv: Script Name = Default cache = true calls = 3
    Feb  1 21:20:25.631: //-1//SCRI:/cam_sa_stopped: Instance: [] ExecEnv: 0x6629346C
    Feb  1 21:20:31.687: //-1//SERV:/AFW_Service_CCInterface: Received Event 24 for service Default modulehandle NULL
    Feb  1 21:20:31.687: //-1//SERV:/AFW_Service_GetExecEnv: Script Name = Default
    Feb  1 21:20:31.687: //-1//SERV:/AFW_Service_GetExecEnv: Using Cached ExecEnv
    Feb  1 21:20:31.687: //-1//AFW_:/AFW_M_TclModule_NewDup: 
    Feb  1 21:20:31.687: //-1//AFW_:HN5EB4B478:/AFW_M_TclModule_Free:  MOD[TclModule_66E74E6C_2_1588900984] ( )
    Feb  1 21:20:31.687: //-1//AFW_:EE6629346C000:/AFW_ExecEnv_RestoreDataBackup: Restore DataArea from Script
    Feb  1 21:20:31.687: //-1//AFW_:EE6629346C000:/AFW_ExecEnv_RestoreDataBackup: Restore TokenTable from Script
    Feb  1 21:20:31.687: //134520//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:20:31.687: //134520//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:20:36.635: //-1//SERV:/AFW_Service_CheckExecEnvCache: Script Name = Default Freeing.. 0x66293384
    Feb  1 21:20:36.635: //-1//SCRI:/cam_sa_stopped: Instance: [] ExecEnv: 0x66293384
    Feb  1 21:20:36.635: //-1//AFW_:HN5EB4DF74:/AFW_M_TclModule_Free:  MOD[TclModule_66E7473C_2_1588911988] ( )
    Feb  1 21:20:47.775: //134520//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:20:47.775: //134520//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:20:54.683: //134518//AFW_:/Session_Cleaner: lastFailureCause 16
    Feb  1 21:20:54.683: //134518//AFW_:/Session_Cleaner: lastFailureCause 16
    Feb  1 21:20:54.683: //134518//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:20:54.683: //134518//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:20:54.731: //134518//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:20:54.731: //134518//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:20:54.731: //-1//AFW_:/AFW_ExecEnv_CallClose:  Exec Env state: 1
    Feb  1 21:20:54.731: //-1//AFW_:/AFW_ExecEnv_CallClose:  Terminating ExecEnv's root module
    Feb  1 21:20:54.731: //134518//AFW_:/AFW_M_TclModule_Terminate:  Module is in the state: ACTIVE
    Feb  1 21:20:54.731: //134518//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:20:54.731: //134518//AFW_:/AFW_M_TclModule_Action: Module is Terminating
    Feb  1 21:20:54.731: //134518//AFW_:/AFW_TclModule_ReturnIfDone:  Sending Out APP_EV_TCLMODULE_DONE event
    Feb  1 21:20:54.731: //-1//AFW_:/AFW_ExecEnv_CallClose:  Exec Env state: 3
    Feb  1 21:20:54.731: //134518//AFW_:/AFW_M_TclModule_EventPreProcess: 
    Feb  1 21:20:54.731: //-1//SERV:/AFW_Service_ReleaseExecEnv: Script Name = Default cache = true calls = 3
    Feb  1 21:20:54.731: //-1//SCRI:/cam_sa_stopped: Instance: [] ExecEnv: 0x66292FE4
    Feb  1 21:21:16.939: //134476//AFW_:/Session_Cleaner: lastFailureCause 16
    Feb  1 21:21:16.939: //134476//AFW_:/Session_Cleaner: lastFailureCause 16
    Feb  1 21:21:17.131: //134476//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:21:17.131: //134476//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:21:17.131: //-1//AFW_:/AFW_ExecEnv_CallClose:  Exec Env state: 1
    Feb  1 21:21:17.131: //-1//AFW_:/AFW_ExecEnv_CallClose:  Terminating ExecEnv's root module
    Feb  1 21:21:17.131: //134476//AFW_:/AFW_M_TclModule_Terminate:  Module is in the state: ACTIVE
    Feb  1 21:21:17.131: //134476//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:21:17.131: //134476//AFW_:/AFW_M_TclModule_Action: Module is Terminating
    Feb  1 21:21:17.131: //134476//AFW_:/AFW_TclModule_ReturnIfDone:  Sending Out APP_EV_TCLMODULE_DONE event
    Feb  1 21:21:17.131: //-1//AFW_:/AFW_ExecEnv_CallClose:  Exec Env state: 3
    Feb  1 21:21:17.131: //134476//AFW_:/AFW_M_TclModule_EventPreProcess: 
    Feb  1 21:21:17.131: //-1//SERV:/AFW_Service_ReleaseExecEnv: Script Name = Default cache = true calls = 2
    Feb  1 21:21:17.131: //-1//SCRI:/cam_sa_stopped: Instance: [] ExecEnv: 0x66292A74
    Feb  1 21:21:37.139: //-1//SERV:/AFW_Service_CCInterface: Received Event 24 for service fax_detect modulehandle NULL
    Feb  1 21:21:37.139: //-1//SERV:/AFW_Service_GetExecEnv: Script Name = fax_detect
    Feb  1 21:21:37.139: //-1//AFW_:/AFW_TclModule_New: 
    Feb  1 21:21:37.139: //-1//AFW_:EE638C6A24000:/Tcl_Link: Linking script fax_detect
    Feb  1 21:21:37.143: //-1//ACPK:EE638C6A24000:/AppCommon_SetSecurity: security = undefined
    Feb  1 21:21:37.143: //-1//ACPK:EE638C6A24000:/AppCommon_SetEventLog: event-log = unconfigured
    Feb  1 21:21:37.143: //-1//TCL :EE638C6A24000:/tcl_FSMObjCmd:  fsm define FSM CALL_INIT
    Feb  1 21:21:37.143: //-1//TCL :EE638C6A24000:/tcl_FSMDefineObjCmd: State Machine: Array FSM: Start State: CALL_INIT
    Feb  1 21:21:37.143: //-1//TCL :EE638C6A24000:/tcl_FSMDefineObjCmd: FSM Data structure
    Feb  1 21:21:37.143: (SWITCH_FAX_OUTGOING(2), ev_disconnect_done(17)--(act_setup_fax_outgoing)-->(CLEANUP(3))
    Feb  1 21:21:37.143: (CLEANUP(3), ev_disconnected(16)--(act_cleanup)-->(any_state(0))
    Feb  1 21:21:37.143: (DISCONNECT_LEG_OUTGOING(4), ev_destroy_done(35)--(act_disconnect_leg_outgoing)-->(SWITCH_FAX_OUTGOING(2))
    Feb  1 21:21:37.143: (VOICE_PROCEEDING(5), ev_setup_done(167)--(act_voice_proceeding)-->(CONNECTION_DESTROY(6))
    Feb  1 21:21:37.143: (SETUP_FAX_OUTGOING(7), ev_setup_done(167)--(act_setup_fax_outgoing)-->(CLEANUP(3))
    Feb  1 21:21:37.143: (CONNECTION_DESTROY(6), ev_tone_detected(30)--(act_connection_destroy)-->(DISCONNECT_LEG_OUTGOING(4))
    Feb  1 21:21:37.143: (any_state(0), ev_leg_timer(1)--(act_disable_cng)-->(any_state(0))
    Feb  1 21:21:37.143: FSM start state CALL_INIT(1)
    Feb  1 21:21:37.143: //-1//AFW_:EE638C6A24000:/Tcl_Link: Script fax_detect succesfully linked.
    Feb  1 21:21:37.143: //-1//AFW_:EE638C6A24000:/AFW_ExecEnv_SetScript: Num of packTable entries: 27
    Feb  1 21:21:37.143: //-1//AFW_:EE638C6A24000:/AFW_ExecEnv_RestoreDataBackup: Script DataArea empty, do backup
    Feb  1 21:21:37.143: //-1//AFW_:EE638C6A24000:/AFW_ExecEnv_RestoreDataBackup: Script TokenTable empty, do backup
    Feb  1 21:21:37.143: //-1//SERV:/AFW_Service_Process_Space:
    Feb  1 21:21:37.143: Process Started
    Feb  1 21:21:37.143: //134522//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:21:37.143: //134522//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:21:41: %ISDN-6-REPEATED_SETUP: Interface Se7/0:1:23 Call Cid 0x0365 Cref 0x832A received a retransmitted setup on channel 21 in_use_cid 0x7D7A cref 0x951F.
    Feb  1 21:21:41.139: //-1//SERV:/AFW_Service_CCInterface: Received Event 24 for service fax_detect modulehandle NULL
    Feb  1 21:21:41.139: //-1//SERV:/AFW_Service_GetExecEnv: Script Name = fax_detect
    Feb  1 21:21:41.139: //-1//AFW_:/AFW_TclModule_New: 
    Feb  1 21:21:41.139: //-1//AFW_:EE638C5C8C000:/Tcl_Link: Linking script fax_detect
    Feb  1 21:21:41.139: //-1//ACPK:EE638C5C8C000:/AppCommon_SetSecurity: security = undefined
    Feb  1 21:21:41.139: //-1//ACPK:EE638C5C8C000:/AppCommon_SetEventLog: event-log = unconfigured
    Feb  1 21:21:41.143: //-1//TCL :EE638C5C8C000:/tcl_FSMObjCmd:  fsm define FSM CALL_INIT
    Feb  1 21:21:41.143: //-1//TCL :EE638C5C8C000:/tcl_FSMDefineObjCmd: State Machine: Array FSM: Start State: CALL_INIT
    Feb  1 21:21:41.143: //-1//TCL :EE638C5C8C000:/tcl_FSMDefineObjCmd: FSM Data structure
    Feb  1 21:21:41.143: (SWITCH_FAX_OUTGOING(2), ev_disconnect_done(17)--(act_setup_fax_outgoing)-->(CLEANUP(3))
    Feb  1 21:21:41.143: (CLEANUP(3), ev_disconnected(16)--(act_cleanup)-->(any_state(0))
    Feb  1 21:21:41.143: (DISCONNECT_LEG_OUTGOING(4), ev_destroy_done(35)--(act_disconnect_leg_outgoing)-->(SWITCH_FAX_OUTGOING(2))
    Feb  1 21:21:41.143: (VOICE_PROCEEDING(5), ev_setup_done(167)--(act_voice_proceeding)-->(CONNECTION_DESTROY(6))
    Feb  1 21:21:41.143: (SETUP_FAX_OUTGOING(7), ev_setup_done(167)--(act_setup_fax_outgoing)-->(CLEANUP(3))
    Feb  1 21:21:41.143: (CONNECTION_DESTROY(6), ev_tone_detected(30)--(act_connection_destroy)-->(DISCONNECT_LEG_OUTGOING(4))
    Feb  1 21:21:41.143: (any_state(0), ev_leg_timer(1)--(act_disable_cng)-->(any_state(0))
    Feb  1 21:21:41.143: FSM start state CALL_INIT(1)
    Feb  1 21:21:41.143: //-1//AFW_:EE638C5C8C000:/Tcl_Link: Script fax_detect succesfully linked.
    Feb  1 21:21:41.143: //-1//AFW_:EE638C5C8C000:/AFW_ExecEnv_SetScript: Num of packTable entries: 27
    Feb  1 21:21:41.143: //134523//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:21:41.143: //134523//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:21:47.683: //134520//AFW_:/Session_Cleaner: lastFailureCause 16
    Feb  1 21:21:47.683: //134520//AFW_:/Session_Cleaner: lastFailureCause 16
    Feb  1 21:21:47.683: //134520//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:21:47.683: //134520//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:21:47.731: //134520//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:21:47.731: //134520//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:21:47.731: //-1//AFW_:/AFW_ExecEnv_CallClose:  Exec Env state: 1
    Feb  1 21:21:47.731: //-1//AFW_:/AFW_ExecEnv_CallClose:  Terminating ExecEnv's root module
    Feb  1 21:21:47.731: //134520//AFW_:/AFW_M_TclModule_Terminate:  Module is in the state: ACTIVE
    Feb  1 21:21:47.731: //134520//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:21:47.731: //134520//AFW_:/AFW_M_TclModule_Action: Module is Terminating
    Feb  1 21:21:47.731: //134520//AFW_:/AFW_TclModule_ReturnIfDone:  Sending Out APP_EV_TCLMODULE_DONE event
    Feb  1 21:21:47.731: //-1//AFW_:/AFW_ExecEnv_CallClose:  Exec Env state: 3
    Feb  1 21:21:47.731: //134520//AFW_:/AFW_M_TclModule_EventPreProcess: 
    Feb  1 21:21:47.731: //-1//SERV:/AFW_Service_ReleaseExecEnv: Script Name = Default cache = true calls = 1
    Feb  1 21:21:47.731: //-1//SCRI:/cam_sa_stopped: Instance: [] ExecEnv: 0x6629346C
    Feb  1 21:22:00.039: //-1//SERV:/AFW_Service_CCInterface: Received Event 24 for service Default modulehandle NULL
    Feb  1 21:22:00.039: //-1//SERV:/AFW_Service_GetExecEnv: Script Name = Default
    Feb  1 21:22:00.039: //-1//SERV:/AFW_Service_GetExecEnv: Using Cached ExecEnv
    Feb  1 21:22:00.039: //-1//AFW_:/AFW_M_TclModule_NewDup: 
    Feb  1 21:22:00.039: //-1//AFW_:HN5EB5F52C:/AFW_M_TclModule_Free:  MOD[TclModule_65DF6F04_2_1588983084] ( )
    Feb  1 21:22:00.039: //-1//AFW_:EE6629346C000:/AFW_ExecEnv_RestoreDataBackup: Restore DataArea from Script
    Feb  1 21:22:00.039: //-1//AFW_:EE6629346C000:/AFW_ExecEnv_RestoreDataBackup: Restore TokenTable from Script
    Feb  1 21:22:00.039: //134524//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:22:00.039: //134524//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:22:00.163: //134524//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:22:00.163: //134524//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:22:06.031: //134524//AFW_:/Session_Cleaner: lastFailureCause 16
    Feb  1 21:22:06.031: //134524//AFW_:/Session_Cleaner: lastFailureCause 16
    Feb  1 21:22:06.031: //134524//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:22:06.031: //134524//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:22:06.083: //134524//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:22:06.083: //134524//AFW_:/AFW_TclModule_DefaultEvHandling: 
    Feb  1 21:22:06.083: //-1//AFW_:/AFW_ExecEnv_CallClose:  Exec Env state: 1
    Feb  1 21:22:06.083: //-1//AFW_:/AFW_ExecEnv_CallClose:  Terminating ExecEnv's root module
    Feb  1 21:22:06.083: //134524//AFW_:/AFW_M_TclModule_Terminate:  Module is in the state: ACTIVE
    Feb  1 21:22:06.083: //134524//AFW_:/AFW_M_TclModule_Action: 
    Feb  1 21:22:06.083: //134524//AFW_:/AFW_M_TclModule_Action: Module is Terminating
    Feb  1 21:22:06.083: //134524//AFW_:/AFW_TclModule_ReturnIfDone:  Sending Out APP_EV_TCLMODULE_DONE event
    Feb  1 21:22:06.083: //-1//AFW_:/AFW_ExecEnv_CallClose:  Exec Env state: 3
    Feb  1 21:22:06.083: //134524//AFW_:/AFW_M_TclModule_EventPreProcess: 
    Feb  1 21:22:06.083: //-1//SERV:/AFW_Service_ReleaseExecEnv: Script Name = Default cache = true calls = 1
    Feb  1 21:22:06.083: //-1//SCRI:/cam_sa_stopped: Instance: [] ExecEnv: 0x6629346Cterm no mon
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    In the above, I try to call our main number, and simple get three beeps, then the call fails.
     
    This is the code:
     
    proc act_connection_destroy {} {
      timer stop leg_timer leg_incoming
      leg tonedetect leg_incoming disable cng
      connection destroy leg_incoming
    puts "\nConnection Destroyed!!!\n"
    }
    proc act_disconnect_leg_outgoing {} {
      leg disconnect leg_outgoing 16
    }
    proc act_setup_fax_outgoing {} {
    global DNIS
      set args "au-ctrl=0, acc-ctrl=0, au-method=0, accounting-list=fax, au-status=1, account=[set $DNIS]"
      set callInfo(alertTime) -1
      set callInfo(fax) true
      set callInfo(accountNum) 0
      set callInfo(argstring) $args
      leg setup leg_outgoing callInfo -d 2
    #  set args "au-ctrl=0, acc-ctrl=0, au-method=0, accounting-list=fax, au-status=1, account=[set $DNIS], mailtoAddress=mailto:$d$@inbound.efax.beanfield.com"
    #  handoff appl leg_incoming fax_on_vfc_onramp_app -s $args
    }
    proc act_cleanup {} {
      timer stop leg_timer leg_incoming
      leg tonedetect leg_incoming disable cng
      call close
    }
    proc act_disable_cng {} {
      timer stop leg_timer leg_incoming
      leg tonedetect leg_incoming disable cng
    }
    proc act_voice_proceeding {} {
    global DNIS
      set status [infotag get evt_status]
      if {$status == "ls_000" || $status == "ls_014"} {
        leg tonedetect leg_incoming enable cng
        timer start leg_timer 9 leg_incoming
      } else {
        fsm setstate CLEANUP
        act_cleanup
      }
    }
    proc act_check_fax_or_voice {} {
    global DNIS
      set DNIS [infotag get leg_dnis]
      timer stop leg_timer leg_incoming
      leg tonedetect leg_incoming disable cng
    puts "\n$DNIS\n"
    set Q [lsearch -exact {4165832182 4163066481 4165298887 4169773333 4165343843} $DNIS]
    puts "\n$Q\n"
      if {[lsearch -exact {4165832182 4163066481 4165298887 4169773333 4165343843} $DNIS]>=0} {
        fsm setstate SETUP_FAX_OUTGOING
        act_setup_fax_outgoing
      } else {
        leg proceeding leg_incoming
        leg setup $DNIS callInfo leg_incoming
      }
    }
    set DNIS 0
    set FSM(any_state,ev_leg_timer) "act_disable_cng,same_state"
    set FMS(CALL_INIT,ev_setup_indication) "act_check_fax_or_voice,VOICE_PROCEEDING"
    set FSM(VOICE_PROCEEDING,ev_setup_done) "act_voice_proceeding,CONNECTION_DESTROY"
    set FSM(CONNECTION_DESTROY,ev_tone_detected) "act_connection_destroy,DISCONNECT_LEG_OUTGOING"
    set FSM(DISCONNECT_LEG_OUTGOING,ev_destroy_done) "act_disconnect_leg_outgoing,SWITCH_FAX_OUTGOING"
    set FSM(SWITCH_FAX_OUTGOING,ev_disconnect_done) "act_setup_fax_outgoing,CLEANUP"
    set FSM(SETUP_FAX_OUTGOING,ev_setup_done) "act_setup_fax_outgoing,CLEANUP"
    set FSM(CLEANUP,ev_disconnected) "act_cleanup,same_state"
    fsm define FSM CALL_INIT
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     
    Can someone tell me obviously dumb mistake I'm making?  I'm pulling my hair out.
     
     
     

    Subject: RE: call getting kicked out to upstream peer on cannection destroy
    Replied by: Yawming Chen on 01-02-2010 11:25:30 PM
    What deb did you turn on ? Did you turn on "deb voip app scr" ? Trying to see you debug puts output but did see any.
     

    Subject: RE: call getting kicked out to upstream peer on cannection destroy
    Replied by: Yawming Chen on 01-02-2010 11:33:34 PM
    Ok I saw you are application fax_detect in your log
     
    and I saw you configured
    application
     service fax_offramp flash:app_faxmail_offramp.2.0.1.1.tcl
     !
     service fax_onramp flash:app_faxmail_onramp.2.0.1.3.tcl
     !
     service fax_detect flash:bf_fax_detect_rjq013.tcl
     
    in other thread you provided.
     
    If that is your config, I don't see you apply "fax_detect" in dialpeer

    Subject: RE: call getting kicked out to upstream peer on cannection destroy
    Replied by: Dan Armstrong on 02-02-2010 03:11:43 PM
    It's not in the dial-peer because as soon as I put it in, absolutely no inbound calls work, and the TCL doesn't even enter the INIT proc.  There's something wrong with the state machine, but I figure out what's wrong.
     
    Also, what's deb voup?  do you mean voip?  I don't understand what the voup is.

    Subject: RE: call getting kicked out to upstream peer on cannection destroy
    Replied by: Yawming Chen on 02-02-2010 03:36:06 PM
    Thanks for correcting,it's a typo. Should be voip.

    Subject: RE: call getting kicked out to upstream peer on cannection destroy
    Replied by: Dan Armstrong on 03-02-2010 06:09:57 PM
    To follow up:  I now have a ticket open through TAC because I am stumped.  I reverted to an earlier state machine, so I at least got back to a TCL scritp that would run, though it still will not either handoff appl fax_on_vfc_onramp_app, or use a defined dial-peer, but at least it runs.  I have no idea what was wrong with the last version of my state machine, but I don't have time to investigate.

    The debs I run are:

    debug voip application tcl
    debug voip application state
    debug voip application script

    and the script currently looks like this:

    proc act_connection_destroy {} {
      timer stop leg_timer leg_incoming
      leg tonedetect leg_incoming disable cng
      connection destroy leg_incoming
    puts "\nConnection Destroyed!!!\n"
    }
    proc act_disconnect_outbound_leg {} {
      leg disconnect leg_outgoing 16
    }
    proc act_fax_setup {} {
      global DNIS
      global dialpeerHandle
      global dialPeer

    #  set matchedPeer [object get dial-peer dialpeerHandle ]
    #  puts "\n$matchedPeer\n"
    #  set args "au-ctrl=0, acc-ctrl=0, au-method=0, accounting-list=fax, au-status=1, account=$DNIS"
    #  set callInfo(alertTime) -1
    #  set callInfo(fax) true
    #  set callInfo(accountNum) 0
    #  set callInfo(argstring) $args
    #  leg setup leg_outgoing callInfo -d dialpeerHandle$dialPeer
    #  leg setup leg_outgoing callInfo -d matchedPeer

      handoff appl leg_incoming fax_on_vfc_onramp_app -s "au-ctrl=0, acc-ctrl=0, au-method=0, accounting-list=fax, au-status=1, account=$DNIS, mailtoAddress=mailto:\$d\$@inbound.efax.beanfield.com"

    }
    proc act_cleanup {} {
      timer stop leg_timer leg_incoming
      leg tonedetect leg_incoming disable cng
      call close
    }
    proc act_nop {} {
      timer stop leg_timer leg_incoming
      leg tonedetect leg_incoming disable cng
    }
    proc act_voice {} {
      set status [infotag get evt_status]
      if {$status =="ls_000"} {
        leg tonedetect leg_incoming enable cng
        timer start leg_timer 9 leg_incoming
      } else { call close }
    }
    proc act_setup_voice {} {
      global DNIS
      set DNIS [infotag get leg_dnis]
      timer stop leg_timer leg_incoming
      leg tonedetect leg_incoming disable cng
      puts "\n$DNIS\n"
      set Q [lsearch -exact {4165832182 4163066481 4165298887 4169773333 4165343843} $DNIS]
      puts "\n$Q\n"
      if {[lsearch -exact {4165832182 4163066481 4165298887 4169773333 4165343843} $DNIS]>=0} {
        fsm setstate FAX_SETUP
        act_fax_setup
      } else {
        leg proceeding leg_incoming
        leg setup $DNIS callInfo leg_incoming
      }
    }
    set DNIS 0
    set dialpeerHandle 0
    set dialPeer 2
    set FSM(CALL_INIT,ev_setup_indication) "act_setup_voice,VOICE_MODE"
    set FSM(VOICE_MODE,ev_setup_done) "act_voice,DISCONNECT_OUTBOUND_LEG"
    set FSM(VOICE_MODE,ev_setup_done) "act_voice,DESTROY_CONNECTION"
    set FSM(DESTROY_CONNECTION,ev_tone_detected) "act_destroy_connection,DISCONNECT_OUTBOUND_LEG"
    set FSM(DISCONNECT_OUTBOUND_LEG,ev_destroy_done) "act_disconnect_outbound_leg,FAX_SETUP"
    set FSM(DESTROY_CONNECTION,ev_tone_detected) "act_destroy_connection,DISCONNECT_OUTBOUND_LEG"
    set FSM(FAX_SETUP,ev_disconnect_done) "act_fax_setup,FAX_MODE"
    set FSM(FAX_MODE,ev_setup_done) "act_nop,same_state"
    set FSM(any_state,ev_disconnected) "act_cleanup,same_state"
    set FSM(any_state,ev_leg_timer) "act_nop,same_state"
    fsm define FSM CALL_INIT

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    If yuo look in act_fax_setup, you can see where I'm struggling with two different approaches, neither of which are working.


    Thanks for all your help BTW :^)

    Subject: RE: call getting kicked out to upstream peer on cannection destroy
    Replied by: Yawming Chen on 03-02-2010 07:41:15 PM
    Looks like you are trying to do t.37 onramp, there are sample on ramp script you can download, have you tried this route ?
    http://www.cisco.com/cgi-bin/tablebuild.pl/tclware