TCL SCRIPT FOR VOICE GATEWAY

Version 1
    This document was generated from CDN thread

    Created by: Chrysostomos Christofi on 10-02-2011 09:51:36 AM
    Hi to all
     
    I am new with this and i need your help
     
    I have CUCM 7.1.5 connected Voice Gateway via H323
    I want to add some .tcl scripts on Voice Gateway
    Could you pls give me some instructions for how to do it
     
    Thankikg you in advance
     

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Yaw-Ming Chen on 10-02-2011 10:26:19 AM
    The information you need is in this tech center where you posted this question.

    http://developer.cisco.com/web/vgapi/resources

    Also you can consider CDN support services.

    http://developer.cisco.com/web/devservices

    Thanks !

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Chrysostomos Christofi on 11-02-2011 09:55:43 AM
    Dear Yaw-Ming Chen

    Thank you for your reply

    But a specific info it would be appreciated much more

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Yaw-Ming Chen on 11-02-2011 10:15:15 AM
    From the following link you can start with programming guide while reading programming guide you can refer to sample Tcl script in the same link.

    http://developer.cisco.com/web/vgapi/resources

    Thanks !

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Anusha Kannappan on 15-02-2011 06:43:53 AM
    Hi Chrysostomos,

    Assuming your phone have been registered to the CUCM and they are in working condition, please use the following steps on the voice gateway to load the script and mapping them to the dial-peer.

    Loading the script:
    =============
    R1#conf t
    R1(config)#application
    R1(config-app)#service application_name script_url

    for example:
    -----------------
    R1(config)#application
    R1(config-app)#service newapp tftp://x.x.x.x/voip/test/xyz.tcl

    Once the configs are done you can issue the following command to check whether the script has been loaded properly or not.The status should be in the registered state.

    R1#sh call app voice newapp

    Mapping to the dial-peer:
    ==================
    To invoke your Tcl IVR script to handle a call, you must associate the application configured with an inbound dial peer. To associate your script with an inbound dial peer, enter the following commands in configuration mode:

    R1(config)# dial-peer voice number voip
    R1(conf-dial-peer)# incoming called-number destination_number
    R1(conf-dial-peer)# service application_name

    In these commands:
    ¿number uniquely identifies the dial peer. (This number has local significance only.)
    ¿destination_number specifies the destination telephone number. Valid entries are any series of digits that specify the E.164 telephone number.
    ¿application_name is the abbreviated name that you assigned when you loaded the application


    for example:
    ------------------
    R1(config)# dial-peer voice 3 voip
    R1(conf-dial-peer)# incoming called-number 125
    R1(conf-dial-peer)# service newapp

    Hope this helps you !

    Thanks,
    Anusha

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Anusha Kannappan on 15-02-2011 08:20:38 AM
    Hi Chrysostomos,

    * .tcl script should be loaded on the voice Gateway
    * You can use the following in the script directly
    media play leg_incoming flash:_goodbye.au
            Make sure the audio file which you are trying to play is copied to the flash as it has been mentioned in the script
    * Apart from the registration stuff I don't think there is any other additional steps required on CUCM

    X.X.X.X is the tftp address in the below config. Hope you have the voice gateway connected to the tftp server where your scripts and the audio files may reside.
    R1(config)#application
    R1(config-app)#service newapp tftp://x.x.x.x/voip/test/xyz.tcl

    Thanks,
    Anusha

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Anusha Kannappan on 15-02-2011 09:28:42 AM
    Hi Chrysostomos,

    Yeah the script and the audio prompts can also reside in the flash and from there it could be loaded to the Voice Gateway.

    But anyways the media play command has to be used in the script if you want to play the audio file using the TCL-IVR script. Again the location may varry it could the flash or servers.

    you can use any one of the way to use the audio files to be played

    * service busy-ringback flash:busy-ringback.tcl
      paramspace english location flash:

    and in the script you can use the media play command as follows
    media play leg_incoming <name of the prompt>
                  (or)
    * can be used in the script directly
      media play leg_incoming flash:_goodbye.au
                 (or)
    * service busy-ringback flash:busy-ringback.tcl
      param welcome-prompt <name of the prompt>

    and in the script
    if [infotag get cfg_avpair_exists welcome-prompt] {
                    set welcomePrompt [string trim [infotag get cfg_avpair welcome-prompt]]
            } else {
                    set welcomePrompt "<name of the prompt>"
            }

    Thanks,
    Anusha

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Chrysostomos Christofi on 15-02-2011 05:01:20 AM
    Dear ALL

    What i need is a specific instructions how to make the  tcl script to work

    I have the  tcl script ready for this requirements.(for example number 1010 call 1257 and the 1257 is already on the phone then , i need there the tcl script to be involved and play one announcement that the 1257 is already on the phone)

    What i dont know is the specific procedure that have to be done on Voice Gateway and also to CUCM

    With a general links sorry but you dont help us


    Regards
    chrysostomos

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Chrysostomos Christofi on 15-02-2011 07:41:41 AM
    Dear Anusha

    Its really a wonderful and useful post
    Many Thanks for your help

    3 questions

    1) i have to upload the .tcl script on voice Gateway or ON CUCM via tftp file management on OS administration page?
    2) How i can associate the prompt to play with a Specific tcl script
    3) Except phone registration is any other steps that i have to perform on CUCM?

    R1(config)#application
    R1(config-app)#service newapp tftp://x.x.x.x/voip/test/xyz.tcl

    X.X.X.X Is the IP of CUCM? i have to upload script .tcl and prompt to CUCM and then load them from Voice Gateway


    Thank you again Anusha for the precious help

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Chrysostomos Christofi on 15-02-2011 08:41:55 AM
    Hi

    I think i can use the below commands inside of the above?

    I will call the script and the prompt from Voice G.,  From flash

    service busy-ringback flash:busy-ringback.tcl 
    paramspace english location flash:the name of the prompt

    Are the above correct?

    Thanking you in advance

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Chrysostomos Christofi on 15-02-2011 09:56:55 AM
    Your help is very  precious

    Thank you again for all

    i am very happy to meet person like you

    Have nice day

    I will check and let you to know

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Chrysostomos Christofi on 17-02-2011 11:05:05 AM
    Dear ANUSHA

    I hope that you are ok

    I need your advice again

    PLs check my below config

    Its not working at all
    what is wrong from my config

    On Voice Gateway

    LOGPRIGW# dir
    Directory of flash:/

        1  -rw-    50088592  Sep 30 2009 19:10:50 +03:00  c2800nm-spservicesk9-mz.124-22.T3.bin
        2  -rw-        1823  May 15 2006 16:13:42 +03:00  sdmconfig-2811.cfg
        3  -rw-     4734464  May 15 2006 16:14:10 +03:00  sdm.tar
        4  -rw-      833024  May 15 2006 16:14:26 +03:00  es.tar
        5  -rw-     1052160  May 15 2006 16:14:40 +03:00  common.tar
        6  -rw-        1038  May 15 2006 16:14:54 +03:00  home.shtml
        7  -rw-      102400  May 15 2006 16:15:08 +03:00  home.tar
        8  -rw-      491213  May 15 2006 16:15:24 +03:00  128MB.sdf
        9  -rw-       11189  Oct 17 2010 09:04:02 +03:00  17-10-2010
       11  -rw-        8348  Feb 17 2011 17:53:26 +02:00  busy-ringback.tcl
       10  -rw-       23224  Feb 14 2011 15:11:00 +02:00  en_rec_goodbye.au


    !
    application
    service aa flash:/busy-ringback.tcl
      paramspace english index 1
      paramspace english language en
      param call-retry-timer 15
      param max-time-vm-retry 2
      paramspace english location flash:/
      param max-time-call-retry 600
      param handoff-string aa
    !
    dial-peer voice 3000 voip
    description **Busy-ring**
    service aa
    voice-class codec 2
    voice-class h323 1
    session target ipv4:192.168.1.242
    incoming called-number 1256
    dtmf-relay h245-alphanumeric
    no vad
    !

    BELOW IS THE .TCL SCRIPT
    busy-ringback.tcl


    proc act_Activation { } {

    global alertTime
    global prefix
    global max_timer
    global rdn
    global ani
    global callInfo

    infotag set evt_facility_report gtd

    if {[infotag get cfg_avpair_exists prefix]} {
      set prefix [infotag get cfg_avpair prefix]
    } else {
      puts -nonewline "busy-ringback: no prefix configured"
      call close
      return
    }

    if {[infotag get cfg_avpair_exists alert-time]} {
      set alertTime [infotag get cfg_avpair alert-time]
    } else {
      set alertTime 60
    }

    set rdn [infotag get leg_rdn]
    set ani [infotag get leg_ani]
    set callInfo(originationNum) $ani
    set callInfo(alertTime) $alertTime
    puts -nonewline "busy-ringback: ANI $ani RDN $rdn"

    set redirCnt [infotag get leg_redirect_cnt]
    if {[infotag get cfg_avpair_exists ignore-redir-count]} {
      set redirCnt 1
    }
    if {$redirCnt != 1 || $rdn == ""} {
      puts -nonewline "busy-ringback: not first redirection ($redirCnt) or no RDN"
      call close
      return
    }
     
    if {[infotag get cfg_avpair_exists calling-pattern]} {
      if {[regexp [infotag get cfg_avpair calling-pattern] $ani var] == 0} {
       puts -nonewline "busy-ringback: no prompt for caller $ani"
       set callInfo(notifyEvents) "ev_alert ev_proceeding"
       leg setup $prefix$rdn callInfo
       return
      }
    }

    leg setupack leg_incoming
    leg connect leg_incoming

    leg setup $prefix$rdn callInfo leg_incoming

    media play leg_incoming flash:/en_rec_goodbye.au
    timer start named_timer 20 PROMPT_TIMER
    }

    proc actNoSrv_Proceed {} {
    leg proceeding leg_incoming
    }

    proc actNoSrv_Alert {} {
    leg alert leg_incoming
    }

    proc actNoSrv_SetupDone {} {
    set status [infotag get evt_status]
    puts -nonewline "NoSrvSetupDone status $status"
    if {$status != "ls_000"} {
      call close
    } else {
      leg connect leg_incoming
      connection create leg_incoming leg_outgoing
    }
    }

    proc act_Timer {} {
    media play leg_incoming flash:/en_rec_goodbye.au
    timer start named_timer 20 PROMPT_TIMER
    }

    proc act_MediaDone {} {
    puts -nonewline "busy-ringback: mediaDone status [infotag get evt_status]"
    timer start named_timer 1 X
    }

    proc act_Interval {} {
    if [infotag get cfg_avpair_exists media-interval] {
      media play leg_incoming [infotag get cfg_avpair media-interval]
    }
    }

    proc act_SetupDone {} {
    timer stop named_timer PROMPT_TIMER

    set status [infotag get evt_status]
    puts -nonewline "busy-ringback SetupDone status $status"
    if {$status != "ls_000"} {
      playtone leg_incoming tn_disconnect
      timer start named_timer 5 X
      fsm setstate CLOSING
    }
    }

    proc act_Cleanup {} {
    call close
    }

    proc act_Disconnected {} {
    global leg

    set leg [infotag get evt_legs]
    puts -nonewline "busy-ringback leg $leg disconnect cause [infotag get evt_last_disconnect_cause], IEC [infotag get evt_disc_iec], RSI [infotag get evt_disc_rsi]"
      connection destroy con_all
    }

    proc act_DestroyDone {} {
    global leg

    leg disconnect $leg
    }


    proc act_TranRequest {} {

    global trnTo
    global cntID

    set trnTo [infotag get evt_transfer_info transferDest]
    set cntID [infotag get evt_transfer_info consultID]

    puts -nonewline "busy-ringback: transfer request to $trnTo consultID $cntID leg [infotag get evt_legs]"

    connection destroy con_all
    }

    proc act_TranDestroyDone {} {

    global cntID
    global trnTo

    set callInfo(transferConsultID) $cntID
    set callInfo(notifyEvents) "ev_alert ev_proceeding ev_progress ev_transfer_status"
    set callInfo(mode) redirect_rotary

    leg setup $trnTo callInfo leg_incoming
    }

    proc act_TranSetupDone {} {

    set status [infotag get evt_status]
    set leg [infotag get evt_legs]
    puts -nonewline "busy-ringback: tranSetupDone status $status leg $leg"

    switch $status {
      ls_000 {
      
      }
      ls_014 {
       leg transferdone leg_outgoing ts_000
      }
      default {
       leg transferdone leg_incoming ts_009
      }
    }
    }

    proc act_Generic { } {
    set evt [infotag get evt_event]
    switch $evt {
      ev_setup_done         -
      ev_collectdigits_done -
      ev_media_done         -
      ev_disconnected       -
      ev_authorize_done     -
      ev_authenticate_done  -
      ev_vxmldialog_done    -
      ev_subscribe_done     -
      ev_unsubscribe_done   -
      ev_unsubscribe_indication {set status [infotag get evt_status]}
      default   { set status "N/A"}
    }
     
    switch $evt {
      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_transfer_request   -
      ev_vxml_dialog_done   -
      ev_vxmldialog_event {set leg [infotag get evt_legs]}
      default   {set leg "N/A"}
    }
    puts -nonewline "Event $evt status $status leg $leg"
    if {$evt == "ev_feature" } {
      puts -nonewline "Feature type [infotag get evt_feature_type]"
    }
    }

    requiredversion 2.0

    #----------------------------------
    # State Machine
    #----------------------------------
    set fsm(INIT,ev_setup_indication) "act_Activation     CALLING"
    set fsm(CALLING,ev_proceeding)  "actNoSrv_Proceed   PROC"
    set fsm(PROC,ev_alert)    "actNoSrv_Alert     ALERT"
    set fsm(CALLING,ev_named_timer)  "act_Timer          same_state"
    set fsm(CALLING,ev_media_done)  "act_MediaDone      same_state"
    set fsm(CALLING,ev_named_timer)  "act_Interval  CALLING"
    set fsm(ALERT,ev_setup_done)  "actNoSrv_SetupDone CONNECT"
    set fsm(CALLING,ev_setup_done)  "act_SetupDone      CONNECT"
    set fsm(CONNECT,ev_transfer_request) "act_TranRequest TRANSFER"
    set fsm(TRANSFER,ev_destroy_done) "act_TranDestroyDone same_state"
    set fsm(TRANSFER,ev_setup_done)  "act_TranSetupDone  CONNECT"
    set fsm(CLOSING,ev_named_timer)  "act_Cleanup        same_state"
    set fsm(CONNECT,ev_disconnected) "act_Disconnected same_state"
    set fsm(CONNECT,ev_destroy_done) "act_DestroyDone same_state"
    set fsm(CONNECT,ev_disconnect_done) "act_Cleanup  same_state"
    set fsm(any_state,ev_any_event)  "act_Generic        same_state"

    fsm define fsm INIT



    Regards

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Anusha Kannappan on 18-02-2011 04:03:33 AM
    Hi Chrysostomos,

    I don't see any issues with your configs. Just let us know what is the issue faced by you. BTW please go through the documents mentioned previously to gain the basic knowledge.

    Thanks,
    Anusha

    Subject: RE: New Message from Anusha Kannappan in Voice Gateway API (VGAPI) - TCL-AP
    Replied by: Chrysostomos Christofi on 18-02-2011 05:45:23 AM
    Dear Anusha

    As we know cisco does not provide any modification like beep tone when you are already in the phone and someone else call you ate the same time..
    So The idea for this script and configuration is when internal users or external users call for example  1256 number and this number is already on the phone then the calling number can receive a modification(here we have an announcement that inform the calling number that ) the called number is already on the phone ..and called number for sure can see that someone else calling him

    Pls help , I have stacked

    From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
    Sent: Friday, February 18, 2011 11:12 AM
    To: cdicuser@developer.cisco.com
    Subject: New Message from Anusha Kannappan in Voice Gateway API (VGAPI) - TCL-API: RE: TCL SCRIPT FOR VOICE GATEWAY

    Anusha Kannappan has created a new message in the forum "TCL-API":

    --------------------------------------------------------------
    Hi Chrysostomos,

    I don't see any issues with your configs. Just let us know what is the issue faced by you. BTW please go through the documents mentioned previously to gain the basic knowledge.

    Thanks,
    Anusha
    --
    To respond to this post, please click the following link:

    <http://developer.cisco.com/web/vgapi/forums/-/message_boards/view_message/3073080>

    or simply reply to this email.

    Subject: RE: TCL SCRIPT FOR VOICE GATEWAY
    Replied by: Raghavendra Gutty Veeranagappa on 18-02-2011 05:57:02 AM
    Hi Chrysostomos,

    please let us know is your script is picked up by dialing the destination or are you getting any errors with the script if so please send us the logs by enabling following debugs

    debug voip app
    debug voip ccapi inout

    Thanks,
    Raghavendra

    Subject: RE: New Message from Raghavendra Gutty Veeranagappa in Voice Gateway API (V
    Replied by: Chrysostomos Christofi on 18-02-2011 06:33:23 AM
    Dear Gutty

    I see that if I call 1256 number internally then I don¿t see anything on the debug
    Also my question is how the the voice gateway involve in internal calls

    Pls check on the attached the debugs

    Thanking you in advance
    From: Cisco Developer Community Forums [mailto:cdicuser@developer.cisco.com]
    Sent: Friday, February 18, 2011 12:58 PM
    To: cdicuser@developer.cisco.com
    Subject: New Message from Raghavendra Gutty Veeranagappa in Voice Gateway API (VGAPI) - TCL-API: RE: TCL SCRIPT FOR VOICE GATEWAY

    Raghavendra Gutty Veeranagappa has created a new message in the forum "TCL-API":

    --------------------------------------------------------------
    Hi Chrysostomos,

    please let us know is your script is picked up by dialing the destination or are you getting any errors with the script if so please send us the logs by enabling following debugs

    debug voip app
    debug voip ccapi inout

    Thanks,
    Raghavendra
    --
    To respond to this post, please click the following link:

    <http://developer.cisco.com/web/vgapi/forums/-/message_boards/view_message/3073330>

    or simply reply to this email.

    Subject: RE: New Message from Raghavendra Gutty Veeranagappa in Voice Gateway API (V
    Replied by: Raghavendra Gutty Veeranagappa on 21-02-2011 08:16:00 AM
    Hi Chrysostomos,

    from logs looks like your script is not picked up default script is picked up, please try to configure your script dial-peer 3.

    Thanks,
    Raghavendra