Actions

Sip headers manipulation: Difference between revisions

(fix format)
(sort headers alphabetically)
Line 48: Line 48:


=== Headers that cannot be used in 'SIP headers manipulation': ===
=== Headers that cannot be used in 'SIP headers manipulation': ===
      - Accept
  Accept
      - Accept-Encoding
  Accept-Contact
      - Accept-Language
  Accept-Encoding
      - Alert-Info
  Accept-Language
      - Allow
  Alert-Info
      - Authorization
  Allow
      - Authentication-Info
  Allow-Events
      - Also
  Also
      - Call-ID
  Anonymity
      - Call-Info
  Authentication-Info
      - Contact
  Authorization
      - Content-Disposition
  Call-ID
      - Content-Encoding
  Call-Info
      - Content-Language
  Contact
      - Content-Length
  Content-Disposition
      - Content-Type
  Content-Encoding
      - CSeq
  Content-Language
      - Date
  Content-Length
      - Encryption
  Content-Type
      - Error-Info
  CSeq
      - Expires
  Date
      - From
  Encryption
      - In-Reply-To
  Error-Info
      - Max-Forwards
  Event
      - MIME-version
  Expires
      - Min-Expires
  From
      - Organization
  In-Reply-To
      - Priority
  Max-Forwards
      - Proxy-Authenticate
  MIME-version
      - Proxy-Authorization
  Min-Expires
      - Proxy-Require
  Min-SE
      - Record-Route
  Organization
      - Reply-To
  P-Asserted-Identity
      - Require
  P-Media-Authorization
      - Response-Key
  P-Preferred-Identity
      - Retry-After
  Priority
      - Route
  Privacy
      - Server
  Proxy-Authenticate
      - Subject
  Proxy-Authorization
      - Supported
  Proxy-Require
      - Timestamp
  RAck
      - To
  Reason
      - Unsupported
  Record-Route
      - User-Agen
  Refer-To
      - Via
  Referred-By
      - RAck
  Reject-Contact
      - RSeq
  Remote-Party-ID
      - Warning
  Replaces
      - WWW-Authenticate
  Reply-To
      - Event
  Request-Disposition
      - Allow-Events
  Require
      - Refer-To
  Response-Key
      - Referred-By
  Retry-After
      - Replaces
  Route
      - Session-Expires
  RPID-Privacy
      - Min-SE
  RSeq
      - Request-Disposition
  Security-Client
      - Accept-Contact
  Security-Server
      - Reject-Contact
  Security-Verify
      - Anonymity
  Server
      - RPID-Privacy
  Service-Route
      - Remote-Party-ID
  Session-Expires
      - Subscription-State
  Subject
      - Security-Client
  Subscription-State
      - Security-Server
  Supported
      - Security-Verify
  Timestamp
      - Reason
  To
      - P-Media-Authorization
  Unsupported
      - Privacy
  User-Agen
      - P-Asserted-Identity
  Via
      - P-Preferred-Identity
  Warning
      - Service-Route
  WWW-Authenticate

Revision as of 13:29, 7 August 2020

The behavior 'SIP headers manipulation' allows the SBC users to freely add ,remove and modify the sip headers when SBC forwards the received invite, 18x and 200 sip messages (there are limitations, please refer to the limitations section below).

Configuration:

To use the behavior, you need to select the option "Enable SIP headers manipulation" under the path "Gateway -> Advanced Parameters" and use the filter script "sip_headers_manipulation.rb" in routing script setting.

Usage:

The manipulation actions are based on what are defined in "sip_headers_manipulation.rb" dynamically or statically. In sip_headers_manipulation.rb, there is filter_sip_headers_manipulation that should be applied as 'after filter' in main script and need to use call[:manipulation] to save what you want SBC to do regarding headers manipulation. An example is :

 def filter_sip_headers_manipulation params
   
   # The following 4 lines are needed to initialize the hash table
   call = params[ :call ]
   call[:manipulation] = {}
   call[:manipulation][:invite] = {}
   call[:manipulation]["18x"] = {}
   call[:manipulation]["200"] = {}
   
   # Will remove "P-Charging-Vector" header from the the invite if exists
   call[:manipulation][:invite]["P-Charging-Vector"] = "todelete"
   # Will add or modify "banana" and set its value to "red" header from the invite
   call[:manipulation][:invite][:banana] = "red"
   # Will add or modify "salad" and set its value to "blue" header from the invite
   call[:manipulation][:invite][:salad] = "blue"
   
   # Will add or modify "P-Charging-Vector" and set its value to "PCV" header from the 18x
   call[:manipulation]["18x"]["P-Charging-Vector"] = "PCV"
   # Will add or modify "banana" and set its value to "yellow" header from the 18x
   call[:manipulation]["18x"][:banana] = "yellow"
   # Will add or modify "salad" and set its value to "green" header from the 18x
   call[:manipulation]["18x"][:salad] = "green"
   
   call[:manipulation]["200"]["P-Charging-Vector"] = "PCV"
   call[:manipulation]["200"][:banana] = "yellow"
   call[:manipulation]["200"][:TEST] = "STXIE"
   
   params
 end 
   
 

Limitations:

  1. 'SIP headers manipulation' can only affect SIP headers who are not already modified/generated by the other SBC behaviors, see example below.
  2. Header values are viewed as a constant string, the routing script cannot pass variable to SBC.
  3. If the manipulated header is already present, it will be overwritten.
  4. Manipulate headers hash can only be set once per call (on the incoming invite message). It is not possible to update the hash later during the call.
  5. SIP header in Re-invite and 200 OK attached to Re-invite cannot be affected by this behavior.


Headers that cannot be used in 'SIP headers manipulation':

 Accept
 Accept-Contact
 Accept-Encoding
 Accept-Language
 Alert-Info
 Allow
 Allow-Events
 Also
 Anonymity
 Authentication-Info
 Authorization
 Call-ID
 Call-Info
 Contact
 Content-Disposition
 Content-Encoding
 Content-Language
 Content-Length
 Content-Type
 CSeq
 Date
 Encryption
 Error-Info
 Event
 Expires
 From
 In-Reply-To
 Max-Forwards
 MIME-version
 Min-Expires
 Min-SE
 Organization
 P-Asserted-Identity
 P-Media-Authorization
 P-Preferred-Identity
 Priority
 Privacy
 Proxy-Authenticate
 Proxy-Authorization
 Proxy-Require
 RAck
 Reason
 Record-Route
 Refer-To
 Referred-By
 Reject-Contact
 Remote-Party-ID
 Replaces
 Reply-To
 Request-Disposition
 Require
 Response-Key
 Retry-After
 Route
 RPID-Privacy
 RSeq
 Security-Client
 Security-Server
 Security-Verify
 Server
 Service-Route
 Session-Expires
 Subject
 Subscription-State
 Supported
 Timestamp
 To
 Unsupported
 User-Agen
 Via
 Warning
 WWW-Authenticate