Mapping OCN ISUP IE to SIP Diversion in INVITE

Version 1
    This document was generated from CDN thread

    Created by: Sylvain Cousineau on 22-04-2011 08:09:25 AM
    We have a 5ESS switch that forwards calls to our Voicemail systems using AS5300 GW connected by PRI on the ISDN side. The voicemail system selects the appropriate box by the contents of the SIP Diversion field in the SIP INVITE.
     
    For multiple re-directions (cascades and redirections), the GW always selects the contents of the last Ridirecting Number (RDN) to map to the SIP Diversion field.
     
    However, in some cases, we would like the SIP Diversion to contain the first Ridirecting Number (OCN). In there anyway for a TCL script or any other built-in config to achieve this? We do not have any softswitch or application server in the network.

    Subject: Re: New Message from Sylvain Cousineau in Voice Gateway API (VGAPI) - TCL-A
    Replied by: LEON MCCALLA on 22-04-2011 09:33:14 AM
    what will your criteria be for deciding whether the OCN or the RDN should be used?

    Leon

    From: Cisco Developer Community Forums
    Sent: Friday, April 22, 2011 8:09 AM
    To: cdicuser@developer.cisco.com
    Subject: New Message from Sylvain Cousineau in Voice Gateway API (VGAPI) - TCL-API: Mapping OCN ISUP IE to SIP Diversion in INVITE

    Sylvain Cousineau has created a new message in the forum "TCL-API":

    --------------------------------------------------------------
    We have a 5ESS switch that forwards calls to our Voicemail systems using AS5300 GW connected by PRI on the ISDN side. The voicemail system selects the appropriate box by the contents of the SIP Diversion field in the SIP INVITE.

    For multiple re-directions (cascades and redirections), the GW always selects the contents of the last Ridirecting Number (RDN) to map to the SIP Diversion field.

    However, in some cases, we would like the SIP Diversion to contain the first Ridirecting Number (OCN). In there anyway for a TCL script or any other built-in config to achieve this? We do not have any softswitch or application server in the network.
    --
    To respond to this post, please click the following link:

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

    or simply reply to this email.

    Subject: RE: Mapping OCN ISUP IE to SIP Diversion in INVITE
    Replied by: Sylvain Cousineau on 22-04-2011 09:54:08 AM
    Thanks for replying.

    Ideally it would be maybe based on T1 controller or the Called Party Number which represents our VMS access number in this case. In any case, we are trying to get it working as a proof of concept. So just getting the OCN mapped into the Diversion for all cases is a good start.

    Subject: RE: Mapping OCN ISUP IE to SIP Diversion in INVITE
    Replied by: Sylvain Cousineau on 22-04-2011 10:41:39 AM
    I've replaced the real numbers with fictional ones. We can't use the "To" since the SIP stack on the receiving application is a closed system. It's also used for other flow decision purposes later on at the application level. In the following trace, we would like Redirecting Number i = '!', 0x038F, '5197723333' to be in Diversion instead of Redirecting Number i = '!', 0x0382, '5199021111'



    Mar 10 15:14:59.150: ISDN Se3/1:23 Q931: RX <- SETUP pd = 8  callref = 0x0338
           Bearer Capability i = 0x8090A2
                   Standard = CCITT
                   Transfer Capability = Speech 
                   Transfer Mode = Circuit
                   Transfer Rate = 64 kbit/s
           Channel ID i = 0xA98390
                   Exclusive, Channel 16
           Facility i = 0x9F8B0100A10F02010106072A8648CE1500040A0100
                   Protocol Profile =  Networking Extensions
                   0xA10F02010106072A8648CE1500040A0100
                   Component = Invoke component
                           Invoke Id = 1
                           Operation = InformationFollowing (calling_name)
                                   Name information in subsequent FACILITY message
           Progress Ind i = 0x8281 - Call not end-to-end ISDN, may have in-band info 
           Calling Party Number i = 0x2183, '5191234567'
                   Plan:ISDN, Type:National
           Called Party Number i = 0xA1, '5199122222'
                   Plan:ISDN, Type:National
           Redirecting Number i = '!', 0x038F, '5197723333'
                   Plan:ISDN, Type:National
           Redirecting Number i = '!', 0x0382, '5199021111'
                   Plan:ISDN, Type:National



    Sent:
    INVITE sip:5199122222@10.247.33.80:5060 SIP/2.0
    Via: SIP/2.0/UDP 10.247.164.231:5060;x-route-tag="tgrp:1";branch=z9hG4bK1C213
    Remote-Party-ID: <sip:'5191234567@10.247.164.231>;party=calling;screen=yes;privacy=off
    From: <sip:'5191234567@10.247.164.231>;tag=FEBF208-A48
    To: <sip:5199122222@10.247.33.80>
    Date: Thu, 10 Mar 2011 20:14:59 GMT
    Call-ID: E86E20C3-4A8911E0-8043B8BF-1C9AB394@10.247.164.231
    Supported: 100rel,timer,resource-priority,replaces
    Min-SE:  1800
    Cisco-Guid: 3899411378-1250496992-2148270099-424009122
    User-Agent: Cisco-SIPGateway/IOS-12.x
    Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY, INFO, REGISTER
    CSeq: 101 INVITE
    Max-Forwards: 70
    Timestamp: 1299788099
    Contact: <sip:5191234567@10.247.164.231:5060>
    Diversion: <sip:5199021111@10.247.164.231>;privacy=off;reason=no-answer;screen=no
    Expires: 180
    Allow-Events: telephone-event
    Content-Type: application/sdp
    Content-Disposition: session;handling=required
    Content-Length: 252

    v=0
    o=CiscoSystemsSIP-GW-UserAgent 932 2490 IN IP4 10.247.164.231
    s=SIP Call
    c=IN IP4 10.247.164.231
    t=0 0
    m=audio 18280 RTP/AVP 0 101
    c=IN IP4 10.247.164.231
    a=rtpmap:0 PCMU/8000
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=ptime:20

    Subject: Re: New Message from Sylvain Cousineau in Voice Gateway API (VGAPI) - TCL-A
    Replied by: LEON MCCALLA on 22-04-2011 10:26:14 AM
    I can¿t say I¿ve ever seen an RDN or a diversion number in the traces although I know such fields do exist. I¿ve done some TCL work over the years so post traces of the Q931 setup and the SIP invite and I¿ll try to cobble a short script for you.

    what about if the RDN is simply dropped.  Can your VMS system grab the TO instead of the DIVERSION field in the header?

    Leon

    From: Cisco Developer Community Forums
    Sent: Friday, April 22, 2011 9:54 AM
    To: cdicuser@developer.cisco.com
    Subject: New Message from Sylvain Cousineau in Voice Gateway API (VGAPI) - TCL-API: RE: Mapping OCN ISUP IE to SIP Diversion in INVITE

    Sylvain Cousineau has created a new message in the forum "TCL-API":

    --------------------------------------------------------------
    Thanks for replying.

    Ideally it would be maybe based on T1 controller or the Called Party Number which represents our VMS access number in this case. In any case, we are trying to get it working as a proof of concept. So just getting the OCN mapped into the Diversion for all cases is a good start.
    --
    To respond to this post, please click the following link:

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

    or simply reply to this email.

    Subject: RE: Mapping OCN ISUP IE to SIP Diversion in INVITE
    Replied by: LEON MCCALLA on 22-04-2011 05:53:46 PM
    I wrote a small TCL but i'm not sure how to upload it so i'll paste it below... I'm not a genius but i'm trying to help....

    Leon

    proc act_Setup { } {
        global dest
        global ani
       
        leg setupack leg_incoming

        set dest [infotag get leg_dnis]
    set ani [infotag get leg_ani]


    if {[infotag get evt_gtd gtd_setup] > 0} {
      if {[infotag get gtd_attr_exists gtd_setup rdn.-1]} {
       set callInfo(redirectNum) [object get gtd gtd_setup rdn.1.rdn]
      }
    }

    set callInfo(originationNum) $ani

        leg proceeding leg_incoming
        leg setup $dest callInfo leg_incoming
    }

    proc act_CallSetupDone { } {
        if { $status != "ls_000"} {
            call close
        }
    }

    proc act_Cleanup { } {
        call close
    }

     
    #----------------------------------
    #   State Machine
    #----------------------------------
      set TopFSM(any_state,ev_disconnected) "act_Cleanup,same_state"
      set TopFSM(CALL_INIT,ev_setup_indication) "act_Setup,PLACECALL"
      set TopFSM(PLACECALL,ev_setup_done)  "act_CallSetupDone,same_state"
      set TopFSM(any_state,ev_disconnect_done) "act_Cleanup,same_state"

      fsm define TopFSM  CALL_INIT

    Subject: RE: Mapping OCN ISUP IE to SIP Diversion in INVITE
    Replied by: LARIS BENKIS on 27-07-2011 03:19:53 PM
    I've tried to extract the OCN without success

    To do this I create the gtd handle "gtd_setup":
       set ret [ object create gtd gtd_setup IAM ]
       puts "act_Setup gtd_setup create return $ret"

    I then extract the ocn information:
      set ocn_exists_num [object get gtd gtd_setup ocn.-1.dat]
      puts "act_Setup ocn_exists_num $ocn_exists_num"

    The debugs show the incoming call and the OCN parameter set properly.  A debug error message (ERROR: GTD_STATUS_PARM_NOT_FOUND) is generated on the object get call.  I'm wondering if the <attribute_name> parameter on the call "ocn.-1.dat" is correct.  There doesn't appear to be any documentation online about how to form attribute_name other than two examples in the programming guide.  The .dat suffix on the attribute seems pretty arbitrary so without some explanation on how the attribute name is constructed getting it to work is a matter of lucky guessing.

    Jul 27 10:21:14.436: ISDN Se3/1:23 Q931: RX <- SETUP pd = 8  callref = 0x0399
            Bearer Capability i = 0x8090A2
                    Standard = CCITT
                    Transfer Capability = Speech 
                    Transfer Mode = Circuit
                    Transfer Rate = 64 kbit/s
            Channel ID i = 0xA98396
                    Exclusive, Channel 22
            Facility i = 0x9F8B0100A11002010102010080084C2042454E4B4953
                    Protocol Profile =  Networking Extensions
                    0xA11002010102010080084C2042454E4B4953
                    Component = Invoke component
                            Invoke Id = 1
                            Operation = CallingName
                                    Name Presentation Allowed Extended
                                    Name = L BENKIS
            Progress Ind i = 0x8283 - Origination address is non-ISDN 
            Calling Party Number i = 0x2183, '5556809285'
                    Plan:ISDN, Type:National
            Called Party Number i = 0xA1, '5555090003'
                    Plan:ISDN, Type:National
            Redirecting Number i = '!#', 0x8F, '5559023071'
                    Plan:ISDN, Type:National
            Redirecting Number i = '!', 0x0382, '5559023074'
                    Plan:ISDN, Type:National
    Jul 27 10:21:14.436: ISDN Se3/1:23 Q931: extract_redirect_orig_called_ie: IE type redirecting num 5149023074 reason 2 cnt -1 plan 1 type 2 pres 0
    Jul 27 10:21:14.440: ISDN Se3/1:23: Built a GTD of size 267 octets for ISDN message type 0x5
    Jul 27 10:21:14.440: tsp_ccrawmsg_encap: calling cdapi_find_tsm
    Jul 27 10:21:14.440: cdapi_find_tsm: Found Tunnelled Signaling Msg with GTD: PROT_PTYPE_GTD
    Jul 27 10:21:14.440: cdapi_find_tsm: Found a gtd msg of length 267:
    Jul 27 10:21:14.440: gtd msg = "IAM,
    PRN,isdn*,,NI***,
    USI,rate,c,s,c,1
    USI,lay1,ulaw
    TMR,00
    CPN,04,,1,5555090003
    CGN,04,,1,y,4,5556809285
    OCN,04,1,n,5559023071
    FDC,RNI,rr,5,0f
    RGN,04,1,y,5559023074
    RNI,,3,,2
    FDC,RNI,rr,5,02
    CPC,09
    FCI,,,,,,,y,
    GCI,84ed43d0b79211e0803f001bd51b4e16"

    Jul 27 10:21:14.440: ccGTDExtractParm: Starting
    Jul 27 10:21:14.440:  tunnelledPtype = 2
    Jul 27 10:21:14.440:  gtdInstance = 0
    Jul 27 10:21:14.440:  gtdBitMap = 0xFFFFFFFF
    Jul 27 10:21:14.440: ccGTDExtractParm: TunnelledContent has GTD message
    Jul 27 10:21:14.440: gtd msg = "IAM,
    PRN,isdn*,,NI***,
    USI,rate,c,s,c,1
    USI,lay1,ulaw
    TMR,00
    CPN,04,,1,5555090003
    CGN,04,,1,y,4,5556809285
    OCN,04,1,n,5559023071
    FDC,RNI,rr,5,0f
    RGN,04,1,y,5559023074
    RNI,,3,,2
    FDC,RNI,rr,5,02
    CPC,09
    FCI,,,,,,,y,
    GCI,84ed43d0b79211e0803f001bd51b4e16"

    Jul 27 10:21:14.440: ccGTDExtractParm: GTD Parm OCN obtained
    Jul 27 10:21:14.440: ccGTDExtractParm: GTD Parm CPC obtained
    Jul 27 10:21:14.440: ccGTDExtractParm: GTD Parm FDC obtained
    Jul 27 10:21:14.440: ccGTDExtractParm: GTD Parm FDC obtained
    Jul 27 10:21:14.440: ccGTDExtractParm: GTD Parm TMR obtained
    Jul 27 10:21:14.440: ccGTDExtractParm: GTD Parm PRN obtained
    Jul 27 10:21:14.440: ccMapGCItoGUID: GTD Parm GCI present: 84ed43d0b79211e0803f001bd51b4e16
    Jul 27 10:21:14.444: Have gtd msg, length=267:
    Jul 27 10:21:14.444: gtd msg = "IAM,
    PRN,isdn*,,NI***,
    USI,rate,c,s,c,1
    USI,lay1,ulaw
    TMR,00
    CPN,04,,1,5555090003
    CGN,04,,1,y,4,5556809285
    OCN,04,1,n,5559023071
    FDC,RNI,rr,5,0f
    RGN,04,1,y,5559023074
    RNI,,3,,2
    FDC,RNI,rr,5,02
    CPC,09
    FCI,,,,,,,y,
    GCI,84ed43d0b79211e0803f001bd51b4e16"


    Jul 27 10:21:14.448: //112//TCL :/tcl_PutsObjCmd: act_Setup gtd_setup create return 1
    Jul 27 10:21:14.448:
    Jul 27 10:21:14.448: gtd_get_parm_field(): ERROR: GTD_STATUS_PARM_NOT_FOUND
    Jul 27 10:21:14.448: //112//TCL :/tcl_PutsObjCmd: act_Setup: ocn_number_all
    Jul 27 10:21:14.448:
    Jul 27 10:21:14.448: Have gtd msg, length=267:
    Jul 27 10:21:14.448: gtd msg = "IAM,
    PRN,isdn*,,NI***,
    USI,rate,c,s,c,1
    USI,lay1,ulaw
    TMR,00
    CPN,04,,1,5555090003
    CGN,04,,1,y,4,5556809285
    OCN,04,1,n,5559023071
    FDC,RNI,rr,5,0f
    RGN,04,1,y,5559023074
    RNI,,3,,2
    FDC,RNI,rr,5,02
    CPC,09
    FCI,,,,,,,y,
    GCI,84ed43d0b79211e0803f001bd51b4e16"

    Subject: RE: Mapping OCN ISUP IE to SIP Diversion in INVITE
    Replied by: Yaw-Ming Chen on 27-07-2011 03:31:44 PM
    The following fields are defined for the Original Called Number (OCN).

    Field Name Type Comments Assoc. enum/value
    noa number Nature of address gtdMNoaType
    npi number Number plan indicator gtdMNpiType
    pi number Presentation indicator gtdMPiType
    num Null terminated string Telephony number Alphanumeric char string (see telephone-number, ENG-110144, for syntax, up to 32 chars)

    Subject: RE: Mapping OCN ISUP IE to SIP Diversion in INVITE
    Replied by: LARIS BENKIS on 27-07-2011 03:43:44 PM
    The following fields are defined for the Original Called Number (OCN).

    Field Name Type Comments Assoc. enum/value
    noa number Nature of address gtdMNoaType
    npi number Number plan indicator gtdMNpiType
    pi number Presentation indicator gtdMPiType
    num Null terminated string Telephony number Alphanumeric char string (see telephone-number, ENG-110144, for syntax, up to 32 chars)

     
     
    So how would the num parameter be extracted?
    If I set the attribute_name parameter a few different ways (trying for the lucky guess here because its not documented) I get:
     
    ocn.-1.dat - script generates a debug error message ERROR: GTD_STATUS_PARM_NOT_FOUND
    ocn.num - script crashes with message  "Invalid instance specification num"
    ocn.num.dat - script crashes with message  "Invalid instance specification num"
     
     
    Thanks
     
    Laris
     

    Subject: RE: Mapping OCN ISUP IE to SIP Diversion in INVITE
    Replied by: LARIS BENKIS on 28-07-2011 01:47:31 PM
    So how would the num parameter be extracted?
    If I set the attribute_name parameter a few different ways (trying for the lucky guess here because its not documented) I get:
     
    set ocn_exists_num [object get gtd gtd_setup ocn.-1.dat]     - script generates a debug error message ERROR: GTD_STATUS_PARM_NOT_FOUND
    set ocn_exists_num [object get gtd gtd_setup ocn.num]        - script crashes with message "Invalid instance specification num"
    set ocn_exists_num [object get gtd gtd_setup ocn.num.dat]  - script crashes with message "Invalid instance specification num"
     
     
    Thanks
     
    Laris
     

    Subject: RE: Mapping OCN ISUP IE to SIP Diversion in INVITE
    Replied by: Raghavendra Gutty Veeranagappa on 29-07-2011 02:38:11 AM
    Hi Laris,

    Please try with following code and print values.

    set gtdHandle [infotag get evt_gtd gtd_iam]
    if {$gtdHandle > 0} {
         if {[infotag get gtd_attr_exists gtd_iam ocn.-1]} {

             set ocn_noa [object get gtd event_gtd ocn.1.noa]
             set ocn_npi [object get gtd event_gtd ocn.1.npi]
             set ocn_num [object get gtd event_gtd ocn.1.#]
    }

    }

    Thanks,
    Raghavendra

    Subject: RE: Mapping OCN ISUP IE to SIP Diversion in INVITE
    Replied by: LARIS BENKIS on 29-07-2011 10:37:25 AM
    Hi Laris,

    Please try with following code and print values.

    set gtdHandle [infotag get evt_gtd gtd_iam]
    if {$gtdHandle > 0} {
         if {[infotag get gtd_attr_exists gtd_iam ocn.-1]} {

             set ocn_noa [object get gtd event_gtd ocn.1.noa]
             set ocn_npi [object get gtd event_gtd ocn.1.npi]
             set ocn_num [object get gtd event_gtd ocn.1.#]
    }

    }

    Thanks,
    Raghavendra

     
    Thanks Raghavendra,
    I got it to work with this code:
     
        set ret [ object create gtd gtd_iam IAM ]
        puts "act_Setup gtd_setup create return $ret"
     
        set gtdHandle [infotag get evt_gtd gtd_iam]
        if {$gtdHandle > 0} {
            if {[infotag get gtd_attr_exists gtd_iam ocn.-1]} {
                set ocn_noa [object get gtd gtd_iam ocn.1.noa]
                puts "act_Setup ocn_noa $ocn_noa"
                set ocn_npi [object get gtd gtd_iam ocn.1.npi]
                puts "act_Setup ocn_npi $ocn_npi"
                set ocn_num [object get gtd gtd_iam ocn.1.#]
                puts "act_Setup ocn_num $ocn_num"
            }
        }
     
    I'm a little confused - what is the difference between the gtdhandles returned by "object create gtd" and "infotag get evt_gtd"?
     
    Is there any documentation on the structure of the attr_instance parameters that are used by "object get gtd"?  The documentation I've seen gives some examples without really explaining them.
     
    Laris