can tcl access contents of sip message?

Version 1
    This document was generated from CDN thread

    Created by: Steve Park on 31-03-2010 04:29:48 AM
    I have done a lot of research but I haven't found the answer.
    I am trying to see if tcl can access sip cause code (200OK or 503 no circuit available as an example).
     
    What I am trying to do is based on which sip cause code I get, I want script to play prompts.
    so far, I don't think this is possible.
     
    am i wrong?

    Subject: RE: can tcl access contents of sip message?
    Replied by: Vijay Prasad Neelamegam on 31-03-2010 12:46:09 PM
    Hi Steve,
     
    Yes you are right.We can just get the headers from the INVITE message.AFAIK we cannot access the SIP Cause code through TCL.
     
    Thanks
    Vijay

    Subject: RE: can tcl access contents of sip message?
    Replied by: Steve Park on 31-03-2010 01:47:34 PM
    if cisco API can get all headers from disconnect(which btw I did not see), it doesn't make sense to not be able to get
    status code.
     
    does future cisco have any plan to add that to API?
     
    Can you also show me how to access all headers from disconnect?

    Subject: RE: can tcl access contents of sip message?
    Replied by: Steve Park on 01-04-2010 02:24:26 PM
    Does anyone know the answer to this?

    Subject: RE: can tcl access contents of sip message?
    Replied by: Anusha Kannappan on 02-04-2010 04:02:23 AM
    Hi Steve,
     
    As mentioned in the TCL IVR programming guide for accessing the headers associated with the protocol we can make use of 'leg_proto_headers'
     
    Syntax: infotag get leg_proto_headers [<attribute-name>]
     
    where <attribute-name> is the name of the header to get.
     
    But currently, only access to headers in SIP invite, subscribe, notify and H.323 setup messages are supported.
     
    Also if <attribute-name> is not specified, all headers are returned in a concatenated string, with each header separated by a "&" symbol and if legID is not provided, the first incoming leg is applied.
     
    And related to you question whether there are any future plans for adding this API, please let us share your requirments in detail so that we will pass it on to the marketing team and get back to you with their response.
     
    Thanks,
    Anusha

    Subject: RE: can tcl access contents of sip message?
    Replied by: Steve Park on 05-04-2010 06:38:51 PM
    Hi Steve,
     
    As mentioned in the TCL IVR programming guide for accessing the headers associated with the protocol we can make use of 'leg_proto_headers'
     
    Syntax: infotag get leg_proto_headers [<attribute-name>]
     
    where <attribute-name> is the name of the header to get.
     
    But currently, only access to headers in SIP invite, subscribe, notify and H.323 setup messages are supported.
     
    Also if <attribute-name> is not specified, all headers are returned in a concatenated string, with each header separated by a "&" symbol and if legID is not provided, the first incoming leg is applied.
     
    And related to you question whether there are any future plans for adding this API, please let us share your requirments in detail so that we will pass it on to the marketing team and get back to you with their response.
     
    Thanks,
    Anusha

     
    Hello, and thank you for your response.
    It will be nice to see if API can access all sip messages(not just what you mentioned above) so that it can react to certain response code.(final response in sip. If not, do nothing).

    Subject: RE: can tcl access contents of sip message?
    Replied by: Travis May on 05-05-2010 03:52:11 AM
    I am having difficulty getting simple headers from the INVITE.
     
    as5350xm
    c5350-jk9su2_ivs-mz.150-1.M1.bin
     
    Incoming leg is SIP, I can easily see the From and other headers with "sh debug ccsip mess"
     
    I have tried both leg_proto_headers and evt_proto_headers
     
    proc proc_setup_indication { } {

        leg proceeding leg_incoming
        leg alert leg_incoming -p 8
       
        set headersAll [infotag get leg_proto_headers]
        puts "************** headersAll: $headersAll    *********************\n\n"

       
        set headersAllLeg [infotag get leg_proto_headers leg_incoming]
        puts "************** headersAllLeg: $headersAllLeg    *********************\n\n"


        set headersFrom [infotag get leg_proto_headers "From"]
        puts "************** headersFrom: $headersFrom    *********************\n\n"

    }
     
    RESULTS from "debug voip app script":

    May  4 20:23:53.706: //16492//TCL :/tcl_PutsObjCmd:
    ************** headersAll:     *********************

    May  4 20:23:53.706:
    May  4 20:23:53.706: //16492//TCL :/tcl_PutsObjCmd:
    ************** headersAllLeg:     *********************

    May  4 20:23:53.706:
    May  4 20:23:53.710: //16492//TCL :/tcl_PutsObjCmd:
    ************** headersFrom:     *********************
     
    I have even tried moving these commands to later in the call, after the conference is connected.  Still, no output.
     
    Thanks,
    Travis

    Subject: RE: can tcl access contents of sip message?
    Replied by: Anusha Kannappan on 05-05-2010 11:59:37 AM
    Hi Travis,
     
    We will be able to retrieve the headers from the SIP invite message using both the leg_proto_headers as well as the evt_proto_headers. COuld you please share us the running config and the scripts you are trying to excute to drill down issue further? Also what is the dnis value you have when you are making the call?
     
    Thanks,
    Anusha.

    Subject: RE: can tcl access contents of sip message?
    Replied by: Travis May on 06-05-2010 03:22:09 AM
    router#show call application voice protoHeaderTest
    Script Name : protoHeaderTest
           URL  : http://webserver/tcl/protoHeaderTest.tcl
           Type : Service
           State: Registered
           Life : Configured
           Exec Instances: 0

    Script Code Begin:
    --------------------------------

    TCL Script version 2.2 or above

    proc init { } {
    }

    proc eventHandler { } {

            puts "\n************* EVENT:[infotag get evt_event]********\n"


            set callID [infotag get leg_proto_headers "Call-ID"]
            puts "\n\n************** callID: $callID    *********************\n\n"

            set headersAll [infotag get leg_proto_headers]
            puts "\n\n************** headersAll: $headersAll    *********************\n\n"

            set headersAllLeg [infotag get leg_proto_headers leg_incoming]
            puts "\n\n************** headersAllLeg: $headersAllLeg    *********************\n\n"


            set headersFrom [infotag get leg_proto_headers "From"]
            puts "\n\n************** headersFrom: $headersFrom    *********************\n\n"

      set AccountInfo [infotag get leg_proto_headers AccountInfo]
      puts "\n\n************** AccountInfo = $AccountInfo *********************\n\n"
     
            call close
    }

    requiredversion 2.1
    init

    set fsm(any_state,ev_any_event) "eventHandler,same_state"
    fsm define fsm SINGLESTATE


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


    router#
    router#term mon
    router#

    May  5 20:12:22.359: //31//TCL :/tcl_PutsObjCmd:
    ************* EVENT:ev_setup_indication********

    May  5 20:12:22.359:
    May  5 20:12:22.359: //31//TCL :/tcl_PutsObjCmd:

    ************** callID:     *********************


    May  5 20:12:22.359:
    May  5 20:12:22.359: //31//TCL :/tcl_PutsObjCmd:

    ************** headersAll:     *********************


    May  5 20:12:22.359:
    May  5 20:12:22.359: //31//TCL :/tcl_PutsObjCmd:

    ************** headersAllLeg:     *********************


    May  5 20:12:22.359:
    May  5 20:12:22.359: //31//TCL :/tcl_PutsObjCmd:

    ************** headersFrom:     *********************


    May  5 20:12:22.359:
    May  5 20:12:22.359: //31//TCL :/tcl_PutsObjCmd:

    ************** AccountInfo =  *********************

    Subject: RE: can tcl access contents of sip message?
    Replied by: Anusha Kannappan on 06-05-2010 07:42:12 AM
    Hi Travis,
     
    I had gone through the running configs that you had sent to me and found that you are missing the mandatory configs for headers passing. Please include the following configs and try it out.
     
    sip
      header-passing 
     
     
    Thanks,
    Anusha

    Subject: RE: can tcl access contents of sip message?
    Replied by: Travis May on 06-05-2010 10:08:11 AM
    Worked like a charm !
     
    Thanks you very much Anusha
     
    Travis

    Subject: RE: can tcl access contents of sip message?
    Replied by: Yawming Chen on 19-05-2010 02:43:09 PM
    Cannot read SIP cause code but those codes might equal to leg setup status that can we can get it when receive ev_setup_done
     
    For example
     
    200 OK for INVITE treat is as ls_000 and 503 is ls_xxx.
     
    Thanks,
     
    Yawming

    Subject: RE: can tcl access contents of sip message?
    Replied by: srikanth satturi on 14-04-2011 05:08:44 AM
    Hi Travis,
     
    I had gone through the running configs that you had sent to me and found that you are missing the mandatory configs for headers passing. Please include the following configs and try it out.
     
    sip
      header-passing 
     
     
    Thanks,
    Anusha

     
    Thanks a lot , this post was very helpful for me. I wanna know one more thing, like after i added header passing I could see 
     

    Apr 14 07:53:22.345: //302713//TCL :/tcl_PutsObjCmd: CLI: sip:17607058888@voxbone.com instead of 17607058888. Can we control this.
     
    Thanks

    Subject: RE: can tcl access contents of sip message?
    Replied by: srikanth satturi on 14-04-2011 05:19:50 AM
    After I did this config change sip header passing, I could see  cli is coming as : sip:username@domain instead of 17607058888.

    Is there anyway so that CLI and CLD remains same.


    Srikanth

    Subject: RE: can tcl access contents of sip message?
    Replied by: srikanth satturi on 14-04-2011 08:39:12 AM
    After I did this config change sip header passing, I could see  cli is coming as : sip:username@domain instead of 17607058888.

    Is there anyway so that CLI and CLD remains same.


    Srikanth

     
    please anyone help me out

    Subject: RE: can tcl access contents of sip message?
    Replied by: srikanth satturi on 14-04-2011 11:03:24 AM
    Thanks a lot Raghavendra.

    Does adding sip header-passing in config will have any negative affect on performance of AS5400. If yes, what percentage will it be.

    And is there anything to be handled explicitily after this change.


    Srikanth

    Subject: RE: can tcl access contents of sip message?
    Replied by: Raghavendra Gutty Veeranagappa on 14-04-2011 09:02:40 AM
    Hi Srikanth,

    As per sip uri standards it is not possible to change, sip uri must contain username and domain .

    Thanks,
    raghavendra

    Subject: RE: can tcl access contents of sip message?
    Replied by: Raghavendra Gutty Veeranagappa on 15-04-2011 05:39:00 AM
    Hi Srikanth,

    I don't think there will be any platform specific issue due to the cli and no need to configure anything after configuring sip header-passing.

    Thanks,
    Raghavendra

    Subject: RE: can tcl access contents of sip message?
    Replied by: srikanth satturi on 19-04-2011 07:54:45 AM
    Thanks a lot

    Here is the issue i am facing with after I enabled sip header passing

    I have a translation rule

    voice translation-rule 7
    rule 1 /\+/ //
    !

    this rule is applied through translation profile on dial-peer for incoming number

    this rule is supposed to strip '+' from CLI

    Example : CLI : +99999999999 it will come into script as 99999999999

    right now CLI coming as sip:99999999999@domain.. so this rule is getting failed. How can I make a workaround so I could able to apply translation rule on CLI.

    please help me out.

    Thanks a lot

    Subject: RE: can tcl access contents of sip message?
    Replied by: Raghavendra Gutty Veeranagappa on 19-04-2011 09:11:49 AM
    Hi Srikanth,

    you mean to say that after configuring sip header-passing you are getting sip:99999999999@domain, before your getting sip:+99999999999@domain, if so could you please send us the logs and also explain breifly about your call flow.

    Thanks,
    Raghavendra

    Subject: RE: can tcl access contents of sip message?
    Replied by: srikanth satturi on 19-04-2011 09:24:51 AM
    Thanks a lot. Sorry If I am not clear here.

    Before I did sip header passing (I mean no sip header passing) translation rule affect was Example : CLI : +99999999999 it will come into script as 99999999999.

    Now after I did sip header passing , translation rule supposed to strip '+' from CLI. Example : CLI: sip:+99999999999@domain should become

    sip:99999999999@domain but this is not happening. CLI is passed into script as sip:+99999999999@domain instead of sip:99999999999@domain.

    So here translation rule is not geting applied properly or something is getting failed becoz of i enable sip header passing

    please help me out.

    Pasting the debug voice translation. this is one more example

    voice translation-rule 1
    rule 1 /\+/ //
    rule 2 /^8888/ /DD/

    !
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    Apr 19 12:16:35.937: //-1/B47E5EA38A8F/RXRULE/regxrule_stack_pop_RegXruleNumInfo: stack=0x6848070C; count=1
    Apr 19 12:16:35.937: //-1/B47E5EA38A8F/RXRULE/regxrule_stack_pop_callinfo_internal: numinfo=0xC36D6204
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_stack_push_RegXruleNumInfo_internal: stack=0x6848070C; count=1
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_profile_translate_internal: number=+123456 type=unknown plan=unknown numbertype=calling
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_profile_match_internal: Matched with rule 1 in ruleset 1
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_profile_match_internal: Matched with rule 1 in ruleset 1
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/sed_subst: Successful substitution; pattern=+123456 matchPattern=\+ replacePattern= replaced pattern=123456
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_subst_num_type: Match Type = none, Replace Type = none Input Type = unknown
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_subst_num_plan: Match Plan = none, Replace Plan = none Input Plan = unknown
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_profile_translate_internal: xlt_number=123456 xlt_type=unknown xlt_plan=unknown
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_profile_translate_internal: number= type=unknown plan=unknown numbertype=redirect-called
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_get_RegXrule: Invalid translation ruleset tag=0
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_profile_match_internal: Error: ruleset for redirect-called number not found
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_profile_translate_internal: No match: number= type=unknown plan=unknown
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_profile_translate_internal: number=8888 type=unknown plan=unknown numbertype=called
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_match: No match; number=8888 rule precedence=1
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_profile_match_internal: Matched with rule 2 in ruleset 7
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_match: No match; number=8888 rule precedence=1
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_profile_match_internal: Matched with rule 2 in ruleset 7
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_match: No match; number=8888 rule precedence=1
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/sed_subst: Successful substitution; pattern=8888 matchPattern=^8888 replacePattern=DD replaced pattern=DD
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_subst_num_type: Match Type = none, Replace Type = none Input Type = unknown
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_subst_num_plan: Match Plan = none, Replace Plan = none Input Plan = unknown
    Apr 19 12:16:35.941: //-1/B47E5EA38A8F/RXRULE/regxrule_profile_translate_internal: xlt_number=DD xlt_type=unknown xlt_plan=unknown
    Apr 19 12:16:35.945: //302926//TCL :/tcl_PutsObjCmd: CLI: sip:+123456@domain.com

    Apr 19 12:16:35.945:
    Apr 19 12:16:35.945: //302926//TCL :/tcl_PutsObjCmd: TotalLanguages: 2

    Apr 19 12:16:35.945:
    Apr 19 12:16:35.945: //302926//TCL :/tcl_PutsObjCmd: DNIS: sip:8888@ip:port

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

    Srikanth

    Subject: RE: can tcl access contents of sip message?
    Replied by: LEON MCCALLA on 19-04-2011 09:28:29 AM
    have you tried....


    voice translation-rule 7
    rule 2  /sip:\+/    /sip:/

    Leon

    Subject: RE: can tcl access contents of sip message?
    Replied by: srikanth satturi on 19-04-2011 09:35:03 AM
    I tried did not work, I dont think it will allow non digits in translation rule. Range of digits her can be [0-9]..


    Srikanth

    Subject: RE: can tcl access contents of sip message?
    Replied by: LEON MCCALLA on 19-04-2011 09:57:12 AM
    Thanks a lot

    Here is the issue i am facing with after I enabled sip header passing

    I have a translation rule

    voice translation-rule 7
    rule 1 /\+/ //
    !

    this rule is applied through translation profile on dial-peer for incoming number

    this rule is supposed to strip '+' from CLI

    Example : CLI : +99999999999 it will come into script as 99999999999

    right now CLI coming as sip:99999999999@domain.. so this rule is getting failed. How can I make a workaround so I could able to apply translation rule on CLI.

    please help me out.

    Thanks a lot

    Subject: RE: can tcl access contents of sip message?
    Replied by: srikanth satturi on 19-04-2011 10:22:10 AM
    Hi Srikanth,

    As per sip uri standards it is not possible to change, sip uri must contain username and domain .

    Thanks,
    raghavendra

    Subject: RE: can tcl access contents of sip message?
    Replied by: Yaw-Ming Chen on 20-07-2011 06:39:36 PM
    Not sure if you got the answer for your issue. The fact is that
    when
    1. enabled sip header passing
    2. have a translation rule
    3. SIP is using
     
    Your Tcl appication might got triggered but the SIP URI will still have the old number before tanslation when coming to Tcl script.
    This is a bug and will be fixed in next release of IOS.
     
     
     
    Thanks a lot

    Here is the issue i am facing with after I enabled sip header passing

    I have a translation rule

    voice translation-rule 7
    rule 1 /\+/ //
    !

    this rule is applied through translation profile on dial-peer for incoming number

    this rule is supposed to strip '+' from CLI

    Example : CLI : +99999999999 it will come into script as 99999999999

    right now CLI coming as sip:99999999999@domain.. so this rule is getting failed. How can I make a workaround so I could able to apply translation rule on CLI.

    please help me out.

    Thanks a lot


    Subject: Re: New Message from Yaw-Ming Chen in Voice Gateway API (VGAPI) - TCL-API:
    Replied by: LEON MCCALLA on 20-07-2011 10:17:42 PM
    when it comes to TCL I¿ve had bugs open from 2003. you¿re better of using work arounds.

    set callInfo(originationNum) xxxxxxx
    Leon


    From: Cisco Developer Community Forums
    Sent: Wednesday, July 20, 2011 6:39 PM
    To: cdicuser@developer.cisco.com
    Subject: New Message from Yaw-Ming Chen in Voice Gateway API (VGAPI) - TCL-API: RE: can tcl access contents of sip message?

    Yaw-Ming Chen has created a new message in the forum "TCL-API":

    --------------------------------------------------------------
    Not sure if you got the answer for your issue. The fact is that
    when
    1. enabled sip header passing
    2. have a translation rule
    3. SIP is using

    Your Tcl appication might got triggered but the SIP URI will still have the old number before tanslation when coming to Tcl script.
    This is a bug and will be fixed in next release of IOS.




    Thanks a lot

    Here is the issue i am facing with after I enabled sip header passing

    I have a translation rule

    voice translation-rule 7
    rule 1 /\+/ //
    !

    this rule is applied through translation profile on dial-peer for incoming number

    this rule is supposed to strip '+' from CLI

    Example : CLI : +99999999999 it will come into script as 99999999999

    right now CLI coming as sip:99999999999@domain.. so this rule is getting failed. How can I make a workaround so I could able to apply translation rule on CLI.

    please help me out.

    Thanks a lot

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

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

    or simply reply to this email.