Pass Network ID

Question:

How can OpenSIPS be configured to pass information in SIP INVITE message as source network ID device attribute to OSPrey server?

Answer:

OpenSIPS can be configured to pass arbitrary information in SIP INVITE message as source network ID device attribute to OSPrey server. The most common use case is to pass trunk group ID as source network ID device attribute to OSPrey server.

Configuration:

  • Passing a specific SIP INVITE message header as source network ID device attribute to OSPrey server.

    • Example SIP INVITE message from Sonus SBC

      INVITE sip:+14353655849@192.168.13.82:5060;user=phone SIP/2.0
      Via: SIP/2.0/UDP 192.168.13.230:5060;branch=z9hG4bK08B011bf6d354f8ad10
      From: "NW-GW2 Line3" <sip:1022%269724103190%23%23DID@192.168.13.217>;tag=gK0820d699
      To: <sip:+14353655849@192.168.13.82;user=phone>
      Call-ID: 258508909_75488962@192.168.13.230
      CSeq: 173023 INVITE
      Max-Forwards: 70
      Allow: INVITE,ACK,CANCEL,BYE,REGISTER,REFER,INFO,SUBSCRIBE,NOTIFY,PRACK,UPDATE,OPTIONS,MESSAGE,PUBLISH
      Accept: application/sdp, application/isup, application/dtmf, application/dtmf-relay, multipart/mixed
      Contact: "NW-GW2 Line3" <sip:1022%269724103190%23%23DID@192.168.13.230:5060>
      P-Preferred-Identity: "NE-GW1 Line2" <sip:1002;phone-context=private@192.168.13.230:5060;user=phone>
      Date: Thu, 01 Jun 2017 17:47:45 GMT
      P-Source-OTG: ECSIPNEGW1a
      Supported: timer,100rel,precondition,replaces
      Session-Expires: 1800
      Min-SE: 90
      Content-Length:   313
      Content-Disposition: session; handling=required
      Content-Type: application/sdp

    • Example OpenSIPS configuration

      if (is_present_hf("P-Source-OTG")) {
      $avp(snid) = $hdr(P-Source-OTG);
      }
      
  • Passing SIP INVITE message request URI tgid parameter as source network ID device attribute to OSPrey server.

    • Example SIP INVITE message from Cisco and Acme/Oracle SBC

      INVITE sip:service@192.168.200.60:5060;tgid=123 SIP/2.0
      Via: SIP/2.0/UDP 192.168.200.61:5060;branch=z9hG4bK0g639r10fgc0aakk26s1.1
      From: sipp <sip:sipp@192.168.1.60:5060>;tag=SDc1rm601-1
      To: sut <sip:service@192.168.1.61:5060>
      Call-ID: SDc1rm601-d01673bcacfcc112c053d95971330335-06a3gu0
      CSeq: 1 INVITE
      Contact: <sip:sipp@192.168.200.61:5060;transport=udp>
      Display: sipp <sip:user@192.168.1.60:5060;up=abc>;hp=123
      Params: sipp <sip:sipp1@192.168.1.60:5060>
      Params: sipp <sip:sipp2@192.168.1.60:5060>
      Edit: disp <sip:user@192.168.1.60:5060>
      Max-Forwards: 69
      Subject: Performance Test
      Content-Type: application/sdp
      Content-Length: 140
      

    • Example OpenSIPS configuration

      if ($(ou{uri.params}{param.exist,tgid})) {
      $avp(snid) = $(ou{uri.param,tgid});
      }
      
  • Passing SIP INVITE message From header URI otg parameter as source network ID device attribute to OSPrey server.

    • Example SIP INVITE message from Metaswitch CFS and Sonus SBC

      INVITE sip:4135266060;npdi@osprey.txnx.com;transport=udp SIP/2.0
      Via: SIP/2.0/UDP cfs.txnx.com;rport;branch=z9hG4bK-136e916372f6aab672331c57dcbdc8151-cfs.txnx.com
      Allow-Events: message-summary, refer, dialog, line-seize, presence, call-info, as-feature-event, calling-name
      Call-ID: DB01FB61@cfs.txnx.net
      From: <sip:4135266053@cfs.txnx.com;transport=udp;otg=InTG>;tag=cfs.txnx.net+1+1ba126+bc32d13a;isup-oli=00
      To: <sip:4135266060@osprey.txnx.com>
      CSeq: 257390011 INVITE
      Expires: 180
      Supported: resource-priority, siprec, 100rel
      Content-Length: 126
      Content-Type: application/sdp
      Allow: INVITE, ACK, CANCEL, BYE, REGISTER, OPTIONS, PRACK, UPDATE, SUBSCRIBE, NOTIFY, REFER, INFO, PUBLISH
      Max-Forwards: 70
      Contact: <sip:4135266053@cfs.txnx.com;transport=udp>;isup-oli=00
      P-Asserted-Identity: <sip:4135266053@cfs.txnx.com>
      

    • Example OpenSIPS configuration

      if ($(fu{uri.params}{param.exist,otg})) {
      $avp(snid) = $(fu{uri.param,otg});
      }
      
  • Passing SIP INVITE message Contact header URI user tgrp parameter as source network ID device attribute to OSPrey server.

    • Example SIP INVITE message from Sansay SBC

      INVITE sip:+14357975866@192.168.1.54:5060 SIP/2.0
      Via: SIP/2.0/UDP 192.168.1.54:5060;branch=z9hG4bK1s4n3a274890rdb14
      Record-Route: <sip:74890rdb14@192.168.1.54:5060;transport=udp;lr>
      To: <sip:+14357975866@192.168.2.122>
      From: <sip:14232981622@192.168.2.122>;tag=sansay74890rdb14
      Call-ID: 35999-0-1648646770@192.168.1.54
      CSeq: 1 INVITE
      Contact: <sip:14232981622;tgrp=300;trunk-context=192.168.3.114@192.168.1.54:5060>
      Supported: timer, 100rel
      Session-Expires: 600;refresher=uac
      Min-SE: 90
      Max-Forwards: 69
      Content-Type: application/sdp
      Content-Length: 716
      

    • Example OpenSIPS configuration

      if (is_present_hf("Contact")) {
      if ($(ct.fields(uri){uri.user}{param.exist,tgrp})) {
       $avp(snid) = $(ct.fields(uri){uri.user}{param.value,tgrp});
      }
      }
      

Post configuration:

  • Any time that you make any changes to the opensips.cfg file, the OpenSIPS application must be restarted for the changes to take effect.
   $ pkill -9 opensips

The application will restart within one minute. The restart script runs every minute from user ospadmin’s crontab schedule.