SIP Header and Parameter Manipulation Configuration
To configure SIP header and parameter manipulation, first create a SIP header manipulation ruleset. Then create the header manipulation rules and optional header element rules for that ruleset to contain. Then configure a session agent or a SIP interface to use the SIP header and parameter manipulation ruleset in the inbound and outbound directions.
Testing Pattern Rules
Use test-pattern-rule to test the effect of your regex patterns.
- expression—Enter the regular expression to test.
- string—Enter the string against which you want to compare the regular expression.
- show—View the test pattern, the string, and the matches.
ORACLE(test-pattern-rule)# expression ".*(;tgid=(.+)).*" expression made 0 matches against string ORACLE(test-pattern-rule)# string "sip:+17024260002@KCMGGWC;user=phone SIP/2.0;tgid=Trunk1" expression made 3 matches against string ORACLE(test-pattern-rule)# show Pattern Rule: Expression : .*(;tgid=(.+)).* String : sip:+17024260002@KCMGGWC;user=phone SIP/2.0;tgid=Trunk1 Matched : TRUE Matches: $0 sip:+17024260002@KCMGGWC;user=phone SIP/2.0;tgid=Trunk1 $1 ;tgid=Trunk1 $2 Trunk1 ORACLE(test-pattern-rule)#
Creating Header Manipulation Rulesets
First create a header rule and then create element rules within that header rule.
Configuring SIP Header Manipulation Element Rules
Element rules are a subset of the SIP header manipulation rules and are applied at the element type level rather than at the entire header value.
To configure dynamic SIP header manipulation rules:
Status-Line Manipulation and Value Matching
The Oracle® Enterprise Session Border Controller’s HMR feature has been enhanced to support the ability to change the status code or reason phrase in SIP responses. This addition—the ability to edit status-lines in responses—builds on HMR’s existing ability to edit response headers or the Request-URI in a request.
This section shows you how to configure SIP HMR when you want the Oracle® Enterprise Session Border Controller to drop a 183 Session Progress response when it does not have SDP, though flexibility is built into this feature so that you can use it to achieve other ends. In addition, you can now set the SIP manipulation’s match-value parameter with Boolean parameters (AND or OR).
Set the Header Name
Set the header-name to @status-line to modify the status code or reason phrase in SIP responses.
Set the Element Type
In the element-rules configuration element, set the type parameter to either status-code or reason-phrase.
- status-code—Designates the status code of the response line. Accepts any string, but during the manipulation process only recognizes the range from 1 to 699.
- reason-phrase—Designates the reason of the response line. Accepts any string.
Note:
Like other rule types, the Oracle® Enterprise Session Border Controller matches against the value for these using case-sensitive, case-insensitive, or pattern-rule matching (set in the comparison-type parameter for the element rule).Configuring SIP HMR Sets
To enable HMR sets, set the action configuration element to sip-manip.
- action—Enter sip-manip value to enable use this rule for a SIP HMR set. This value then invoke the rule identified in the new-value parameter.
- new-value—Enter the name of the manipulation rule you want invoked for the set.
- Run verify-config to detect invalid or circular references.
- Save and activate your configuration.
Example 1 Stripping All Route Headers
This example explains how to strip all route headers from a SIP packet. First, you create a header manipulation ruleset, in the example it is called route-stripper. Then you configure the list of header manipulation rules you need to strip route headers. In this case, you only need one rule named Route (to match the Route header name) with the action set to Delete.
ORACLE# configure terminal ORACLE(configure)# session-router ORACLE(session-router)# sip-manipulation ORACLE(sip-manipulation)# name route-stripper ORACLE(sip-manipulation)# header-rules ORACLE(sip-header-rules)# name Route ORACLE(sip-header-rules)# action Delete ORACLE(sip-header-rules)# done header-rule name Route action delete match-value msg-type any ORACLE(sip-header-rules)# ex ORACLE(sip-manipulation)# done sip-manipulation name route-stripper header-rule name Route action delete match-value msg-type any
Example 2 Stripping an Existing Parameter and Adding a New One
This example explains how to strip the user parameter from the Contact header URI and add the acme parameter with value as LOCAL IP, only for requests. First you create a header manipulation ruleset, in the example it is called param-stripper1. You then configure a list of header rules you need. In this case, you only need one rule named Contact (to match the Contact header name), with action set to manipulate (indicating the elements of this header would be manipulated). Next, you configure a list of element rules for the Contact header rule.
In this case you configure two element rules; one to strip the uri parameter user (the rule name user matches the param name user) and the other to add the uri parameter acme (the rule name acme matches the param name acme).
ORACLE# configure terminal ORACLE(configure)# session-router ORACLE(session-router)# sip-manipulation ORACLE(sip-manipulation)# name param-stripper1 ORACLE(sip-manipulation)# header-rules ORACLE(sip-header-rules)# name Contact ORACLE(sip-header-rules)# action manipulate ORACLE(sip-header-rules)# msg-type request ORACLE(sip-header-rules)# element-rules ORACLE(sip-element-rules)# name user ORACLE(sip-element-rules)# type uri-param ORACLE(sip-element-rules)# action delete-element ORACLE(sip-element-rules)# done element-rule name user type uri-param action delete-element match-val-type any match-value new-value ORACLE(sip-element-rules)# name acme ORACLE(sip-element-rules)# action add ORACLE(sip-element-rules)# type uri-param ORACLE(sip-element-rules)# new-value "$LOCAL_IP" ORACLE(sip-element-rules)# done element-rule name acme type uri-param action add match-val-type any match-value new-value "$LOCAL_IP" ORACLE(sip-element-rules)# ex ORACLE(sip-header-rules)# done header-rule name Contact action manipulate match-value msg-type request element-rule name user type uri-param action delete-element match-val-type any match-value new-value element-rule name acme type uri-param action add match-val-type any match-value new-value "$LOCAL_IP" ORACLE(sip-header-rules)# ex ORACLE(sip-manipulation)# done sip-manipulation name param-stripper1 header-rule name Contact action manipulate match-value msg-type request element-rule name user type uri-param action delete-element match-val-type any match-value new-value element-rule name acme type uri-param action add match-val-type any match-value new-value "$LOCAL_IP"
For example, if the IP address of the SIP interface ($LOCAL_IP) is 10.1.2.3 and the Oracle® Enterprise Session Border Controller receives the following Contact header:
Contact: <sip:1234@10.4.5.6;user=phone>
The header rule is applied to strip the user parameter from the Contact header URI and add the acme parameter with the value 10.1.2.3:
Contact: <sip:1234@10.4.5.6;acme=10.1.2.3>