Sip headers manipulation
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).
Contents |
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:
- 'SIP headers manipulation' can only affect SIP headers who are not already modified/generated by the other SBC behaviors, see example below.
- Header values are viewed as a constant string, the routing script cannot pass variable to SBC.
- If the manipulated header is already present, it will be overwritten.
- 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.
- 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-Encoding - Accept-Language - Alert-Info - Allow - Authorization - Authentication-Info - Also - Call-ID - Call-Info - Contact - Content-Disposition - Content-Encoding - Content-Language - Content-Length - Content-Type - CSeq - Date - Encryption - Error-Info - Expires - From - In-Reply-To - Max-Forwards - MIME-version - Min-Expires - Organization - Priority - Proxy-Authenticate - Proxy-Authorization - Proxy-Require - Record-Route - Reply-To - Require - Response-Key - Retry-After - Route - Server - Subject - Supported - Timestamp - To - Unsupported - User-Agen - Via - RAck - RSeq - Warning - WWW-Authenticate - Event - Allow-Events - Refer-To - Referred-By - Replaces - Session-Expires - Min-SE - Request-Disposition - Accept-Contact - Reject-Contact - Anonymity - RPID-Privacy - Remote-Party-ID - Subscription-State - Security-Client - Security-Server - Security-Verify - Reason - P-Media-Authorization - Privacy - P-Asserted-Identity - P-Preferred-Identity - Service-Route