How to go on tcl script execution after call close

Version 1
    This document was generated from CDN thread

    Created by: Marat Rabidinov on 26-05-2011 03:54:15 AM
    I need to create a tcl script, which will be initiated by incoming call into Cisco Router. The script must make a multiple calls to many phones and play media files.
    But when initiated call is down, the script is stoped. But I need that the script goes on to make a calls and plays a media files.
    How can I make to not stop execution of tcl script after the initiated call is closed?

    Subject: RE: How to go on tcl script execution after call close
    Replied by: Max Lamovich on 26-05-2011 05:07:16 AM
    Hi Marat!

    You need use session tcl application, You can find about that in "Tcl IVR 2.0 Programming Guide" chapter "Application Instances" (1-38)
    This type of tcl Application running(initiated) without incoming call and in this application You can make external request through http or radius,
    get data from request and start outgoing call.

    I wrote similar application, but without play sound.

    service srvtest flash:service.tcl
      param debug 0
      param cbsrvnum ______NumberforCALL____

      start WatchCall srvtest

    set myname "Deamon"

    proc act_Terminate { } {
        msgSend "act_Terminate"
        msgSend "received a terminate event, closing up."

        call close

    proc act_Session { } {

        msgSend "act_Session"

        set r [service register data_service]

        msgSend "Register of data_service returned $r"


    proc init_data { } {
        global debug
        global cb_srv_num
        set debug [string trim [infotag get cfg_avpair debug]]
        set cb_srv_num [string trim [infotag get cfg_avpair cbsrvnum]]

        msgSend "DEBUG: $debug"
        msgSend "CALLNUM: $cb_srv_num"


    proc get_data { } {
        set time [clock format [clock seconds] -format "%H:%M:%S"]

        msgSend "get_data $time"
        aaa authenticate " CallBack" ""

    proc act_AuthDone { } {
        msgSend "act_AuthDone"
        set auth_st [infotag get evt_status]
        msgSend "status AU: $auth_st"
        if { $auth_st != "au_000"} {
            msgSend "Not authenticate"
        } elseif { $auth_st == "au_000" } {
            msgSend "authenticate"
            timer stop call_timer0
            fsm setstate CALL
        } else {
            msgSend "Not authenticate end"

    proc act_Timer { } {
        msgSend "act_Timer"

        timer start call_timer0 10

    proc act_CallSetupDone { } {
        msgSend "act_CallSetupDone"

        set inf_leg [infotag get evt_legs]
        msgSend "ID_LEG:$inf_leg"
        leg disconnect $inf_leg
        set leg_st [infotag get evt_status]
        msgSend "Status:$leg_st"   

    proc act_CallDone { } {
        msgSend "act_CallDone"

        #set ev [infotag get evt_event]
        #msgSend "Event $ev"
        #set ev [infotag get evt_status]
        #msgSend "Status event $ev"


    proc act_CallSetup { } {
        msgSend "act_CallSetup"

        global cb_srv_num
        set destination $cb_srv_num
        set callInfo(accountNum) ____Account____
        set callInfo(originationNum) 1212121212
        set callInfo(redirectCount) 1
        set callInfo(alertTime) 1
        leg setup $destination callInfo leg_outgoing

    proc act_Ignore { } {
        set ev [infotag get evt_event]
        msgSend "is ignoring event $ev"

    proc msgSend {str} {
        global debug
        global myname
        if {$debug == 1} { puts "$myname $str" }

    #   State Machine
    set fsm(any_state,ev_session_indication) "act_Session           same_state"
    set fsm(any_state,ev_session_terminate)  "act_Terminate         same_state"
    set fsm(any_state,ev_call_timer0)        "act_Timer             same_state"
    set fsm(any_state,ev_authenticate_done)  "act_AuthDone          same_state"

    set fsm(CALL,ev_call_timer0)             "act_Timer             same_state"
    set fsm(CALL,ev_setup_done)              "act_CallSetupDone     same_state"
    set fsm(CALL,ev_disconnect_done)         "act_CallDone         start_state"
    set fsm(CALL,ev_disconnected)            "act_CallDone         start_state"

    set fsm(any_state,ev_disconnected)       "act_Timer             same_state"
    set fsm(any_state,ev_any_event)          "act_Ignore            same_state"

    fsm define fsm start_state

    ____Account____ - for radius
    ______NumberforCALL____ - Number for outgoing call

    Subject: RE: How to go on tcl script execution after call close
    Replied by: Raghavendra Gutty Veeranagappa on 26-05-2011 05:34:00 AM
    Hi Marat,

    please raise developer support case using below link we will help you to create tcl script for your requirements, since forum is to discuss only simple queries.