connection create failure

Version 1
    This document was generated from CDN thread

    Created by: Chad Stachowicz on 04-06-2010 02:54:40 AM
    All...
     
     
    basically what I am trying to do is have 2 calls come into a TCL script within 5 minutes, and connect wth each other...
     
    I am however getting this error...
     
    Jun  4 02:52:07.163 UTC: //1077//TCL :/tcl_PutsObjCmd: ******* CVP_OBCALLREQ: Got Call1 with legid 1085
    Jun  4 02:52:10.279 UTC: //1077//TCL :/tcl_PutsObjCmd: ******* CVP_OBCALLREQ: Got Call2 with legid 1086
    Jun  4 02:52:10.279 UTC: //1077//AFW_:/AFW_FSM_Drive: Tcl_Eval to drive FSM insi    de Tcl modulespace. code=1 code=ERROR
    Jun  4 02:52:10.279 UTC: TCL script failure
            Result:
                             Event ev_create_donedoes not have Leg Information
    Jun  4 02:52:10.279 UTC:        TCL script failure errorInfo:
                            Event ev_create_donedoes not have Leg Information
        while executing
    "infotag get evt_legs"
        (procedure "log_event" line 3)
        invoked from within
    "log_event"
     
     
    Below is the code...
     
    #-----------------------------------------------------------------------------
    # BRIDGE CALLS
    #-----------------------------------------------------------------------------
    proc bridge_call_incoming { } {
     global incomingcallstotal
     global call1
     global call2
     incr incomingcallstotal
     
     if {$incomingcallstotal == 1} {
      leg setupack leg_incoming
     
      leg proceeding leg_incoming
      leg connect leg_incoming
      timer start named_timer 300 bridge_resp_timeout
      set call1 [infotag get evt_legs]
      puts -nonewline "******* CVP_OBCALLREQ: Got Call1 with legid $call1"
     }
     if {$incomingcallstotal == 2} {
      set call2 [infotag get evt_legs]
      connection create $call1 $call2
      puts -nonewline "******* CVP_OBCALLREQ: Got Call2 with legid $call2"
     }
    }
     
    I am writing an advancement for CVP, and will be sharing all code with the community when I am done, so the help is madly appreciated.  This is the last step!!
     
    Cheers,
     
    Chad

    Subject: RE: connection create failure
    Replied by: Yawming Chen on 04-06-2010 03:02:59 AM
    error is in procedure log_event.
     
    Can you please show that procedure ?
     
    Thanks,
     
    Yawming

    Subject: RE: connection create failure
    Replied by: Yawming Chen on 04-06-2010 03:08:01 AM
    Please take the look the scope for evt_legs looks like we won't be able to get evt_legs when getting ev_create_done event.

     
    evt_legs
    Description Returns a list of leg IDs associated with the event received. For information about
    which legs the evt_legs info-tag returns for a specific event, see Chapter 5,
    ¿Events.¿
    Syntax infotag get evt_legs
    Mode Read
    Scope:
    ev_authorize_done
    ev_leg_timer
    ev_digit_end
    ev_hookflash
    ev_disconnected
    ev_disconnect_done
    ev_grab
    ev_setup_indication
    ev_media_done
    ev_handoff
    ev_returned
    ev_setup_done
    ev_collectdigits_done
    ev_vxml_dialog_done
    ev_vxmldialog_event

    Subject: RE: connection create failure
    Replied by: Chad Stachowicz on 04-06-2010 03:35:21 AM
    AMAZING!!! It is ALMOST complete!!! your awesome.... it now lets me talk over the connection for about 5-10 secs before it disconnects, I assume there is something that I must do now, to tell it to stay open and let me go on with my business?  any info is appreciated and once agan, your awesome!!

    Subject: RE: connection create failure
    Replied by: Yawming Chen on 04-06-2010 03:48:41 AM
    Without lookingthe script it's hard to tell what's going on.
     
    If you don't like to post your script here you can send it to
     
    developer-support@cisco.com
     
    and note it for Yawming to pick up.
     
    Also need to turn on "deb voip app tcl" and collect oputput to analyze.
     
    Thanks,
     
    Yawming
     

    Subject: RE: connection create failure
    Replied by: Chad Stachowicz on 04-06-2010 04:38:37 AM
    I will post it!  I told everyone its to share, its a hack mess right now....
     
    If your wondering what it is for, in the end its for an advanced mobile agent feature for CVP, but it can also be used to control outbound dialing when im finished from CVP, a long wanted feature!  Much of this is based on the outbound dialer for CVP on the cisco.com site...
     
     
    In my example it gets to BRIDGING CONNECTION DONE  function and after 10 seconds of hearing audio, it disconnects the call.....  I originally had it without the cleanup function and it did the same thing...
     
    Thank you so much, you rock!!
     
    #-----------------------------------------------------------------------------
    proc handoff_event { } {
     global vxml_leg
     global ob_dest
     global ob_rna
     global ob_cli
     global ob_uui
     global ob_id
     global matchParam
     global incomingcallstotal

     set vxml_leg [infotag get evt_legs]
     set arglst [infotag get evt_handoff argstring]
     set incomingcallstotal 0
     puts -nonewline "******* CVP_OBCALLREQ: assumed control of call with argument: <$arglst>"
     set matchParam(calledNum) 7788111
     if {[call lookup matchParam] == ""} {
      set registerres [call register matchParam]
     }
     regexp {rna=([0-9]*)} $arglst match ob_rna
     regexp {dnis=([0-9]*)} $arglst match ob_dest
     regexp {cli=([0-9]*)} $arglst match ob_cli
     regexp {id=(\S*)} $arglst match ob_id
     regexp {uui="([^"]*)"} $arglst match ob_uui
     if {$ob_rna == "" || $ob_rna == 0} {
      set ob_rna 30
     }
     set callinfo(notifyEvents) "ev_alert ev_progress ev_proceeding ev_connected"
     set callinfo(originationNum) $ob_cli
     set callinfo(alertTime) $ob_rna
     leg setup $ob_dest callinfo
    }   
    #--------------------------------------------------------------------------
    # OUTBOUND CALL SETUP COMPLETED
    #--------------------------------------------------------------------------
    proc outbound_setup_done { } {
     global ob_dest
     global ob_cli
     global vxml_leg
     global ob_id
     global ob_rna
     global legid
     
     
     set callinfo(notifyEvents) "ev_alert ev_progress ev_proceeding ev_connected"
     set callinfo(originationNum) $ob_cli
     set callinfo(alertTime) $ob_rna
     set status [infotag get evt_status]
     set legid [infotag get evt_legs]
     switch $status {
      "ls_000" {
       set status_str "connected"
      }
      "ls_002" {
       set status_str "noanswer"
      }
      "ls_004" {
       set status_str "invalid_number"
      }
      "ls_007" {
       set status_str "busy"
      }
      default {
       set status_str $status
      }
     }
     if {$status == "ls_000"} {
      
      puts -nonewline "******* CVP_DIALER: ID = $ob_id: call to $ob_dest established"
     } else {
      puts -nonewline "******* CVP_DIALER: ID = $ob_id: call to $ob_dest failed, status $status ($status_str)"
     }

     leg setup 7788000 callinfo $legid
    }
    #--------------------------------------------------------------------------
    # OUTBOUND CALL SETUP COMPLETED
    #--------------------------------------------------------------------------
    proc outbound_ivr_done { } {
     global ob_dest
     global ob_cli
     global vxml_leg
     global ob_id
     global ob_rna
     
     
     set status [infotag get evt_status]
     set legid [infotag get evt_legs]
     switch $status {
      "ls_000" {
       set status_str "connected"
      }
      "ls_002" {
       set status_str "noanswer"
      }
      "ls_004" {
       set status_str "invalid_number"
      }
      "ls_007" {
       set status_str "busy"
      }
      default {
       set status_str $status
      }
     }
     if {$status == "ls_000"} {
      
      puts -nonewline "******* CVP_DIALER: ID = $ob_id: call to $ob_dest established"
     } else {
      puts -nonewline "******* CVP_DIALER: ID = $ob_id: call to $ob_dest failed, status $status ($status_str)"
     }
     
     
     handoff return $vxml_leg -s $status_str
      
    }
     
    #-----------------------------------------------------------------------------
    # BRIDGING CONNECTION DONE
    #-----------------------------------------------------------------------------
    proc create_done { } {
     puts -nonewline "******* CVP_OBCALLREQ: we should be connected"
     cleanup
    }

    #-----------------------------------------------------------------------------
    # CLEANUP
    #-----------------------------------------------------------------------------
    proc cleanup { } {
     call close
    }
    #-----------------------------------------------------------------------------
    # BRIDGE CALLS
    #-----------------------------------------------------------------------------
    proc bridge_call_incoming { } {
     global incomingcallstotal
     global call1
     global legid
     global call2
     set connecs [infotag get con_all]
     incr incomingcallstotal
     
     if {$incomingcallstotal == 1} {
      leg setupack leg_incoming
      leg proceeding leg_incoming
      leg connect leg_incoming
      timer start named_timer 300 bridge_resp_timeout
      set call1 [infotag get evt_legs]
      puts -nonewline "******* CVP_OBCALLREQ: Got Call1 with legid $call1"
     }
     if {$incomingcallstotal == 2} {
      set call2 [infotag get evt_legs]
      connection create $call1 $call2
      puts -nonewline "******* CVP_OBCALLREQ: Got Call2 with legid $call2"
     }
    }
    #-----------------------------------------------------------------------------
    # LEG DISCONNECTING
    #-----------------------------------------------------------------------------
    proc disconnect { } {
     set disc_leg [infotag get evt_legs]
     leg disconnect $disc_leg
    }

    requiredversion 2.0

    #-----------------------------------------------------------------------------
    #   State Machine
    #-----------------------------------------------------------------------------
    set FSM(CALL_INIT,ev_handoff)   "handoff_event,DIALING"
    set FSM(DIALING,ev_setup_done)   "outbound_setup_done,SETUP_DONE"
    set FSM(any_state,ev_create_done)  "create_done,same_state"
    set FSM(any_state,ev_disconnect_done)  "cleanup,same_state"
    set FSM(any_state,ev_disconnected)  "disconnect,same_state"
    set FSM(SETUP_DONE,ev_setup_done)  "outbound_ivr_done,same_state"
    set FSM(any_state,ev_setup_indication)  "bridge_call_incoming,same_state"
     
    fsm define FSM CALL_INIT
     
     
     

    Subject: RE: connection create failure
    Replied by: Yawming Chen on 04-06-2010 04:51:10 AM
    You close the call after you creating the connection.
     
     
    set FSM(any_state,ev_create_done)  "create_done,same_state"
     
    proc create_done { } {

     puts -nonewline "******* CVP_OBCALLREQ: we should be connected"

     cleanup

    }



    #-----------------------------------------------------------------------------

    # CLEANUP

    #-----------------------------------------------------------------------------

    proc cleanup { } {

     call close

    }

    Subject: RE: connection create failure
    Replied by: Chad Stachowicz on 04-06-2010 05:07:34 AM
    Hello,
     
     
       I tried to explain above I had just added this to try as a last resort... I just tried it without it and the same results...
     
     
    It appears its actually dropping after 17 seconds total time connected everytime.  I have redone the functions below and tested to be sure...
     

    #-----------------------------------------------------------------------------
    # BRIDGING CONNECTION DONE
    #-----------------------------------------------------------------------------
    proc create_done { } {
     puts -nonewline "******* CVP_OBCALLREQ: we should be connected"
     
    }

    #-----------------------------------------------------------------------------
    # CLEANUP
    #-----------------------------------------------------------------------------
    proc cleanup { } {
     call close
    }

    Subject: RE: connection create failure
    Replied by: Chad Stachowicz on 04-06-2010 05:10:54 AM
    here is the debug...  the last couple times you can see I hit enter is while I was talking between the connections then it randomely disconnects
     
     
    Jun  4 05:09:18.097 UTC: //1221//TCL :/tcl_CallObjCmd:  call close
    Jun  4 05:09:18.097 UTC: //1221//TCL :/tcl_CallCloseObjCmd:  close
    Jun  4 05:09:19.177 UTC: //-1//AFW_:EE47DE035C000:/Tcl_Link: Linking script cvp_obcallreq
    Jun  4 05:09:19.181 UTC: //-1//TCL :EE47DE035C000:/tcl_RequiredVersionObjCmd: Script requires version 2.0. So 2.1 is OK
    Jun  4 05:09:19.181 UTC: //-1//TCL :EE47DE035C000:/tcl_FSMObjCmd:  fsm define FSM CALL_INIT
    Jun  4 05:09:19.181 UTC: //-1//TCL :EE47DE035C000:/tcl_FSMDefineObjCmd: State Machine: Array FSM: Start State: CALL_INIT
    Jun  4 05:09:19.181 UTC: //-1//TCL :EE47DE035C000:/tcl_FSMDefineObjCmd: FSM Data structure
    Jun  4 05:09:19.181 UTC: (any_state(0), ev_setup_indication(30)--(bridge_call_incoming)-->(any_state(0))
    Jun  4 05:09:19.181 UTC: (DIALING(2), ev_setup_done(187)--(outbound_setup_done)-->(SETUP_DONE(3))
    Jun  4 05:09:19.181 UTC: (any_state(0), ev_disconnected(17)--(disconnect)-->(any_state(0))
    Jun  4 05:09:19.181 UTC: (any_state(0), ev_disconnect_done(18)--(cleanup)-->(any_state(0))
    Jun  4 05:09:19.181 UTC: (SETUP_DONE(3), ev_setup_done(187)--(outbound_ivr_done)-->(any_state(0))
    Jun  4 05:09:19.181 UTC: (any_state(0), ev_create_done(35)--(create_done)-->(any_state(0))
    Jun  4 05:09:19.181 UTC: (CALL_INIT(1), ev_handoff(21)--(handoff_event)-->(DIALING(2))
    Jun  4 05:09:19.181 UTC: FSM start state CALL_INIT(1)
    Jun  4 05:09:19.181 UTC: //-1//AFW_:EE47DE035C000:/Tcl_Link: Script cvp_obcallreq succesfully linked.
    Jun  4 05:09:19.185 UTC: //1221//TCL :/tcl_InfotagObjCmd:  infotag get evt_legs
    Jun  4 05:09:19.185 UTC: //1221//TCL :/tcl_InfotagGetObjCmd: infotag get evt_legs
    Jun  4 05:09:19.185 UTC: //1221//AFW_:/vtr_ev_legs: argc 2
    Jun  4 05:09:19.185 UTC: //1221//AFW_:/vtr_ev_legs: EV_LEGS []
    Jun  4 05:09:19.185 UTC: //1221//TCL :/tcl_InfotagObjCmd:  infotag get evt_handoff argstring
    Jun  4 05:09:19.185 UTC: //1221//TCL :/tcl_InfotagGetObjCmd: infotag get evt_handoff argstring
    Jun  4 05:09:19.185 UTC: //1221//AFW_:/vtr_ev_handoff: argc 3 argindex 2
    Jun  4 05:09:19.185 UTC: //1221//AFW_:/vtr_ev_handoff: event=CC_EV_CALL_HANDOFF, string=dnis=4268 cli=4153586000 rna=null id=null uui="null"
    Jun  4 05:09:19.185 UTC: //1221//TCL :/tcl_CallObjCmd:  call lookup matchParam
    Jun  4 05:09:19.185 UTC: //1221//TCL :/tcl_callLookupObjCmd: lookup matchParam
    Jun  4 05:09:19.185 UTC: //1221//TCL :/tcl_CallObjCmd:  call register matchParam
    Jun  4 05:09:19.185 UTC: //1221//TCL :/tcl_callRegisterObjCmd: register matchParam
    Jun  4 05:09:19.189 UTC: //1221//TCL :/tcl_LegObjCmd:  leg setup 4268 callinfo
    Jun  4 05:09:19.189 UTC: //-1//CSPK:/tclSetCallInfoParams: originationNum=4153586000
    Jun  4 05:09:19.189 UTC: //-1//CSPK:/tclSetControlParams: alertTime(30) = 30
    Jun  4 05:09:19.189 UTC: //-1//CSPK:/tclSetControlParams: Notify Signaling Mask=30
    Jun  4 05:09:21.557 UTC: //1221//TCL :/tcl_InfotagObjCmd:  infotag get evt_status
    Jun  4 05:09:21.557 UTC: //1221//TCL :/tcl_InfotagGetObjCmd: infotag get evt_status
    Jun  4 05:09:21.557 UTC: //1221//AFW_:/vtr_ev_status: argc 2 argindex 2
    Jun  4 05:09:21.557 UTC: //1221//TCL :/tcl_InfotagObjCmd:  infotag get evt_legs
    Jun  4 05:09:21.557 UTC: //1221//TCL :/tcl_InfotagGetObjCmd: infotag get evt_legs
    Jun  4 05:09:21.557 UTC: //1221//AFW_:/vtr_ev_legs: argc 2
    Jun  4 05:09:21.557 UTC: //1221//AFW_:/vtr_ev_legs: EVCALLID [1222]
    Jun  4 05:09:21.557 UTC: //1221//TCL :/tcl_LegObjCmd:  leg setup 7788000 callinfo 1222
    Jun  4 05:09:21.557 UTC: //1221//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    Jun  4 05:09:21.557 UTC: //-1//CSPK:/tclSetCallInfoParams: originationNum=4153586000
    Jun  4 05:09:21.557 UTC: //-1//CSPK:/tclSetControlParams: alertTime(60) = 60
    Jun  4 05:09:21.557 UTC: //-1//CSPK:/tclSetControlParams: Notify Signaling Mask=30
    Jun  4 05:09:21.717 UTC: //1224//TCL :/tcl_InfotagObjCmd:  infotag get leg_guid
    Jun  4 05:09:21.717 UTC: //1224//TCL :/tcl_InfotagGetObjCmd: infotag get leg_guid
    Jun  4 05:09:21.717 UTC: //1224//AFW_:/vtr_lg_guid: argc 2 argindex 2
    Jun  4 05:09:21.717 UTC: //1224//TCL :/tcl_InfotagObjCmd:  infotag get leg_proto_headers Cisco-Gucid
    Jun  4 05:09:21.717 UTC: //1224//TCL :/tcl_InfotagGetObjCmd: infotag get leg_proto_headers Cisco-Gucid
    Jun  4 05:09:21.717 UTC: //1224//AFW_:/vtr_lg_proto_headers: argc 3 argindex 2
    Jun  4 05:09:21.717 UTC: //1224//TCL :/tcl_InfotagObjCmd:  infotag get leg_proto_headers App-Info
    Jun  4 05:09:21.717 UTC: //1224//TCL :/tcl_InfotagGetObjCmd: infotag get leg_proto_headers App-Info
    Jun  4 05:09:21.717 UTC: //1224//AFW_:/vtr_lg_proto_headers: argc 3 argindex 2
    Jun  4 05:09:21.717 UTC: //1224//TCL :/tcl_InfotagObjCmd:  infotag get leg_dnis
    Jun  4 05:09:21.717 UTC: //1224//TCL :/tcl_InfotagGetObjCmd: infotag get leg_dnis
    Jun  4 05:09:21.721 UTC: //1224//AFW_:/vtr_lg_dnis: argc 2 argindex 2
    Jun  4 05:09:21.721 UTC: //1224//TCL :/tcl_InfotagObjCmd:  infotag get leg_proto_headers To
    Jun  4 05:09:21.721 UTC: //1224//TCL :/tcl_InfotagGetObjCmd: infotag get leg_proto_headers To
    Jun  4 05:09:21.721 UTC: //1224//AFW_:/vtr_lg_proto_headers: argc 3 argindex 2
    Jun  4 05:09:21.721 UTC: //1224//TCL :/tcl_InfotagObjCmd:  infotag get evt_gtd gtd_inf
    Jun  4 05:09:21.721 UTC: //1224//TCL :/tcl_InfotagGetObjCmd: infotag get evt_gtd gtd_inf
    Jun  4 05:09:21.721 UTC: //1224//AFW_:/vtr_ev_gtd_object: argc 3 argindex 2 get evt_gtd gtd_inf
    Jun  4 05:09:21.721 UTC: //1224//AFW_:/vtr_ev_gtd_object: cc_ev->e.event_id 25
    Jun  4 05:09:21.721 UTC: //1224//AFW_:/vtr_ev_gtd_object: rawmsg not found in event
    Jun  4 05:09:21.721 UTC: //1224//TCL :/tcl_LegObjCmd:  leg proceeding leg_incoming
    Jun  4 05:09:21.721 UTC: //1224//TCL :/tcl_LegProceedObjCmd: proceeding leg_incoming
    Jun  4 05:09:21.721 UTC: //1224//AFW_:/vtd_lg_incoming: argc 2
    Jun  4 05:09:21.721 UTC: //1224//AFW_:/vtd_lg_incoming: Legs [1224 ]
    Jun  4 05:09:21.721 UTC: //1224//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    Jun  4 05:09:21.721 UTC: //1224//TCL :/tcl_LegObjCmd:  leg connect leg_incoming
    Jun  4 05:09:21.721 UTC: //1224//TCL :/tcl_LegConnectObjCmd: connect leg_incoming
    Jun  4 05:09:21.721 UTC: //1224//AFW_:/vtd_lg_incoming: argc 2
    Jun  4 05:09:21.721 UTC: //1224//AFW_:/vtd_lg_incoming: Legs [1224 ]
    Jun  4 05:09:21.721 UTC: //1224//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    Jun  4 05:09:21.721 UTC: //1224//TCL :/tcl_TimerObjCmd:  timer start named_timer 1 handoff_timer
    Jun  4 05:09:21.721 UTC: //1224//TCL :/tcl_TimerStartObjCmd: timer start named_timer 1 handoff_timer
    Jun  4 05:09:21.797 UTC: //1221//TCL :/tcl_InfotagObjCmd:  infotag get evt_status
    Jun  4 05:09:21.797 UTC: //1221//TCL :/tcl_InfotagGetObjCmd: infotag get evt_status
    Jun  4 05:09:21.797 UTC: //1221//AFW_:/vtr_ev_status: argc 2 argindex 2
    Jun  4 05:09:21.797 UTC: //1221//TCL :/tcl_InfotagObjCmd:  infotag get evt_legs
    Jun  4 05:09:21.797 UTC: //1221//TCL :/tcl_InfotagGetObjCmd: infotag get evt_legs
    Jun  4 05:09:21.797 UTC: //1221//AFW_:/vtr_ev_legs: argc 2
    Jun  4 05:09:21.797 UTC: //1221//AFW_:/vtr_ev_legs: EVCALLID [1222 1223]
    Jun  4 05:09:21.797 UTC: //1221//TCL :/tcl_HandoffObjCmd:  handoff return 1221 -s connected
    Jun  4 05:09:21.797 UTC: //1221//TCL :/tcl_HandoffReturnObjCmd: return 1221 -s connected
    Jun  4 05:09:21.797 UTC: //1221//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    Jun  4 05:09:21.797 UTC: //1221//TCL :/tcl_HandoffReturnObjCmd: Returning  Legs [1221 ] with args=connected
    Jun  4 05:09:21.813 UTC: //1221//PACK:/Media_Play_Start:
    Jun  4 05:09:22.721 UTC: //1224//TCL :/tcl_HandoffObjCmd:  handoff appl leg_incoming new-call CALLID=2A0803536ECE11DF8ADACDF0A815FF9A DNIS=222222222211217 PROTOCOL=http PORT=8000 HOST=172.23.249.13 BACKUP=172.23.249.13 VERSION=7.0.2 SEND_ABN_DISC=0 UUI=
    Jun  4 05:09:22.721 UTC: //1224//TCL :/tcl_handoff_common: appl leg_incoming new-call CALLID=2A0803536ECE11DF8ADACDF0A815FF9A DNIS=222222222211217 PROTOCOL=http PORT=8000 HOST=172.23.249.13 BACKUP=172.23.249.13 VERSION=7.0.2 SEND_ABN_DISC=0 UUI=
    Jun  4 05:09:22.721 UTC: //1224//AFW_:/vtd_lg_incoming: argc 4
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    Jun  4 05:09:22.721 UTC: //1224//AFW_:/vtd_lg_incoming: Legs [1224 ]
    Jun  4 05:09:22.721 UTC: //1224//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    Jun  4 05:09:22.721 UTC: //1224//TCL :/tcl_handoff_common: Handing off Legs [1224 ] to new-call with args=CALLID=2A0803536ECE11DF8ADACDF0A815FF9A DNIS=222222222211217 PROTOCOL=http PORT=8000 HOST=172.23.249.13 BACKUP=172.23.249.13 VERSION=7.0.2 SEND_ABN_DISC=0 UUI=
    Jun  4 05:09:22.721 UTC: //1224//TCL :/tcl_CallObjCmd:  call close
    Jun  4 05:09:22.721 UTC: //1224//TCL :/tcl_CallCloseObjCmd:  close
    Jun  4 05:09:22.825 UTC: //1224//PACK:/Media_Play_Start:
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    Jun  4 05:09:34.765 UTC: //1221//PACK:/tclrecord_create_record_token_url:
    Jun  4 05:09:35.537 UTC: //1221//TCL :/tcl_InfotagObjCmd:  infotag get con_all
    Jun  4 05:09:35.537 UTC: //1221//TCL :/tcl_InfotagGetObjCmd: infotag get con_all
    Jun  4 05:09:35.537 UTC: //1221//AFW_:/vtr_co_all: argc 2
    Jun  4 05:09:35.537 UTC: //1221//AFW_:/vtr_co_all: EV_CONNECTIONS [130]
    Jun  4 05:09:35.537 UTC: //1221//TCL :/tcl_LegObjCmd:  leg setupack leg_incoming
    Jun  4 05:09:35.537 UTC: //1221//TCL :/tcl_LegSetupAckObjCmd: setupack leg_incoming
    Jun  4 05:09:35.537 UTC: //1221//AFW_:/vtd_lg_incoming: argc 2
    Jun  4 05:09:35.537 UTC: //1221//AFW_:/vtd_lg_incoming: Legs [1229 ]
    Jun  4 05:09:35.537 UTC: //1221//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    Jun  4 05:09:35.541 UTC: //1221//TCL :/tcl_LegObjCmd:  leg proceeding leg_incoming
    Jun  4 05:09:35.541 UTC: //1221//TCL :/tcl_LegProceedObjCmd: proceeding leg_incoming
    Jun  4 05:09:35.541 UTC: //1221//AFW_:/vtd_lg_incoming: argc 2
    Jun  4 05:09:35.541 UTC: //1221//AFW_:/vtd_lg_incoming: Legs [1229 ]
    Jun  4 05:09:35.541 UTC: //1221//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    Jun  4 05:09:35.541 UTC: //1221//TCL :/tcl_LegObjCmd:  leg connect leg_incoming
    Jun  4 05:09:35.541 UTC: //1221//TCL :/tcl_LegConnectObjCmd: connect leg_incoming
    Jun  4 05:09:35.541 UTC: //1221//AFW_:/vtd_lg_incoming: argc 2
    Jun  4 05:09:35.541 UTC: //1221//AFW_:/vtd_lg_incoming: Legs [1229 ]
    Jun  4 05:09:35.541 UTC: //1221//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    Jun  4 05:09:35.541 UTC: //1221//TCL :/tcl_TimerObjCmd:  timer start named_timer 900 bridge_resp_timeout
    Jun  4 05:09:35.541 UTC: //1221//TCL :/tcl_TimerStartObjCmd: timer start named_timer 900 bridge_resp_timeout
    Jun  4 05:09:35.541 UTC: //1221//TCL :/tcl_InfotagObjCmd:  infotag get evt_legs
    Jun  4 05:09:35.541 UTC: //1221//TCL :/tcl_InfotagGetObjCmd: infotag get evt_legs
    Jun  4 05:09:35.541 UTC: //1221//AFW_:/vtr_ev_legs: argc 2
    Jun  4 05:09:35.541 UTC: //1221//AFW_:/vtr_ev_legs: EVCALLID [1229]
    ISI-RW-DR-VGW01#
    Jun  4 05:09:37.693 UTC: //1224//PACK:/tclrecord_create_record_token_url:
    Jun  4 05:09:38.697 UTC: //1221//TCL :/tcl_InfotagObjCmd:  infotag get con_all
    Jun  4 05:09:38.697 UTC: //1221//TCL :/tcl_InfotagGetObjCmd: infotag get con_all
    Jun  4 05:09:38.697 UTC: //1221//AFW_:/vtr_co_all: argc 2
    Jun  4 05:09:38.697 UTC: //1221//AFW_:/vtr_co_all: EV_CONNECTIONS [130]
    Jun  4 05:09:38.697 UTC: //1221//TCL :/tcl_InfotagObjCmd:  infotag get evt_legs
    Jun  4 05:09:38.697 UTC: //1221//TCL :/tcl_InfotagGetObjCmd: infotag get evt_legs
    Jun  4 05:09:38.697 UTC: //1221//AFW_:/vtr_ev_legs: argc 2
    Jun  4 05:09:38.697 UTC: //1221//AFW_:/vtr_ev_legs: EVCALLID [1230]
    Jun  4 05:09:38.697 UTC: //1221//TCL :/tcl_ConnectionObjCmd:  connection create 1229 1230
    Jun  4 05:09:38.697 UTC: //1221//TCL :/tcl_ConnectionCreateObjCmd: create 1229 1230
    Jun  4 05:09:38.697 UTC: //1221//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    Jun  4 05:09:38.697 UTC: //1221//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    ISI-RW-DR-VGW01#
    Jun  4 05:09:53.689 UTC: //1221//TCL :/tcl_InfotagObjCmd:  infotag get evt_legs
    Jun  4 05:09:53.689 UTC: //1221//TCL :/tcl_InfotagGetObjCmd: infotag get evt_legs
    Jun  4 05:09:53.689 UTC: //1221//AFW_:/vtr_ev_legs: argc 2
    Jun  4 05:09:53.689 UTC: //1221//AFW_:/vtr_ev_legs: EVCALLID [1230]
    Jun  4 05:09:53.689 UTC: //1221//TCL :/tcl_LegObjCmd:  leg disconnect 1230
    Jun  4 05:09:53.689 UTC: //1221//TCL :/tcl_LegDisconnectObjCmd: disconnect 1230
    Jun  4 05:09:53.689 UTC: //1221//Tcl :/tcl_parseCallID_vartagObj: VARTAG Translation Leg Count=1
    Jun  4 05:09:53.697 UTC: //1221//TCL :/tcl_CallObjCmd:  call close
    Jun  4 05:09:53.697 UTC: //1221//TCL :/tcl_CallCloseObjCmd:  close

    Subject: RE: connection create failure
    Replied by: Yawming Chen on 04-06-2010 05:30:06 AM
    I am sorry I still not quite get the call flow you want to implement.
    Can you please detail your call flow so it's easier to look at your script ?
     
    Thanks !

    Subject: RE: connection create failure
    Replied by: Chad Stachowicz on 04-06-2010 02:30:21 PM
    Alright, so I hope your at least familiar a bit with CVP
     
    A typical process would go like this, a normal call comes into ICM / CVP and is getting call treatment, a CVP script is called and in it is a VXML document with a handoff to my TCL application which sits on the VXML gateway names cvp_obcallreq.tcl...  I pass in the CLI / ANI and Destination.
     
    From here a new call is generated with those parameters, on catching the successfull connection outbound, I then create a second call outbound to 7788000 (this is an ICM / CVP IVR Script) and it connects it to the first call I created.  At this point I have a new outbound call that i created connected to ICM / CVP getting treatment, and my first call that was handed off to the TCL to start all of this.
     
    What I did first (this is there for trial) is do a call register 7788111.  The reason for this, is now that I have two calls, the first one is handed back off in the handoff return to CVP, to finish its business which will eventually be transfered to 7788111.  Also the new outbound call I created will be transfered to 7788111... these are the 2 calls thats I want to bridge together.  Essentially its a way to add outbound calling functionality with IVR treatment from ICM / CVP as normal, to CVP comprehensive flow with ICM. 
     
    The problem now is when I create the connection they appears to only stay connected with audio for around 14-17 seconds (my phone always shows its been connected 32 total seconds - this is the outbound call that is produced).
     
     
    This will be my last hurdle, then a whole bunch of refining and touching up, but at least it will prove that my concept works which is the big hope
     
    Cheers,
     
    Chad

    Subject: RE: connection create failure
    Replied by: Yawming Chen on 04-06-2010 08:07:49 PM
    Alright, so I hope your at least familiar a bit with CVP


    A typical process would go like this, a normal call comes into ICM / CVP and is getting call treatment, a CVP script is called and in it is a VXML document with a handoff to my TCL application which sits on the VXML gateway names cvp_obcallreq.tcl...  I pass in the CLI / ANI and Destination.

    Leg1 ----> GW


    From here a new call is generated with those parameters, on catching the successfull connection outbound, I then create a second call outbound to 7788000 (this is an ICM / CVP IVR Script) and it connects it to the first call I created.  At this point I have a new outbound call that i created connected to ICM / CVP getting treatment, and my first call that was handed off to the TCL to start all of this.

    Leg1 -----> GW ----leg2----->

    This is not clear to me ¿connects it to the first call I created¿ if there is a connected call how can you connect it to another call ?

               ????--->   GW ---leg3---> 7788000

    For example:

    ---leg1--->GW ---leg2--->

    If need to connect to either of this call leg

    Do "connection destroy" then  when getting ev_destroy_done then do "create connection" of whatever you like.
     
    Also for some resaon you reveiced disconnect event

     
    Jun  4 05:09:53.689 UTC: //1221//TCL :/tcl_LegObjCmd:  leg disconnect 1230
     
    you can add the logic when catching the disconnect event put out the disconnect cause, di_xxx and reslated leg information.

    Subject: RE: connection create failure
    Replied by: Yawming Chen on 04-06-2010 09:07:24 PM
    You wait for 2nd call comes in then bridge them ? Did you do "leg setupack" to 2nd call ?
     
    proc bridge_call_incoming { } {
     global incomingcallstotal
     global call1
     global legid
     global call2
     set connecs [infotag get con_all]
     incr incomingcallstotal
     
     if {$incomingcallstotal == 1} {
      leg setupack leg_incoming
      leg proceeding leg_incoming
      leg connect leg_incoming
      timer start named_timer 300 bridge_resp_timeout
      set call1 [infotag get evt_legs]
      puts -nonewline "******* CVP_OBCALLREQ: Got Call1 with legid $call1"
     }
     if {$incomingcallstotal == 2} {
      set call2 [infotag get evt_legs]
      connection create $call1 $call2
      puts -nonewline "******* CVP_OBCALLREQ: Got Call2 with legid $call2"
     }
    }

    Subject: RE: connection create failure
    Replied by: Chad Stachowicz on 04-06-2010 08:52:13 PM
     
     
     
    You are pretty close..
     
    Leg 1--> GW   Here it 'forks' and create another new leg1 and connects it to 778000   the original leg 1 is just handed back to CVP then, nothing is ever connected to it.
     
    The first leg is only used to trigger the new phone call and the connection to 7788000.... then what happens is both applicstions transfer to 7788111 and the hope ist hey bridge
     
    I believe it may have something with the SIP Proxy or something int eh SIP Chain not getting an Ack, and eventually it disconnects the call.
     
    I am going to do some more research, but I think this is why its getting disconnected.
     

    Subject: RE: connection create failure
    Replied by: Chad Stachowicz on 07-06-2010 01:18:18 PM
    it needed a leg setupack and a leg connect... it works like a champion now ;)  I have attached to PoC script below... please note I will release an entire usage package in a week or 2...
     
    Thanks again!
     
    Chad
     
     
    #-----------------------------------------------------------------------------
    proc handoff_event { } {
     global vxml_leg
     global ob_dest
     global ob_rna
     global ob_cli
     global ob_uui
     global ob_id
     global matchParam
     global incomingcallstotal

     set vxml_leg [infotag get evt_legs]
     set arglst [infotag get evt_handoff argstring]
     set incomingcallstotal 0
     puts -nonewline "******* CVP_OBCALLREQ: assumed control of call with argument: <$arglst>"
     set matchParam(calledNum) 7788111
     if {[call lookup matchParam] == ""} {
      set registerres [call register matchParam]
     }
     regexp {rna=([0-9]*)} $arglst match ob_rna
     regexp {dnis=([0-9]*)} $arglst match ob_dest
     regexp {cli=([0-9]*)} $arglst match ob_cli
     regexp {id=(\S*)} $arglst match ob_id
     regexp {uui="([^"]*)"} $arglst match ob_uui
     if {$ob_rna == "" || $ob_rna == 0} {
      set ob_rna 30
     }
     set callinfo(notifyEvents) "ev_alert ev_progress ev_proceeding ev_connected"
     set callinfo(originationNum) $ob_cli
     set callinfo(alertTime) $ob_rna
     leg setup $ob_dest callinfo
    }   
    #--------------------------------------------------------------------------
    # OUTBOUND CALL SETUP COMPLETED
    #--------------------------------------------------------------------------
    proc outbound_setup_done { } {
     global ob_dest
     global ob_cli
     global vxml_leg
     global ob_id
     global ob_rna
     global legid
     
     
     set callinfo(notifyEvents) "ev_alert ev_progress ev_proceeding ev_connected"
     set callinfo(originationNum) $ob_cli
     set callinfo(alertTime) 60
     set status [infotag get evt_status]
     set legid [infotag get evt_legs]
     switch $status {
      "ls_000" {
       set status_str "connected"
      }
      "ls_002" {
       set status_str "noanswer"
      }
      "ls_004" {
       set status_str "invalid_number"
      }
      "ls_007" {
       set status_str "busy"
      }
      default {
       set status_str $status
      }
     }
     if {$status == "ls_000"} {
      
      puts -nonewline "******* CVP_DIALER: ID = $ob_id: call to $ob_dest established"
     } else {
      puts -nonewline "******* CVP_DIALER: ID = $ob_id: call to $ob_dest failed, status $status ($status_str)"
     }

     leg setup 7788000 callinfo $legid
    }
    #--------------------------------------------------------------------------
    # OUTBOUND CALL SETUP COMPLETED
    #--------------------------------------------------------------------------
    proc outbound_ivr_done { } {
     global ob_dest
     global ob_cli
     global vxml_leg
     global ob_id
     global ob_rna
     
     
     set status [infotag get evt_status]
     set legid [infotag get evt_legs]
     switch $status {
      "ls_000" {
       set status_str "connected"
      }
      "ls_002" {
       set status_str "noanswer"
      }
      "ls_004" {
       set status_str "invalid_number"
      }
      "ls_007" {
       set status_str "busy"
      }
      default {
       set status_str $status
      }
     }
     if {$status == "ls_000"} {
      
      puts -nonewline "******* CVP_DIALER: ID = $ob_id: call to $ob_dest established"
     } else {
      puts -nonewline "******* CVP_DIALER: ID = $ob_id: call to $ob_dest failed, status $status ($status_str)"
     }
     
     
     handoff return $vxml_leg -s $status_str
      
    }
     
    #-----------------------------------------------------------------------------
    # BRIDGING CONNECTION DONE
    #-----------------------------------------------------------------------------
    proc create_done { } {
     puts -nonewline "******* CVP_OBCALLREQ: we should be connected"
     
    }

    #-----------------------------------------------------------------------------
    # CLEANUP
    #-----------------------------------------------------------------------------
    proc cleanup { } {
     call close
    }
    #-----------------------------------------------------------------------------
    # BRIDGE CALLS
    #-----------------------------------------------------------------------------
    proc bridge_call_incoming { } {
     global incomingcallstotal
     global call1
     global legid
     global call2
     set connecs [infotag get con_all]
     incr incomingcallstotal
     
     if {$incomingcallstotal == 1} {
      leg setupack leg_incoming
      leg proceeding leg_incoming
      leg connect leg_incoming
      timer start named_timer 900 bridge_resp_timeout
      set call1 [infotag get evt_legs]
      puts -nonewline "******* CVP_OBCALLREQ: Got Call1 with legid $call1"
     }
     if {$incomingcallstotal == 2} {
      set call2 [infotag get evt_legs]
      leg setupack $call2
      leg proceeding $call2
      leg connect $call2
      connection create $call1 $call2
      puts -nonewline "******* CVP_OBCALLREQ: Got Call2 with legid $call2"
     }
    }
    #-----------------------------------------------------------------------------
    # LEG DISCONNECTING
    #-----------------------------------------------------------------------------
    proc disconnect { } {
     set disc_leg [infotag get evt_legs]
     leg disconnect $disc_leg
    }

    requiredversion 2.0

    #-----------------------------------------------------------------------------
    #   State Machine
    #-----------------------------------------------------------------------------
    set FSM(CALL_INIT,ev_handoff)   "handoff_event,DIALING"
    set FSM(DIALING,ev_setup_done)   "outbound_setup_done,SETUP_DONE"
    set FSM(any_state,ev_create_done)  "create_done,same_state"
    set FSM(any_state,ev_disconnect_done)  "cleanup,same_state"
    set FSM(any_state,ev_disconnected)  "disconnect,same_state"
    set FSM(SETUP_DONE,ev_setup_done)  "outbound_ivr_done,same_state"
    set FSM(any_state,ev_setup_indication)  "bridge_call_incoming,same_state"
     
    fsm define FSM CALL_INIT