HMR Guide
HMR Guide
HMR Guide
Border Controller
Header Manipulation Rules Guide
F74362-01
This software and related documentation are provided under a license agreement containing restrictions on
use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your
license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license,
transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse
engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is
prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If
you find any errors, please report them to us in writing.
If this is software, software documentation, data (as defined in the Federal Acquisition Regulation), or related
documentation that is delivered to the U.S. Government or anyone licensing it on behalf of the U.S.
Government, then the following notice is applicable:
U.S. GOVERNMENT END USERS: Oracle programs (including any operating system, integrated software,
any programs embedded, installed, or activated on delivered hardware, and modifications of such programs)
and Oracle computer documentation or other Oracle data delivered to or accessed by U.S. Government end
users are "commercial computer software," "commercial computer software documentation," or "limited rights
data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental
regulations. As such, the use, reproduction, duplication, release, display, disclosure, modification, preparation
of derivative works, and/or adaptation of i) Oracle programs (including any operating system, integrated
software, any programs embedded, installed, or activated on delivered hardware, and modifications of such
programs), ii) Oracle computer documentation and/or iii) other Oracle data, is subject to the rights and
limitations specified in the license contained in the applicable contract. The terms governing the U.S.
Government's use of Oracle cloud services are defined by the applicable contract for such services. No other
rights are granted to the U.S. Government.
This software or hardware is developed for general use in a variety of information management applications.
It is not developed or intended for use in any inherently dangerous applications, including applications that
may create a risk of personal injury. If you use this software or hardware in dangerous applications, then you
shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure its
safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this
software or hardware in dangerous applications.
Oracle®, Java, and MySQL are registered trademarks of Oracle and/or its affiliates. Other names may be
trademarks of their respective owners.
Intel and Intel Inside are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are
used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Epyc,
and the AMD logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered
trademark of The Open Group.
This software or hardware and documentation may provide access to or information about content, products,
and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly
disclaim all warranties of any kind with respect to third-party content, products, and services unless otherwise
set forth in an applicable agreement between you and Oracle. Oracle Corporation and its affiliates will not be
responsible for any loss, costs, or damages incurred due to your access to or use of third-party content,
products, or services, except as set forth in an applicable agreement between you and Oracle.
Contents
About This Guide
My Oracle Support viii
Revision History
iii
About Dialog-Matching Header Manipulations 1-10
Built-In HMRs 1-12
Built-In Variables 1-13
Built-In SIP Manipulation Configuration 1-16
Unique Regex Patterns Per Peer and Trunk 1-17
Rejecting SIP Requests 1-18
HMR Information in Logs 1-19
Using Regular Expressions 1-20
Example of HMR with Regex 1-20
Regex Characters 1-20
Literal (Ordinary) 1-21
Special (Metacharacters) 1-21
Regex Tips 1-23
Matching New Lines 1-23
Escaped Characters 1-23
Building Expressions with Parentheses 1-23
Boolean Operators 1-24
Equality Operators 1-24
Normalizing EBNF ExpressionString Grammar 1-25
Storing Regex Patterns 1-25
Performance Considerations 1-25
Additional References 1-26
HMR Configuration 1-26
Testing Pattern Rules 1-26
Creating Header Manipulation Rulesets 1-27
Configuring SIP Header Manipulation Rules 1-30
Configuring SIP Header Manipulation Element Rules 1-32
Status-Line Manipulation and Value Matching 1-33
Set the Header Name 1-34
Set the Element Type 1-34
Set the Match Value 1-35
Configuring SIP HMR Sets 1-36
Configuring a Session Agent 1-37
Configuring a SIP Interface 1-37
Example 1 Stripping All Route Headers 1-38
Example 2 Stripping an Existing Parameter and Adding a New One 1-38
Unique HMR Regex Patterns and Other Changes 1-40
The Default Expression 1-40
Manipulation Pattern Per Remote Entity 1-41
Reject Action 1-42
Reject Action Configuration 1-42
iv
About Counters 1-43
SNMP Support 1-43
Log Action 1-44
Changes to Storing Pattern Rule Values 1-45
Removal of Restrictions 1-45
Name Restrictions for Manipulation Rules 1-45
New Value Restrictions 1-46
MIME Support 1-46
Manipulating MIME Attachments 1-46
About the MIME Value Type 1-47
SIP Message-Body Separator Normalization 1-48
Configuring MIME Support 1-49
HMR for SIP-ISUP 1-49
MIME Rules Overview 1-49
Identifying a MIME Rule 1-50
About MIME Rules 1-50
MIME Rules Configuration 1-51
Working with MIME Rules 1-53
MIME ISUP Manipulation 1-53
Adding an ISUP Body to a SIP Message 1-54
MIME ISUP Manipulation Configuration 1-55
Configuration Example 1-57
Header Manipulation Rules for SDP 1-58
SDP Manipulation 1-59
Regular Expression Interpolation 1-64
Regular Expressions as Boolean Expressions 1-65
Moving Manipulation Rules 1-67
Rule Nesting and Management 1-68
ACLI Configuration Examples 1-68
HMR Import-Export 1-73
Exporting 1-74
Importing 1-74
Using SFTP to Move Files 1-75
Removing Files 1-75
HMR Development 1-75
Development Overview 1-75
Development Tips 1-75
Planning Considerations 1-76
Traffic Direction 1-76
Order of Application Precedence 1-76
Order of HMR Execution 1-76
v
Applying HMR to a Specific Header 1-76
HMR Sets 1-77
Create Pseudocode 1-77
Test HMRs 1-77
test-sip-manipulation 1-77
Development Example 1-78
Writing the Pseudo Code 1-78
Testing the Pattern Rule 1-78
Constructing the HMR 1-79
Loading Test SIP Message 1-80
Configuring Testing 1-80
Executing Testing 1-80
Log File Analysis 1-81
Configuration Examples 1-81
Example 1 Removing Headers 1-81
Example 2 Manipulating the Request URI 1-82
Example 3 Manipulating a Header 1-84
Example 4 Storing and Using URI Parameters 1-85
Example 5 Manipulating Display Names 1-86
Example 6 Manipulating Element Parameters 1-88
Example 7 Accessing Data from Multiple Headers of the Same Type 1-90
Example 8 Using Header Rule Special Characters 1-92
Example 9 Status-Line Manipulation 1-94
Example 10 Use of SIP HMR Sets 1-95
Example 11 Use of Remote and Local Port Information 1-97
Example 12 Response Status Processing 1-98
Example 13 Remove a Line from SDP 1-100
Example 14 Back Reference Syntax 1-101
Example 15 Change and Remove Lines from SDP 1-102
Example 16 Change and Add New Lines to the SDP 1-103
vi
About This Guide
The HMR Resource Guide describes the SIP manipulation language called Header
Manipulation Rules (HMR).
This publication is used with Oracle Communications Session Border Controller and Oracle
Enterprise Session Border Controller.
Documentation Set
The following table describes the documentation set for this release.
vii
About This Guide
Documentation Accessibility
For information about Oracle's commitment to accessibility, visit the Oracle
Accessibility Program website at http://www.oracle.com/pls/topic/lookup?
ctx=acc&id=docacc.
My Oracle Support
My Oracle Support (https://support.oracle.com) is your initial point of contact for all
product support and training needs. A representative at Customer Access Support
(CAS) can assist you with My Oracle Support registration.
Call the CAS main number at 1-800-223-1711 (toll-free in the US), or call the Oracle
Support hotline for your local country from the list at http://www.oracle.com/us/support/
contact/index.html. When calling, make the selections in the sequence shown below
on the Support telephone menu:
1. Select 2 for New Service Request.
2. Select 3 for Hardware, Networking, and Solaris Operating System Support.
3. Select one of the following options:
• For technical issues such as creating a new Service Request (SR), select 1.
• For non-technical issues such as registration or assistance with My Oracle
Support, select 2.
You are connected to a live agent who can assist you with My Oracle Support
registration and opening a support ticket.
My Oracle Support is available 24 hours a day, 7 days a week, 365 days a year.
viii
About This Guide
Emergency Response
In the event of a critical service situation, emergency response is offered by the Customer
Access Support (CAS) main number at 1-800-223-1711 (toll-free in the US), or call the Oracle
Support hotline for your local country from the list at http://www.oracle.com/us/support/
contact/index.html. The emergency response provides immediate coverage, automatic
escalation, and other features to ensure that the critical situation is resolved as rapidly as
possible.
A critical situation is defined as a problem with the installed equipment that severely affects
service, traffic, or maintenance capabilities, and requires immediate corrective action. Critical
situations affect service and/or system operation resulting in one or several of these
situations:
• A total system failure that results in loss of all transaction processing capability
• Significant reduction in system capacity or traffic handling capability
• Loss of the system's ability to perform automatic system reconfiguration
• Inability to restart a processor or the system
• Corruption of system databases that requires service affecting corrective actions
• Loss of access for maintenance or recovery operations
• Loss of the system ability to provide any required critical or major trouble notification
Any other problem severely affecting service, capacity/traffic, billing, and maintenance
capabilities may be defined as critical by prior discussion and agreement with Oracle.
ix
Revision History
Revision History
This section provides a revision history for this document.
Date Description
March 2023 • Initial release.
x
1
Header Manipulation Rules
Variances among SIP networks, like incompatible vendor deployments or disparate SIP
services, can degrade SIP services or disrupt SIP operations. To resolve these variances,
Oracle deploys Header Manipulation Rules (HMR), giving network administrators the ability to
control SIP traffic by manipulating SIP messages.
HMRs permit the network administrator to:
• Insert, delete, or modify SIP headers or parameters
• Copy or move header or parameter values
• Rename parameter names
• Modify MIME bodies including SDP, XML and ISUP
• Change SIP-I/SIP-T ISUP messages, parameters, and fields
• Change message information when, for example, normalization is required
• Categorize and label specific message flows for special processing
• Capture information from a message and insert it into another message
The SBC can perform these actions based on the following:
• The type of SIP message (Request or Response)
• The type of Request (INVITE, REGISTER, etc.)
• The success or failure of a regular expression to match a header or parameter
HMR Fundamentals
HMR is a tool language based on rulesets, header rules, and element rules.
• Rulesets contain one or more header rules, as well as optional element rules that operate
on specified header elements. They are applied to inbound or outbound traffic for a
session agent, realm, or SIP interface.
• Header rules operate on specific headers. They can contain element rules, each of which
specify the actions to perform for a given element of this header.
• Element rules perform operations on the elements of a header. Header elements include
all subparts of a header, excluding the header name; for example, header value, header
parameter, and URI parameter.
The SBC cannot dynamically perform validation as you enter rules. Use the ACLI verify-
config command to confirm that the HMR configuration does not contain invalid or circular
references.
• An invalid reference is a reference that points to a non-existing rule.
• A circular reference is a reference that creates an endless loop of manipulation actions.
1-1
Chapter 1
HMR Fundamentals
Audience
This document is intended for those users who already understand the Oracle
Communications Session Border Controller and the SIP protocol. In addition, Oracle
recommends you become as HMR-savvy as possible by attending Oracle training
courses prior to launching any HMR in production. You should be aware of all issues
that might result from misinformed or misapplied HMRs.
1-2
Chapter 1
HMR Fundamentals
Note:
SBC sends content-length header in OPTIONS message to Session Agent that has
HMR configured.
Outbound HMR
Outbound HMR rules are applied just before the SIP message is sent out by the SBC, after
SIP-NAT processing. Any changes made by the HMR affects the message. Those changes
are not overridden by the SBC, which means the SBC does not prevent the rules from
breaking the protocol.
The rules are performed in a stateless manner. They do not store values across messages
and they do not remember what they did in previous messages.
Note:
You can work around the stateless behavior by having an inbound HMR copy the
information needed to a private header, which then goes through the SBC. The
outbound rule can then look for the header and act upon the information.
Inbound HMR
Inbound HMR rules are applied before most processing done by the SBC, but after some SIP
parser processing is performed. The message's source is determined to decide which
session agent, realm, or SIP interface it belongs to.
By default, the header rules are applied after the message is parsed; this verifies the
message is well-formed and follows the specifications. This is necessary to securely perform
any subsequent message processing, including HMR. An exception to this rule can be
created by setting the inmanip-before-validate option. See "SIP Header Pre-Processing
HMR" for more details.
Because inbound rules are applied before the message is completely processed by the SBC,
you can use them to make the SBC perform specific actions outside of ordinary processing.
For example, you can change the request-URI, add a Route header, or add a trunk group
URI to make the SBC route the request on a different path.
Inbound rules are stateless. However, if the SBC is in B2BUA mode (its most common mode)
it stores and remembers certain header values for later use in the dialog. If HMR changes
them on inbound, the SBC later believes them to be the actual received values. There are a
few exceptions to this with the following headers:
• To and From can be changed by HMR and are used when the message gets forwarded
out another interface.
But if they were for a new request message, the SBC remembers the original ones when
it sends back 1xx-6xx responses. The previous hop that sent the new request inspects
the responses and needs them to be identical based on SIP protocol rules. However,
requests sent by the SBC back to the originator for the call, from the called to the caller,
will not be automatically undone by the SBC as the responses were.
• Call-ID values are stored before HMR is applied and cannot be changed by HMR on
inbound.
1-3
Chapter 1
HMR Fundamentals
If a SIP INVITE is received for a new call, inbound HMR can change the To or From
headers so that the next hop device gets the changed headers and the SBC stores
them. But the 100 Trying, 180 Ringing, and 200 OK responses, for example, will use
the original To and From values and not the HMR modified ones. If the called party
later sends a Bye or re-Invite, back to the caller, the SBC will then use the HMR
modified values it stored, which may or may not be correct.
Routing Decisions
Before routing the message, the SBC parses the ingress SIP message, ensuring the
validity of the message's structure. After this parsing, the SBC applies the inbound
header manipulation. You can use the inbound HMRs to modify the SBC's routing
behavior if you want to increase the flexibility of the routing options.
An outbound HMR is the last processing the SBC performs on traffic before passing it
back to the interface hardware. Knowing where this processing fits in helps you to
know what state the traffic will be in before being processed by the outbound HMR.
Outbound traffic is not subject to the screening functions performed by the hardware
on inbound traffic.
Static HMR
Static HMR lets you set up rules that remove and/or replace designated portions of
specified SIP headers. The SBC can:
1-4
Chapter 1
HMR Fundamentals
• Search headers for dynamic content or patterns with the header value. It can search, for
example, for all User parts of a URI that begin with 617 and end with 5555 (e.g.,
617...5555).
• Manipulate any part of a patterns match with any part of a SIP header. For example, 617
123 5555 can become 617 231 5555 or 508 123 0000, or any combination of those.
Dynamic HMR
SIP HMR lets you set up dynamic header manipulation rules that give the SBC complete
control over alterations to the header value. Using regular expressions provides a high
degree of flexibility for header manipulation. For example, you can search a specific URI
when you do not know the value of the parameter, but want to use the matched parameter
value as the header value. It also lets you preserve matched sections of a pattern, and
change what you want to change.
Sample HMR
The following shows a complete HMR that manipulates To and From headers, changes the
URI-host element, and hides IP topology. It is applied as outgoing for a realm. The HMR
includes a built-in HMR variable $REMOTE_IP.
sip-manipulation
name NAT_IP
description
split-headers
join-headers
header-rule
name To
header-name To
action manipulate
comparison-type case-sensitive
msg-type request
methods
match-value
new-value
element-rule
name To
parameter-name
type uri-host
action none
match-val-type ip
comparison-type case-sensitive
match-value
new-value $REMOTE_IP
header-rule
name From
header-name From
action manipulate
comparison-type case-sensitive
msg-type request
methods
match-value
new-value
element-rule
1-5
Chapter 1
HMR Components
name From
parameter-name
type uri-host
action none
match-val-type ip
comparison-type case-sensitive
match-value
new-value $LOCAL_IP
HMR Components
Each SIP manipulation ruleset contains one or more header rules and element rules
for use as an inbound or outbound HMR ruleset. Generally, you set a header rule that
will store what you want to match, and then you create subsequent rules that operate
on this stored value.
Because header rules and element rules are applied sequentially, a given rule
performs its operations on the results of all the rules previously entered. For example,
if you want to delete a portion of a SIP header, you would create Rule 1 that stores the
value for the purpose of matching, and then create Rule 2 that would delete the portion
of the header you want removed. This prevents removing data that might be used in
the other header rules.
Ruleset Guidelines
Keep the following guidelines in mind when creating rulesets:
• One ruleset per inbound message
• One ruleset per outbound message
• Header or element rules can call another HMR
• An HMR can have multiple header rules
• A header rule can have multiple header rules
Ruleset Components
The following table lists ruleset components.
1-6
Chapter 1
HMR Components
Component Description
header-rule Header rules form the basis of rulesets. Used to operate on one or
more SIP headers within the SIP message; operations performed
at this level work on the entire header value, excluding the label.
Within a ruleset, each HR is performed in order. Typically one
performs regular expression "store" action HRs before manipulation
ones, although there are exceptions depending on the needs.
There is no hard limit to the number of HR elements included in a
ruleset, although in practical terms one would probably not
configure thousands of them.
match-value Used to perform a matching comparison to decide whether to store
values, add a header, or delete a header. The type of matching
comparison performed is based on the comparison-type field.
If the match-value is left blank, the action is performed regardless.
Therefore, if the header rule action is "delete", "add", or
"manipulate", and the match value is left blank, the action will be
performed on the header.
If the header rule action is "store" and the match value is left blank,
the SBC automatically stores everything, as if the match value
were .+ which means match at least one character, as many times
as possible. Note that any whitespace after the first non-whitespace
character is kept as well.
element-rule Used to operate on specific portions of a SIP header, such as
components of a URI value within the header or the parameters of
the header; if the header value contains a URI, then this class
operates only on the specified portion (i.e., URI user or header
parameter); this class does not operate on headers with multiple
header values.
mime-rule Used to operate on any MIME part within a SIP message (SDP,
test, or some other proprietary body type); used as a general
facility to operate on the entire body as a single continuous string.
mime-header-rule Used to operate on the SIP headers within a body part; the body
part contains headers only when the MIME content is contained in
a multi-part message; when used to operate on a MIME body that
is not multi-part, then this class operates as through it were a
header-rule.
mime-isup rule Special type of mime-rule because it expects the MIME content of
the specified body to be part of a valid binary ISDN User Part
(ISUP) format.
isup-param-rule Used to perform operations on the parameters contained in an
ISUP body.
mime-sdp-rule Special kind of mime-rule that is used to operate on the SDP MIME
content of a SIP message; at this level, the rule operates on the
entire SDP as a single contiguous string.
sdp-session-rule Used to operate on only the session portion of the SDP content
consists of all the characters starting from the beginning until the
first media line.
sdp-media-rule Used to operate on only a specific media portion of the SDP
content; consists of all the characters starting from the beginning of
the specified m-line until the next m-line or the end of the SDP.
sdp-line-rule Used to operate on a single descriptor line within either the session
or media portion of the SDP.
1-7
Chapter 1
HMR Components
Add a trailing [<index>] value after the header-name parameter to represent the
specific instance of the header on which to operate. Additional stored header values
are indexed in the order in which they appear within the SIP message, and there is no
limit to the index. The SBC takes no action if the header does not exist.
Use index 0 to reference the first header. In addition to numerical values, possible
index values are:
• * The SBC references all headers.
1-8
Chapter 1
HMR Components
• ^ The SBC references the last stored header in the header rule.
Note that the header instance functionality has no impact on HMR’s add action, and you
cannot use this feature to insert headers into a specific location. Headers are added to the
end of the list, except that Via headers are added to the top.
This value allows the SBC to perform pre-validation header manipulation in order of
increasing precedence: SIP interface, realm, and session agent.
3. Save and activate the configuration.
1-9
Chapter 1
HMR Components
• header-rule=changeHeader
• action=manipulate
• match-value=(.+)([^;])
you can set the new-value as sip:$2 instead of sip:$changeHeader.$2.
Dialog Matching
The out-of-dialog setting is useful for To/From NATing rules.
Service providers can use HMR to support legacy RFC 2543 devices and some non-
compliant RFC 3261 devices. The header-rule msg-type setting called out-of-dialog
has been added, which applies the rule (and any of its sub-rules) only to out-of-dialog
requests. If the rule was applied as an outbound sip-manipulation to the first request,
then it will apply the rule against all subsequent requests going in the same direction.
The primary purpose of this new configuration setting is to support changing the To/
From URI's in mid-dialog requests without breaking dialog matching for some over-
strict SIP devices.
1-10
Chapter 1
HMR Components
The unmodified header must be cached because for any subsequent request (For example, a
BYE originating from the terminator. See the following diagram.) the SBC might need to
restore the original value, enabling the UAC to identify the message correctly as being part of
the same dialog. For out-of-dialog requests (when the To, From, or Call-ID headers are
modified) the original header is stored in the dialog when the msg-type out-of-dialog is
used.
The SBC performs the restoration of original headers outside of SIP manipulations. There are
no manipulation rules to configure for restore the header to their original context. The SBC
recognizes that the headers are modified, and restores them to their original state prior to
sending the message out. Restoration takes place prior to outbound manipulations so that
any outbound manipulation can those headers after they are restored.
1-11
Chapter 1
HMR Components
Built-In HMRs
In the course of HMR use, certain SIP manipulations have become commonly used.
Oracle created a library of built-in SIP manipulations that you use exactly like the
HMRs you create yourself. You apply the built-in HMRs as arguments to the in-
manipulationid and out-manipulationid parameters for session agents, realms, and
SIP interfaces. You can also apply them in HMR sets as a nested manipulation.
Built-in rules start with the prefix ACME_, so Oracle recommends you name your own
rules in a different manner to avoid conflict.
You can view a list of built-in manipulations using the following ACLI command:
show built-in-sip-manipulation
1-12
Chapter 1
HMR Components
ACME_NAT_TO_FROM_IP
When performed outbound, this rule changes:
• The To-URI hostname to the logical $TARGET_IP and port to $TARGET_PORT
• The From-URI to the logical $LOCAL_IP and port to be $LOCAL_PORT
Note:
This built-in HMR only runs when the URI-host is an IP address, not when it's a
domain name.
When applied in an inbound manner, the remote and local ports are reveresed.
Built-In Variables
To improve performance and reduce development complexity, the SBC contains built-in
variables for common components of the SIP message. These reserved variables operate
exactly like customer-defined variables. The recommended syntax is:
$<variable>.$0
For example:
$PAI_USER.$0
When you omit the $0, the resulting value is TRUE or FALSE, which can be useful to
determine if there was no username in the PAI header or that no PAI header exists.
The values for the variables are obtained when they are resolved. For example, when the To-
URI has been changed by a previous rule, the current rule gets the changed value (as would
apply to $ORIGINAL). When the header or value does not exist in the SIP message, either an
empty string is returned or, for Boolean uses, the value FALSE is returned.
The following table lists and describes the built-in variables.
Variable Description
$ORIGINAL Original value of element
$LOCAL_IP IP address of the SIP interface on which the
message was received for inbound manipulation
or sent on for outbound manipulation.
$LOCAL_PORT Port number of the SIP interface on which the
message was received for inbound manipulation
or sent on for outbound manipulation.
$REMOTE_IP IP address the message was received from for
inbound manipulation or sent to for outbound
manipulation.
$REMOTE_PORT Port number the message was received from for
inbound manipulation or sent to for outbound
manipulation.
1-13
Chapter 1
HMR Components
Variable Description
$REMOTE_VIA_HOST Host from the top Via header of the message.
$TRUNK_GROUP Legacy reserved variable that can resolve to
<TRUE/FALSE>.
$TRUNK_GROUP_CONTEXT Legacy reserved variable that can resolve to
<TRUE/FALSE>.
$REPLY_IP IP address where the SIP message came from
$REPLY_PORT Port number where the SIP message came from
$TARGET_IP IP address where the SIP message is sent to
$TARGET_PORT Port number where the SIP message is sent to
$MANIP_STRING The manipulation string
$MANIP_PATTERN Use a regex pattern from the most specific
matching session agent, realm, or SIP interface.
Only this variable can be used in the match-value
field. You cannot combine it with additional
characters. This variable can be used in any rule
you use a pattern-rule match value, including store
action rules.
You can also reference the stored values from
those referenced in later rules. For example, you
can create an allow list based on trunk From
header uri-user parameter. Each session agent
passes a different string on which to perform the
allow list operation.
Because the MANIP_PATTERN is dynamically
decided at run-time every time the HMR executes
for each message, it is possible no manipulation
pattern will be found. In this scenario, it will use
the default \,+. This default works most like .+.
It is also possible a sub-group might be referenced
that was not in the pattern chosen, in this scenario
the variable resolves to empty/FALSE.
$CRLF Search for carriage returns in new lines. Because
you can search for these value and replace them,
you also must be able to add them back in when
necessary. Resolves to \r\n and is commonly
used in MIME manipulation. If you are creating a
new body, there might be a need for many CRLFs
in the new-value parameter.
$TO_USER URI username from To header without any user
parameters.
$TO_PHONE URI user of the To header as a phone number
without any visual separators and with the leading
+ if it is present.
$TO_HOST URI host portion from the To header.
$TO_PORT URI port number from the To header. This is set to
5060 if it is not actually in the message.
$FROM_USER URI username from the From header without any
user parameters
$FROM_PHONE URI user of the From header as a phone number
without any visual separators and with the leading
+ if it is present
$FROM_HOST URI host portion from the From header.
1-14
Chapter 1
HMR Components
Variable Description
$FROM_PORT URI port number from the From header. This is set
to 5060 if it is not actually in the message.
$CONTACT_USER URI username from the first instance of the
Contact header without any user parameters.
$CONTACT_PHONE URI user of the first instance of the Contact
header as a phone number without any visual
separators and with the leading + if it is present.
$CONTACT_HOST URI host portion from the first instance of the
Contact header
$CONTACT_PORT URI port number from the first instance of the
Contact header. This is set to 5060 if it is not
actually in the message.
$RURI_USER URI username from the Request-URI header
without any user parameters.
$RURI_PHONE URI user of the Request-URI header as a phone
number without any visual separators and with the
leading + if it is present.
$RURI_HOST URI host portion from the Request-URI header.
$RURI_PORT URI port number from the Request-URI header.
This is set to 5060 if it is not actually in the
message.
$PAI_USER URI username from the first instance of the P-
Asserted-Identity header without any user
parameters.
$PAI_PHONE URI user of the first instance of the P-Asserted-
Identity header as a phone number without any
visual separators and with the leading + if it is
present.
$PAI_HOST URI host portion from the first instance of the P-
Asserted-Identity header.
$PAI_PORT URI port number from the first instance of the P-
Asserted-Identity header. This is set to 5060 if it is
not actually in the message.
$PPI_USER URI username from the first instance of the P-
Preferred-Identity header without any user
parameters.
$PPI_PHONE URI user of the first instance of the P-Preferred-
Identity header as a phone number without any
visual separators and with the leading + if it is
present.
$PPI_HOST URI host portion from the first instance of the P-
Preferred-Identity header.
$PPI_PORT URI port number from the first instance of the P-
Preferred-Identity header. This is set to 5060 if it is
not actually in the message.
$PCPID_USER URI username from the P-Called-Party-ID header
without any user parameters.
$PCPID_PHONE URI user of theP-Called-Party-ID header as a
phone number without any visual separators and
with the leading + if it is present.
$PCPID_HOST URI host portion from theP-Called-Party-ID
header.
1-15
Chapter 1
HMR Components
Variable Description
$PCPID_PORT URI port number from the P-Called-Party-ID
header. This is set to 5060 if it is not actually in the
message.
$CALL_ID Resolves to the Call-ID of the current SIP
message; is a commonly stored rule.
$TIMESTAMP_UTC Gets the current time from the SBC's system clock
in RFC 3339 format:
YYYY-MM-DDTHH:MM:SS.PPPZ
The PPP is partial seconds and the time is based
on UTC.
For example:
2012-01-01 T22:00:09.123Z
$T_GROUP Trunk group
$T_CONTEXT Trunk group context
$M_STRING A boolean that is true if the manipulation-string
exists, false if not. The variable $M_STRING.$0
contains the manipulation-string.
1-16
Chapter 1
HMR Components
Note:
All built-in rules start with ACME_.
sip-manipulation
name sipTrunkallowlist
...
header-rule
name allowlistOnFrom
header-name From
action manipulate
comparison-type case-sensitive
msg-type out-of-dialog
methods INVITE
match-value
new-value
element-rule
name checkFromUriUser
parameter-name
type uri-user
action store
match-val-type any
comparison-type pattern-rule
match-value $MANIP_PATTERN
new-value
element-rule
name rejectIfNoMatch
1-17
Chapter 1
HMR Components
parameter-name
type uri-user
action reject
match-val-type any
comparison-type boolean
match-value !$allowlistOnFrom.$checkFromUriUser
new-value 403:Forbidden
session-agent
hostname 172.16.50.101
ip-address 172.16.50.101
port 5060
realm-id peer1-core
...
manipulation-string
manipulation-pattern ^78132841([0-4][0-9])$
session-agent
hostname 172.16.50.102
ip-address 172.16.50.102
port 5060
realm-id peer2-core
...
manipulation-string
manipulation-pattern ^78132841([5-9][0-9])$
sip-manipulation
name rejectINV
description
header-rule
name from508
header-name from
1-18
Chapter 1
HMR Components
action manipulate
comparison-type case-sensitive
msg-type any
methods INVITE
match-value
new-value
element-rule
name fromUser
parameter-name
type uri-phone-number-only
action reject
match-val-type any
comparison-type case-sensitive
match-value 5085551212
new-value 401:Denied
Note:
When a SIP request matches a rule with a reject action, the rejection is immediate
and later rules aren't executed.
Note:
The reject action should not respond with a 200 OK. Instead, use a response code
in the 400, 500, or 600 range.
----------------------------------------
Apr 17 14:17:54.526 On [0:0]192.168.1.84:5060 sent to 192.168.1.60:5060
element-rule[checkRURIPort]
INVITE sip:service@192.168.1.84:5060 SIP/2.0
From: sipp <sip:+2125551212@192.168.1.60:5060>;tag=3035SIPpTag001
To: sut <sip:service@192.168.1.84>
Contact: sip:sipp@192.168.1.60:5060
1-19
Chapter 1
Using Regular Expressions
Note:
An understanding of regex is required for successful HMRs. Refer to
Mastering Regular Expressions from O'Reily Media for more information.
Oracle's SBC supports the standardized regular expression format called Portable
Operating System Interface (POSIX) Extended Regular Expressions. The SBC regex
engine is a traditional regex-directed (NFA) type.
sip-manipulation
name rem_telPAU
description
header-rule
name modPAU
header-name P-Associated-URI
action delete
comparison-type pattern-rule
match-value ^<tel:
msg-type reply
new-value
methods REGISTER
Regex Characters
Regular expressions are used to search for patterns of text using one or more of the
following devices:
1-20
Chapter 1
Using Regular Expressions
Literal (Ordinary)
Many of the characters you can type on your keyboard are literal, ordinary characters; they
present their actual value in the pattern. For example, the regex pattern sip, is a pattern of all
literal characters, that will be matched from left to right, at each position in the input string,
until a match is found. Given an input string of <sip:me@here.com>, the regex pattern sip will
successfully match the sip, starting at the position of the s and ending at the position of the p.
But the same regex will also match sip in <sips:me@here.com> and
tel:12345;isip=192.168.0.3 because an s followed by an i followed by a p exists in both of
those as well.
Special (Metacharacters)
Some characters have special meaning. They instruct the regex function (or engine which
interprets the expressions) to treat the characters in designated ways. The following table
outlines these special characters or metacharacters.
1-21
Chapter 1
Using Regular Expressions
1-22
Chapter 1
Using Regular Expressions
Regex Tips
• Limit use of wildcards asterisk * and plus sign +.
• A character class enclosed by brackets [] is not a choice of one or more characters but
rather a choice of one and only one character in the set.
• The range 0-1000 is not the same as the range 0000-1000.
• Spaces are legal characters and will be interpreted like any other character.
Escaped Characters
SIP HMR's support for escaped characters allows for searches for values you would be
unable to enter yourself. Because they are necessary to MIME manipulation, support for
escaped characters includes:
Syntax Description
\s Whitespace
\S Non-whitespace
\d Digits
\D Non-digits
\R Any \r, \n, or \r\n
\w Word
\W Non-word
\A Beginning of buffer
\Z End of buffer
\f Form feed
\n New line
\r Carriage return
\t Tab
\v Vertical tab
1-23
Chapter 1
Using Regular Expressions
Boolean Operators
The following Boolean operators are supported:
• &, meaning AND.
• |, meaning OR.
• !, meaning NOT.
You can only use Boolean operators when the comparison type is pattern-rule and
you are evaluating stored matches. The SBC evaluates these Boolean expressions
from left to right, and does not support any grouping mechanisms that might change
the order of evaluation. For example, the SBC evaluates the expression A & B | C
(where A=true, B=false, and C=true) as follows: A & B = false; false | true = true.
Equality Operators
You can use equality operators in conjunction with string operators. You can also use
equality operators with:
• Boolean operators, as in this example: ($rule1.$0 == $rule2.$1) & $rule3.
• The !, &, and | operators.
• Variables and constant strings.
You can group them in parentheses for precedence.
Equality operators always evaluate to either true or false.
1-24
Chapter 1
Using Regular Expressions
Performance Considerations
The regex engine consumes as much of the input string as it can before it backtracks or gives
up trying, which is called greediness. Greediness can introduce errors in regex patterns and
has an effect on performance. There is usually a trade-off of efficiency versus exactness -
you should choose how exacting you need to be. Keep the following in mind in order to
lessen the effect:
• Poorly constructed regex patterns can effect the performance of regex matching for long
strings
• Search on the smallest input string possible, perform a regex search in element rules for
the specific header component type you want to match for
1-25
Chapter 1
HMR Configuration
• Test the regex pattern against long strings which do not match to evaluate the
effect on performance.
• Test a regex with a wildcard in between characters against an input string with
those characters repeated in different spots to evaluate performance
• If the input string format is fairly fixed and well-known, be explicit in the regex
rather than using wildcards
• If the regex pattern is trying to capture everything before a specific character, use
the negation of the character for the wildcard character. Note that this is true most
times, except when there is an anchor at the end.
• Use beginning-line and ending-line anchors whenever possible if you want to only
match if the pattern begins or ends as such.
• A dot . means any character, including whitespace. A wild-carded dot, such as .*
or .+, will capture/match everything until the end of line, and then it will backtrack if
there are more characters after the wildcard that need to be matched. If you don't
need to capture the things before the characters after the wildcard, don't use the
wildcard.
Additional References
To learn more about regex, you can visit the following Web site, which has information
and tutorials that can help to get you started:http://www.regular-expressions.info/.
HMR 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.
1-26
Chapter 1
HMR Configuration
ORACLE(test-pattern-rule)#
ORACLE(sip-manipulation)# header-rules
ORACLE(sip-header-rules)#
1-27
Chapter 1
HMR Configuration
Note:
The Request-URI header is identified as request-uri.
8. action—Enter the action you want applied to the header specified in the name
parameter.
The default value is none. Valid options are:
• add—Add a new header, if that header does not already exist.
• delete—Delete the header, if it exists.
• manipulate—Elements of this header will be manipulated according to the
element rules configured.
• store—Store the header.
• none—No action to be taken.
9. match-value—Enter the value to be matched (only an exact match is supported)
with a header value.
The action specified is only performed if the header value matches.
10. msg-type—Enter the message type to which this header rule applies.
INVITE,ACK,BYE
Leaving the method field empty applies the header-rule to all methods.
12. Access the element-rules configuration element.
The element-rules configuration element defines the element rules, which are
executed on those elements of the header specified by the header rule.
ORACLE(sip-header-rules)# element-rules
ORACLE(sip-element-rules)#
1-28
Chapter 1
HMR Configuration
Note:
The name parameter usage depends on the element type you enter in step
6. For uri-param, uri-user-param, and header-param it is the parameter
name to be added, replaced, or deleted. For all other types, it serves to
identify the element rule and any name can be used.
1-29
Chapter 1
HMR Configuration
Note:
Absolute values, with which you can use double quotes for clarity.
You must escape all double quotes and back slashes that are part of
an absolute value, and enclose the absolute value in double quotes.
sip:"+$TRUNK_GROUP+".$TRUNK_GROUP_CONTEXT
$ORIGINAL+acme
$ORIGINAL+"my name is john"
$ORIGINAL+"my name is \"john\""
$ORIGINAL-^781+^617
g. Type done and exit to save the rule and return to the header-rules
configuration element.
13. Type done and exit to save the rule and return to the sip-manipulation
configuration element.
1-30
Chapter 1
HMR Configuration
• any
• request
• reply
5. methods—Enter the method type on which to operate.
When you do not set the method, the SBC applies the rule across all SIP methods. Valid
values are:
• INVITE
• ACK
• CANCEL
6. comparison-type—Enter the way in which the SBC will process match rules against SIP
headers.
The default is refer-case-sensitive. The valid values are:
• boolean
• refer-case-sensitive
• pattern-rule
• case-sensitive
• case-insensitive
7. action—Enter the action to perform on the SIP header.
The default value is none. The valid values are:
• add
• delete
• manipulate
• store
• none
Note:
Remember that you should enter rules with the action type store before you
enter rules with other types of actions.
If the action type is set to store, the SBC treats the match value as a regular expression.
As a default, the regular expression used for the match value is .+ (which indicates a
match value of at least one character), unless you set a more specific regular expression
match value.
8. match-value—Enter the value to match against the header value.
The SBC matches these against the entire SIP header value. This is where you can enter
values to match using regular expressions. Your entries can contain Boolean operators.
When you configure HMR (using SIP manipulation rules, elements rules, etc.), you can
use escape characters to support escaping Boolean and string manipulation operators.
9. new-value—When the action parameter is set to add or to manipulate, enter the new
value that you want to substitute for the entire header value.
1-31
Chapter 1
HMR Configuration
This is where you can set stored regular expression values for the SBC to use
when it adds or manipulates SIP headers.
1-32
Chapter 1
HMR Configuration
5. match-val-type—Enter the value type that you want to match when this rule is applied.
The default value is ANY. Valid values are:
• IP
• FQDN
• ANY
6. comparison-type—Enter the way that you want SIP headers to be compared from one
of the available.
This choice dictates how the SBC processes the match rules against the SIP header
parameter/element. The default is refer-case-sensitive.
• boolean
• refer-case-sensitive
• refer-case-insensitive
• pattern-rule
7. action—Enter the action that you want this rule to perform on the SIP header parameter/
element.
The default is none. The valid rules are:
• add
• replace
• delete-element
• delete-header
• store
• none
Remember that you should enter rules with the action type store before you enter rules
with other types of actions.
When you set the action type to store, the SBC always treats the match value you enter
as a regular expression. As a default, the regular expression is uses for the match value
is .+ (which indicates a match value of at least one character), unless you set a more
specific regular expression match value.
8. match-value—Enter the value to match against the header value in SIP packets.
The SBC matches these against the value of the parameter/element. This is where you
can enter values to match using regular expression values, or stored pattern matches.
Your entries can contain Boolean operators.
9. new-value—When the action parameter is set to add or to manipulate, enter the new
value that you want to substitute for the entire header value.
This is where you can set stored regular expression values for the SBC to use when it
adds or manipulates parameters/elements.
1-33
Chapter 1
HMR Configuration
2. header-name—Enter @status-line.
Note:
Like other rule types, the Oracle Communications 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).
1-34
Chapter 1
HMR Configuration
1-35
Chapter 1
HMR Configuration
Note:
This example sets the dropResponse option to 699, where 699 is an arbitrary
code used to later match the HMR.
ORACLE(sip-interface)# select
<RealmID>:
1: realm01 172.172.30.31:5060
selection: 1
ORACLE(sip-interface)#
WARNING:
Typing the option without the plus sign will overwrite previously
configured options. To append the options to this configuration’s options
list, prepend the option with a plus sign.
1-36
Chapter 1
HMR Configuration
ORACLE(sip-header-rules)# element-rules
ORACLE(sip-element-rules)#
2. 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.
3. new-value—Enter the name of the manipulation rule you want invoked for the set.
4. Type done to save your configuration.
5. Run verify-config to detect invalid or circular references.
6. Save and activate your configuration.
2. in-manipulationid—Enter the name of the SIP header manipulation ruleset you want to
apply to inbound SIP packets.
3. out-manipulationid—Enter the name of the SIP header manipulation ruleset you want to
apply to outbound SIP packets.
1-37
Chapter 1
HMR Configuration
1-38
Chapter 1
HMR Configuration
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).
1-39
Chapter 1
Unique HMR Regex Patterns and Other Changes
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 Communications 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>
1-40
Chapter 1
Unique HMR Regex Patterns and Other Changes
Note:
In previous releases, the PCRE (Perl Compatible Regular Expression) engine used
\, to match any character, including a NUL character. The PCRE engine was
updated in 8.1 and no longer supports \,.
realm-config
identifier net200
description
addr-prefix 0.0.0.0
network-interfaces public:0
...
manipulation-pattern Lorem(.+)
sip-manipulation
name manip
description
header-rules
name headerRule
header-name Subject
action manipulate
match-value $MANIP_PATTERN
msg-type request
comparison-type pattern-rule
new-value Math
methods INVITE
1-41
Chapter 1
Unique HMR Regex Patterns and Other Changes
Reject Action
When you use this action type and a condition matching the manipulation rule arises,
the Oracle Communications Session Border Controller rejects the request (though
does not drop responses) and increments a counter.
• If the msg-type parameter is set to any and the message is a response, the
Oracle Communications Session Border Controller increments a counter to show
the intention to reject the message—but the message will continue to be
processed.
• If the msg-type parameter is set to any and the message is a request, the Oracle
Communications Session Border Controller performs the rejection and increments
the counter.
The new-value parameter is designed to supply the status code and reason phrase
corresponding to the reject. You can use the following syntax to supply this
information: status-code[:reason-phrase]. You do not have to supply the status code
and reason phrase information; by default, the system uses 400:Bad Request.
If you do supply this information, then the status code must be a positive integer
between 300 and 699. The Oracle Communications Session Border Controller then
provides the reason phrase corresponding to the status code. And if there is no reason
phrase, the system uses the one for the applicable reason class.
You can also customize a reason phrase. To do so, you enter the status code followed
by a colon (:), being sure to enclose the entire entry in quotation marks () if your
reason code includes spaces.
When the Oracle Communications Session Border Controller performs the reject
action, the current SIP manipulation stops processing and does not act on any of the
rules following the reject rule. This course of action is true for nested SIP
manipulations that might have been constructed using the sip-manip action type.
1-42
Chapter 1
Unique HMR Regex Patterns and Other Changes
About Counters
The Oracle Communications Session Border Controller tracks messages that have been
flagged for rejection using the reject action type. In the show sipd display, refer to the
Rejected Messages category; there is no distinction between requests and responses.
SNMP Support
The Oracle Communications Session Border Controller provides SNMP support for the
Rejected Messages data, so you can access this information externally. The new MIB objects
are:
apSysRejectedMessages OBJECT-TYPE
SYNTAX Counter32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Number of messages rejected by the SD due to matching
criteria."
::= { apSysMgmtMIBGeneralObjects 18 }
apSysMgmtRejectedMesagesThresholdExeededTrap NOTIFICATION-TYPE
OBJECTS { apSysRejectedMessages }
STATUS current
DESCRIPTION
" The trap will be generated when the number of rejected messages
exceed the configured threshold within the configured window."
::= { apSystemManagementMonitors 57 }
1-43
Chapter 1
Unique HMR Regex Patterns and Other Changes
apSysMgmtRejectedMessagesGroup OBJECT-GROUP
OBJECTS {
apSysRejectedMessages
}
STATUS current
DESCRIPTION
"Objects to track the number of messages rejected by
the SD."
::= { apSystemManagementGroups 18 }
apSysMgmtRejectedMessagesNotificationsGroup NOTIFICATION-GROUP
NOTIFICATIONS {
apSysMgmtRejectedMesagesThresholdExeededTrap
}
STATUS current
DESCRIPTION
"Traps used for notification of rejected messages"
::= { apSystemManagementNotificationsGroups 26 }
apSmgmtRejectedMessagesCap
AGENT-CAPABILITIES
PRODUCT-RELEASE "Acme Packet SD"
STATUS current
DESCRIPTION "Acme Packet Agent Capability for
enterprise
system management MIB."
SUPPORTS APSYSMGMT-MIB
INCLUDES {
apSysMgmtRejectedMessagesGroup,
apSysMgmtRejectedMessagesNotificationsGroup
}
::= { apSmgmtMibCapabilities 37 }
Log Action
When you use this action type and a condition matching the manipulation rule arises,
the Oracle Communications Session Border Controller logs information about the
current message to a separate log file. This log files will be located on the same core
in which the SIP manipulation occurred. On the core where sipt runs, a logfile called
matched.log will appear when this action type is executed.
The matched.log file contains a timestamp, received and sent Oracle Communications
Session Border Controller network interface, sent or received IP address:port
information, and the peer IP address:port information. It also specifies the rule that
triggered the log action in this syntax: rule-type[rule:name]. The request URI, Contact
header, To Header, and From header are also present.
----------------------------------------
Apr 17 14:17:54.526 On [0:0]192.168.1.84:5060 sent to 192.168.1.60:5060
element-rule[checkRURIPort]
INVITE sip:service@192.168.1.84:5060 SIP/2.0
From: sipp <sip:+2125551212@192.168.1.60:5060>;tag=3035SIPpTag001
To: sut <sip:service@192.168.1.84>
Contact: sip:sipp@192.168.1.60:5060
1-44
Chapter 1
Unique HMR Regex Patterns and Other Changes
Removal of Restrictions
The following restrictions related to HMR have been removed in Release S-C6.2.0:
• The action find-replace-all now executes all element rules. Previously, no child rules
were executed.
• The action sip-manip now executes existing all element rules. Previously, no child rules
were executed.
• The action store now executes existing all element rules. Previously, only child rules with
the store action were executed.
• The action add now executes existing all element rules. Previously, only child rules with
the add action were executed.
1-45
Chapter 1
MIME Support
MIME Support
You can manipulate MIME types in SIP message bodies. You can manipulate the body
of SIP messages or a specific content type and you can change the MIME attachment
of a specific type within the body by using regular expressions. You search for a
particular string and the replacement of all matches for that type using a find-replace-
all action.
Note:
The find-replace-all action can consume more system resources than other
HMR types of action. Use this powerful action type only when another action
cannot perform the type of manipulation you require.
1-46
Chapter 1
MIME Support
Use subgroups to replace portions of the regular expression rather than the entire matched
expression. The subgroup replacement syntax is formed by adding the string [[:n:]] to the
end of the regular expression—where n is a number between 0 and 9. For example, setting
the following parameters
action find-replace-all
match-value sip:(user)@host[[:1:]]
new-value bob
creates a new rule to replace only the user portion of the URI that searches for the regular
expression and replaces all instances of the user subgroup with the value bob.
Setting the following parameters
action find-replace-all
match-value 0
new-value 1
creates a new rule to recursively replace all the 0 digits in a telephone number with 1. With
this rule the user portion of a URI—or for any other string—with a value 1-781-308-4400
would be replaced as 1-781-318-4411.
If you leave the new-value parameter blank for find-replace-all, the SBC replaces the
matched sub-group with an empty string—an equivalent of deleting the sub-group match. You
can also replace empty sub-groups, which is like inserting a value within the second sub-
group match. For example, user()@example.com[[:1:]] with a configured new-value _bob
yields user_bob@host.com.
1-47
Chapter 1
MIME Support
MIME manipulation does not support manipulating headers in the individual MIME
attachments. For example, the SBC cannot modify the Content-Type given a portion of
a message body like this one:
--boundary-1
Content-Type: application/sdp
v=0
o=use1 53655765 2353687637 IN IP4 192.168.1.60
s=-
c=IN IP4 192.168.1.60
t=0 0
m=audio 10000 RTP/AVP 8
a=rtpmap:8 PCMA/8000/1
a=sendrecv
a=ptime:20
a=maxptime:200
2. options—Set the options parameter by typing options, a Space, the option name
stripPreambleCrlf with a plus sign.
In order to append the new options to the global SIP configuration’s options list,
you must prepend the new option with a plus sign. If you type the option without
the plus sign, you will overwrite any previously configured options.
1-48
Chapter 1
MIME Support
2. action—Enter find-replace-all.
ORACLE(sip-header-rules)# element-rules
ORACLE(sip-element-rules)#
4. action—Enter find-replace-all.
5. type—Enter mime.
1-49
Chapter 1
MIME Support
Note:
Using the delete action on a multi-part MIME string reduces a number of
bodies down to one and the SIP message remains a multi-part MIME
message with only one body part (and thereby avoids the header conflicting
with the message itself).
Note:
when you use the delete action on a multi-part MIME string that reduces a
number of bodies down to one, the SIP message remains a multi-part MIME
message with only one body part (and thereby avoids the header conflicting
with the message itself).
You identify the MIMe rule by configuring a content type that refers to the specific body
part on which to operate. For example, given a SIP Content-Type header with the
value multipart/mixed;boundary=unique-boundary-1, you would enter a content-type
value of application/sdp to manipulate specifically on the SDP portion of the SIP
message. The Oracle Communications Session Border Controller knows automatically
if it is operating on SIP messages with single or multiple body parts, and the content-
type setting applies to both kinds. And when making its comparison, the Oracle
Communications Session Border Controller matches the content-type of the body with
regard to case (case insensitive), ignoring any header parameters.
1-50
Chapter 1
MIME Support
Both for making comparisons against the body part and for new/replacement values, the
Oracle Communications Session Border Controller treats the match and new values you set
for a MIME rule as ASCII strings. Therefor, a mime rule operating on a binary body part will
yield an improper conversion of a new value with respect to the binary body part.
Within MIME rules, you configure MIME headers, which operate on the specific headers in
the match body part of the SIP message. The Oracle Communications Session Border
Controller uses the MIME header name to run a string comparison to match the specific
header in the message’s body part.
Using these rules, you can also manipulate the preamble—or the SIP message text that
follows the headers but precedes the body separator. To do so, enter the keyword
@preamble for the content type parameter in the MIME rule. Likewise you can manipulate
the epilogue—or the text that follows the last body part after the last separator—using the
keyword @epilogue.
Note that the ACLI limits character entries to 255 characters before the return character must
be entered, but MIME parts can easily exceed this 255-character size. So you might need to
enter a value larger that 255 characters. To do so, you start your entry (in the match-value or
new-value parameters) with a plus sign (+). The plus sign instructs the system to add the
string after it to the pre-existing match or new value. For the new-value parameter, the Oracle
Communications Session Border Controller checks the value immediately for validity. Be sure
that when you are appending values to a new-value that the entire expression is valid at each
point where strings are appended.
2. If you are adding this feature to an existing configuration, remember you must select the
configuration you want to edit.
ORACLE(sip-manipulation)# select
<name>:
1: name= addRemoteIP desc=
2: name= addTargetIP desc=
selection: 2
ORACLE(sip-manipulation)#
ORACLE(sip-manipulation)# mime-rules
ORACLE(sip-mime-rules)#
4. name—Enter a name for this MIME rule. This parameter is required and has no default.
1-51
Chapter 1
MIME Support
5. content-type—Enter the content type for this MIME rule. This value refers to the
specific body part in the SIP message body that is to be manipulated. For
example, given a SIP Content-Type header with the value multipart/
mixed;boundary=unique-boundary-1, you would enter a content-type value of
application/sdp to manipulate specifically on the SDP portion of the SIP
message.
To manipulate the SIP preamble or epilogue, enter the keyword @preamble or
keyword @epilogue.
6. action—Choose the type of action you want to be performed: none, add, delete,
manipulate, store, sip-manip, find-replace-all, reject, log and monitor. These
are the same actions you can select when configuring SIP header manipulation.
The default is none.
7. comparison-type—Enter the way that you want body part of the SIP message to
be compared. This choice dictates how the Oracle Communications Session
Border Controller processes the match rules against the SIP header. the default is
case-sensitive. The valid values are: case-sensitive, case-insensitive,
boolean, refer-case-sensitive, refer-case-insensitive, and pattern-rule.
8. msg-type—Enter the SIP message type on which you want the MIME rules to be
performed. Valid values are any, request, reply and out-of-dialog. The default
value is any.
9. methods—Enter the list of SIP methods to which the MIME rules applies. There is
no default for this parameter.
10. match-value—Enter the value to match against the body part in the SIP message.
This is where you can enter values to match using regular expression values. Your
entries can contain Boolean operators.
11. new-value—When the action parameter is set to add or to manipulate, enter the
new value that you want to substitute.
To configure MIME headers for performing HMR operations on specific headers in
the matched body part of the SIP message:
12. Follows Steps 1 through 4 above.
ORACLE(sip-mime-rules)# mime-header-rules
ORACLE(sip-mime-header-rules)#
14. name—Enter a name for this MIME header rule. This parameter is required and
has no default.
15. mime-header—Enter the value to be used for comparison with the specific header
in the body part of the SIP message. There is no default for this parameter.
16. action—Choose the type of action you want to be performed: none, add, store,
sip-manip, replace, find-replace-all, delete,log,monitor and reject. The default
is none.
17. comparison-type—Enter the way that you want the header in the body part of the
SIP message to be compared. This choice dictates how the Oracle
Communications Session Border Controller processes the match rules against the
SIP header. the default is case-sensitive. The valid values are: case-sensitive,
case-insensitive, boolean, refer-case-sensitive, refer-case-insensitive, and
pattern-rule.
1-52
Chapter 1
MIME Support
18. match-value—Enter the value to match against the header in the body part of the SIP
message. This is where you can enter values to match using regular expression values.
Your entries can contain Boolean operators.
19. new-value—When the action parameter is set to add or to manipulate, enter the new
value that you want to substitute.
20. Save your work.
The ACLI limits character entries to 255 characters before the return character must be
entered. MIME parts can easily exceed this 255-character size, so you might need to enter a
value larger that 255 characters. To do so, you start your entry with a plus sign +. The plus
sign instructs the system to add the string after it to the pre-existing match or new value. For
the new-value parameter, the SBC checks the value immediately for validity. Be sure that
when you are appending values to a new-value that the entire expression is valid at each
point where strings are appended.
Note:
Custom formats are not supported.
Within mime-isup-rule, isup-param-rule, the format field instructs the SBC how to encode
and decode the current string. The field options are hexascii, binary-ascii, ascii-string, bcd,
and number-param.
• hex-ascii—the SBC will decode the ISUP param string from its binary value in the SIP
message into a string of hexadecimal ASCII (as seen in Wireshark) before applying the
match-value. It will convert the resolved new-value from hex-ascii into binary into the
message. For example, if the received ISUP param was the binary of 0x010a, it will
convert it into the string 010a, and then apply the match-value. If the regex pattern is ^01
then it would match, as would 0a$ and ^010a$. If the new-value is 010b, then it will
1-53
Chapter 1
MIME Support
encode it into the binary 0x010b. Since this is done after resolving the new-value.
The new-value can reference a previously stored value as long as it is hex-ascii
format.
• binary-ascii— the SBC will decode the ISUP param string from its binary value
in the SIP message into a string of ones and zeros representing the individual bits.
It will convert the new-value as long as it's ones and zeros within the param. For
example, if the received ISUP param was the binary 0x010a, it will convert it into
the string 0000000100001010, and then apply the match-value. If the regex pattern
is ^.......(.) or ^.{7}(.) then in both cases it will store the 8th bit value in $1.
In this manner, the user can check, get, or set individual bits in parameters. The
new-value can be a string, reference a stored value, or be a concatenation of them
as long as it is ones and zeros after being resolved.
• ascii-string—the SBC will decode the ISUP param string from its binary value in
the SIP message into an ASCII string based on the ASCII specification and
convert the new-value back. For example, if the received ISUP param was the
binary 0x4849, it will convert it into the string HI, and then apply the match-value.
• bcd—the SBC will decode the ISUP param string from its binary value in the SIP
message into digits using the BCD variant of ISUP. For example, if the received
ISUP param was the binary 0x0123, it will convert it to the string 0123 and then
apply the match-value.
• number-param—the SBC will decode the ISUP param string from its binary value in
the SIP message into a string representation of an E.164 phone number. The
ISUP param must be in a number formatted parameter like Calling Party Number
or Called Party Number. The SBC treats the ISUP parameter as one of the
common number parameter formats: the SBC will automatically decode the correct
number of digits based on the odd/even bit in the parameter, and add a leading +
based on the Nature of Address (NoA) field being E.164 international. Similarly,
when the SBC converts the new-value back into the ISUP parameter, it will set the
odd/even bit correctly, and set the NoA field based on the existence of the leading
+ character. The string applied to match-value thus looks the same as an element-
rule of type phone-number (i.e. +12125551212). Since this format is specific to
ISUP parameters, it can only be used in isup-param-rule.
1-54
Chapter 1
MIME Support
you set the new-value parameter. And the isup-param-rule, if configured, overwrite the
default value or add a new parameter based on the defined parameter type.
It is also possible that you might supply a new-value both at the mime-isup-rule level
and at the isup-param-rule level. If you do, the new-value entry from the mime-isup-
rule is parsed into an ISUP object and the isup-param-rule operates on that object.
ORACLE(configure)# session-router
ORACLE(session-router)#
3. Type sip-manipulation and press Enter. If you are adding this feature to an existing
configuration, then remember you must select the configuration you want to edit.
ORACLE(session-router)# sip-manipulation
ORACLE(sip-manipulation)#
ORACLE(sip-manipulation)# mime-isup-rules
ORACLE(sip-mime-isup-rules)#
5. name—Enter a name for this MIME ISUP rule. This parameter is required and has no
default.
6. content-type—Enter the content type for this MIME rule. This value refers to the specific
body part in the SIP message body that is to be manipulated. For example, given a SIP
Content-Type header with the value multipart/mixed;boundary=unique-boundary-1, you
would enter a content-type value of application/sdp to manipulate specifically on the
SDP portion of the SIP message.
To manipulate the SIP preamble or epilogue, enter the keyword @preamble or keyword
@epilogue.
7. action—Choose the type of action you want to be performed: none, add, delete,
manipulate, store, sip-manip, find-replace-all, reject,log and monitor. These are the
same actions you can select when configuring SIP header manipulation. The default is
none.
8. comparison-type—Enter the way that you want body part of the SIP message to be
compared. This choice dictates how the Oracle Communications Session Border
Controller processes the match rules against the SIP header. the default is case-
sensitive. The valid values are: case-sensitive, case-insensitive, boolean, refer-case-
sensitive, refer-case-insensitive, and pattern-rule.
1-55
Chapter 1
MIME Support
9. msg-type—Enter the SIP message type on which you want the MIME rules to be
performed. Valid values are any, request, reply and out-of-dialog. The default
value is any.
10. methods—Enter the list of SIP methods to which the MIME rules applies. There is
no default for this parameter.
11. match-value—Enter the value to match against the body part in the SIP message.
This is where you can enter values to match using regular expression values. Your
entries can contain Boolean operators.
12. new-value—When the action parameter is set to add or to manipulate, enter the
new value that you want to substitute.
13. isup-spec—Specify how the Oracle Communications Session Border Controller is
to parse the binary body; valid values are the enumerated type. The values for this
parameter are these SIP ISUP formats:
• ANSI-2000 (default)—Corresponding to ANSI T1.113-2000
• ITU-99—Corresponding to ITU Q.763
14. isup-msg-type—Identify the specific ISUP message types (such as IAM and
ACM) on which to operate. The Oracle Communications Session Border Controller
uses with the msg-type parameter (which identifies the SIP message) in the
matching process. You enter values in this parameters as a list of numbers rather
than as an enumerated value because of the large number of ISUP message type,
and the range is between 0 and 255. There is no default for this parameter.
15. mime-header—Enter the value to be used for comparison with the specific header
in the body part of the SIP message. There is no default for this parameter.
To configure ISUP parameters rules:
16. Follows Steps 1 through 4 above.
ORACLE(sip-mime-isup-rules)# isup-param-rules
ORACLE(sip-isup-param-rules)#
18. name—Enter a name for this ISUP parameter rule. This parameter is required and
has no default.
19. mime-header—Enter the value to be used for comparison with the specific header
in the body part of the SIP message. There is no default for this parameter.
20. action—Choose the type of action you want to be performed: none, add, delete,
store, sip-manip, replace, find-replace-all, log, monitor and reject. The default
is none.
21. comparison-type—Enter the way that you want the header in the body part of the
SIP message to be compared. This choice dictates how the Oracle
Communications Session Border Controller processes the match rules against the
SIP header. the default is case-sensitive. The valid values are: case-sensitive,
case-insensitive, boolean, refer-case-sensitive, refer-case-insensitive, and
pattern-rule.
22. match-value—Enter the value to match against the header in the body part of the
SIP message. This is where you can enter values to match using regular
expression values. Your entries can contain Boolean operators.
1-56
Chapter 1
MIME Support
23. new-value—When the action parameter is set to add or to manipulate, enter the new
value that you want to substitute.
24. parameter-type—Using ISUP parameter mapping, enter which of the ISUP parameters
on which your want to perform manipulation. This parameter takes values between 0 and
255, and you must know the correct ISUP mapping value for your entry. The Oracle
Communications Session Border Controller calculates the offset and location of this
parameter in the body. Note that the value returned from the body does not the type or
length, only the parameter value. For example, a parameter-type value of 4 acts on the
Called Party Number parameter value.
25. parameter-format—Enter how you want to convert specific parameter to a string
representation of that value. Valid values for parameter-format are: number-param,
hex-ascii (default), binary-ascii, ascii-string, and bcd. Both match and new values are
encoded and decoded by the designated parameter-format type. In this regard, the
match-value decodes the parameters and the new-value encodes the ASCII string into
the respective binary format.
26. Save your work.
Configuration Example
This section provides an example of a SIP manipulation configuration that shows MIME rules
and MIME ISUP rules.
sip-manipulation
name manip
description
header-rule
name headerRule1
header-name Date
action add
comparison-type case-sensitive
msg-type reply
methods
match-value
new-value
element-rule
name elemRule1
parameter-name
type header-value
action add
match-val-type any
comparison-type case-sensitive
match-value
new-value "August 19, 1967"
mime-rule
name mimeRule1
Content-Type application/SDP
action manipulate
comparison-type case-sensitive
msg-type request
methods
match-value
new-value
mime-header
1-57
Chapter 1
MIME Support
name mimeHeaderRule1
mime-header-name Content-
Disposition
action add
comparison-type case-sensitive
match-value
new-value "signal;
handling=required"
mime-isup-rule
name mimeRule1
content-type application/ISUP
action manipulate
comparison-type case-sensitive
msg-type request
methods INVITE
match-value
new-value
isup-spec {ansi00, itu-92}
isup-msg-type 0 (0-256 IAM, ACM, etc.)
mime-header
name mimeHeaderRule1
mime-header-name Content-
Disposition
action add
comparison-type case-sensitive
match-value
new-value "signal;
handling=optional"
isup-param-rule
name isupRule1
parameter-type # {0-256
specific type)
parameter-format {number-
parameter, hex, binary, ascii, bcd}
action add
comparison-type case-sensitive
match-value
new-value "signal;
handling=optional"
1-58
Chapter 1
MIME Support
In addition, the system supports a variant of Header Manipulation Rules (HMR) operating on
ASCII-encoded SDP bodies, with specific element types for descriptors at both the session-
level and media-level, and the ability to apply similar logic to SDP message parts as is done
for SIP header elements.
The configuration object, mime-sdp-rules, under sip-manipulation specifically addresses the
manipulation of SDP parts in SIP messages. Just as existing header-rules are used to
manipulate specific headers of a SIP message, mime-sdp-rules will be used to manipulate
the SDP specific mime-attachment of a SIP message.
SDP Manipulation
mime-sdp-rules function in a similar fashion as header-rules. They provide
• parameters used to match against specific SIP methods and/or message types
• parameters used to match and manipulate all or specified parts of an SDP offer or
answer
• a means of comparing search strings or expressions against the entire SDP
• different action types to allow varying forms of manipulation
Since only a single SDP can exist within a SIP message, users need not specify a content-
type parameter as is necessary for a mime-rule. A mime-sdp-rule operates on the single SDP
within the SIP message. If no SDP exists with the message, one can be added. If the
message already contains a mime attachment, adding SDP results in a multipart message.
All manipulations performed against all or parts of the SDP are treated as UTF-8 ASCII
encoded text. At the parent-level (mime-sdp-rule) the match-value and new-value
parameters execute against the entire SDP as a single string.
An add action only succeeds in the absence of SDP because a message is allowed only a
single SDP offer or answer. A delete operation at the mime-sdp-rule level will remove the
SDP entirely.
Note that on an inbound sip-manipulation, SDP manipulations interact with the Oracle
Communications Session Border Controller codec-policy. SDP manipulations also interact
with codec reordering and media setup. It is very possible to make changes to the SDP such
that the call can not be setup due to invalid media parameters, or settings that will affect the
ability to transcode the call. Consequently, user manipulation of the SDP can prove risky, and
should be approached with appropriate caution.
Three configuration-objects, sdp-session-rule, sdp-media-rule, and mime-header-rule, exist
under the mime-sdp-rule. These objects provide finer grained control of manipulating parts of
the SDP.
sdp-session-rule
An sdp-session-rule groups all SDP descriptors, up until the first media line, into a single
entity, thus allowing the user to perform manipulation operations on a session-specific portion
of the SDP.
Like the mime-sdp-rule, all match-value and new-value operations performed at this level are
executed against the entire session group as a complete string. Given the sample SDP
1-59
Chapter 1
MIME Support
v=0
o=mhandley 2890844526 2890842807 IN IP4 126.16.64.4
s=SDP Seminar
i=A Seminar on the session description protocol
u=http://www.cs.ucl.ac.uk/staff/M.Handley/sdp.03.ps
e=mjh@isi.edu (Mark Handley)
c=IN IP4 224.2.17.12/127
t=2873397496 2873404696
a=recvonly
m=audio 49170 RTP/AVP 0
m=video 51372 RTP/AVP 31
m=application 32416 udp wb
a=orient:portrait
sdp-media-rule
An sdp-media-rule groups all of the descriptors that are associated with a specific
media-type into single entity, thus allowing the user to perform manipulation operations
on a media-specific portion of the SDP. For example, a user can construct an sdp-
media-rule to change an attribute of the audio media type.
Like a mime-sdp-rule, all match-value and new-value operations performed at this
level are executed against the entire media-group as a complete string. Given the
sample SDP below, if a media-level-descriptor is configured to operate against the
application group, the match-value and new-values would operate only on designated
portion.
v=0
o=mhandley 2890844526 2890842807 IN IP4 126.16.64.4
s=SDP Seminar
i=A Seminar on the session description protocol
u=http://www.cs.ucl.ac.uk/staff/M.Handley/sdp.03.ps
e=mjh@isi.edu (Mark Handley)
c=IN IP4 224.2.17.12/127
t=2873397496 2873404696
a=recvonly
m=audio 49170 RTP/AVP 0
m=video 51372 RTP/AVP 31
m=application 32416 udp wb
a=orient:portrait
1-60
Chapter 1
MIME Support
v=0
o=mhandley 2890844526 2890842807 IN IP4 126.16.64.4
c=IN IP4 224.2.17.12/127
t=2873397496 2873404696
m=audio 49170 RTP/AVP 0
m=audio 48324 RTP/AVP 8
m=video 51372 RTP/AVP 31
sdp-media-rule
name smr
media-type audio[1]
action manipulate
comparison-type case-sensitive
match-value
new-value "m=audio 1234 RTP/AVP 8 16"
This rule operates on the 2nd audio line, changing the port and adding another codec,
resulting in the SDP:
v=0
o=mhandley 2890844526 2890842807 IN IP4 126.16.64.4
c=IN IP4 224.2.17.12/127
1-61
Chapter 1
MIME Support
t=2873397496 2873404696
m=audio 49170 RTP/AVP 0
m=audio 1234 RTP/AVP 8 16
m=video 51372 RTP/AVP 31
sdp-media-rule
name smr
media-type media[1]
action add
comparison-type case-sensitive
match-value
new-value "m=video 1234 RTP/AVP 45"
adds a new video media-type at the 2nd position of all media-lines, resulting in the
SDP:
v=0
o=mhandley 2890844526 2890842807 IN IP4 126.16.64.4
c=IN IP4 224.2.17.12/127
t=2873397496 2873404696
m=audio 49170 RTP/AVP 0
m=video 1234 RTP/AVP 45
m=audio 48324 RTP/AVP 8
m=video 51372 RTP/AVP 31
sdp-line-rule
Unlike header-rules, sdp descriptors are not added in the order in which they are
configured. Instead they are added to the SDP adhering to the grammar defined by
RFC 4566 (as is shown below).
Session description
v= (protocol version)
o= (originator and session identifier)
s= (session name)
i=* (session information)
u=* (URI of description)
e=* (email address)
p=* (phone number)
c=* (connection information -- not required if included in
all media)
b=* (zero or more bandwidth information lines)
One or more time descriptions ("t=" and "r=" lines; see
below)
z=* (time zone adjustments)
k=* (encryption key)
a=* (zero or more session attribute lines)
Zero or more media descriptions (see below)
Time description
t= (time the session is active)
1-62
Chapter 1
MIME Support
v=0
o=mhandley 2890844526 2890842807 IN IP4 126.16.64.4
s=SDP Seminar
i=A Seminar on the session description protocol
u=http://www.cs.ucl.ac.uk/staff/M.Handley/sdp.03.ps
e=mjh@isi.edu (Mark Handley)
c=IN IP4 224.2.17.12/127
t=2873397496 2873404696
r=604800 3600 0 90000
r=7d 1h 0 25h
a=recvonly
m=audio 49170 RTP/AVP 0
m=video 51372 RTP/AVP 31
m=application 32416 udp wb
a=orient:portrait
sdp-line-rule
name removeRepeatInterval
type r[1]
action delete
1-63
Chapter 1
MIME Support
The rule removeRepeatInterval removes the second repeat interval descriptor within
the SDP.
The behavior of all SDP rules follow the same behavior of all manipulation rules in that
they are executed in the order in which they are configured and that each rule
executes on the resultant of the previous rule.
Each descriptor follows its own grammar and rules depending on the type specified.
The values of the descriptor are evaluated at runtime since the new-values themselves
are evaluated at runtime. At this time no validation of the grammar for each of the
types is performed. The user is responsible for properly formatting each of the
descriptors according to their specifications.
For instance, the version (v) descriptor can be removed from the SDP but leaving all
descriptors for that SDP, causing the SDP to become invalid. This is consistent with
the way header-rules operate, in that there is no validation for the specific headers
once they have been manipulated through HMR.
([^\\]|^)\{\$[^0-9]+[^}]*\}
The example below demonstrates using a user defined variable within a regular
expression of another rule at runtime.
element-rule
name someRule
type header-value
action replace
comparison-type pattern-rule
match-value ^sip:{$rule1.$0}@(.+)$
new-value sip:bob@example.com
If the value of $rule1.$0 evaluates to alice then it will successfully match against the
string sip:alice@comcast.net. An interpolated expression can be as simple as
“{$rule1.$0}” or as complex as ^sip:{rule1.$0}@{$rule2[1].$2}$. It is not possible to
interpolate a normal regular expression since the grammar will not allow the user to
enter such an expression. Only variables can be contained with the curly braces.
1-64
Chapter 1
MIME Support
The resultant of interpolated expressions can be stored in user defined variables. Given the
same example from above, if the rule someRule was referenced by another rule, the value of
sip:alice@comcast.net would be stored within that rule.
Interpolation only makes a single pass at interpolation, but does so every time the Rule
executes. In other words, if the Rule is applied to the Route header, it will interpolate again for
each Route header instance. What this means is that the value within the curly braces will
only be evaluated once. For instance, if the value {$someRule.$1} evaluates to {$foobar.$2}
the SBC will treat $foobar.$2 as a literal string which it will compile as a regular expression.
The SBC will not recursively attempt to evaluate $foobar.$2, even if it was a valid user
defined variable.
Interpolated regular expressions will evaluate to TRUE if and only if both the regular
expression itself can be compiled and it successfully matches against the compared string.
You cannot use both interpolated expressions and number quantifiers like {3,5} in the same
match-value. When interpolated expressions are evaluated, the brackets around the number
quantifiers will be removed, leaving the literal string 3,5. For example, if $someRule.$1
resolves to a literal string 101, then a match-value of ^[0-9]{3,5} RTP.* {$someRule.$1}
will resolve to ^[0-9]3,5 RTP.* 101, which will not match any number 3 to 5 times.
mime-rule
name someMimeRule
content-type application/text
action replace
comparison-type pattern-rule
match-value ^every good boy .*
new-value every good girl does fine
However, regular expressions can not be used in conjunction with other
boolean expressions to form more complex boolean expressions, as is shown
below.
mime-rule
name someMimeRule
content-type application/text
action replace
comparison-type boolean
match-value $someRule & ^every good boy .*
new-value every good girl does fine
There are many cases where the user has the need to compare some value as a regular
expression in conjunction with another stored value. It is possible to perform this behavior
today, however it requires an extra step in first storing the value with the regular expression,
followed by another Manipulation Rule which compares the two boolean expressions together
(e.g. $someRule & $someMimeRule).
In order to simplify the configuration of some sip-manipulations and to make them more
efficient this functionality is being added.
Unfortunately, it is not possible to just use the example as is shown above. The problem is
there are many characters that are commonly used in regular expressions that would confuse
1-65
Chapter 1
MIME Support
the HMR expression parser (such as $, and +). Therefore delimiting characters need
to be used to separate the regular expression from the other parts of the expression.
To treat a regular expression as a boolean expression, it needs to be enclosed within
the value $REGEX(<expression>,<compare_string>=$ORIGINAL); where
<expression> is the regular expression to be evaluated. <compare_string> is the string
to compare against the regular expression. This second argument to the function is
defaulted to $ORIGINAL which is the value of the of the specific Manipulation Rule
object. It can be overridden to be any other value the user desires.
The proper configuration for the example above to use regular expressions as boolean
expressions is
mime-rule
name someMimeRule
content-type application/text
action replace
comparison-type boolean
match-value $someRule & $REGEX(“^every good boy .*”)
new-value every good girl does fine
header-rule
name checkPAU
header-name request-uri
action reject
comparison-type boolean
match-value (!$REGEX($rule1[0],$FROM_USER))&
(!$REGEX($rule2[0],$PAI_USER))
msg-type request
new-value 403:Forbidden
methods INVITE,SUBSCRIBE,MESSAGE,PUBLISH,
OPTIONS, REFER
It should be noted that when using $REGEX() in a boolean expression, the result of
that expression is not stored in the user variable. The comparison-type must be set to
pattern-rule in order to store the result of a regular expression.
The arguments to the $REGEX() function are interpolated by default. This is the case
since the arguments themselves must be evaluated at runtime. The following example
is also valid.
mime-rule
name someMimeRule
content-type application/text
action replace
comparison-type boolean
match-value $someRule & $REGEX(“^every good
{$rule1[0].$0} .*”)
1-66
Chapter 1
MIME Support
ORACLE(sip-mime-sdp-rules)# move
select a rule to move
1-67
Chapter 1
MIME Support
selection: 2
destination: 1
Rule moved from position 2 to position 1
ACMEPACKET(sip-mime-sdp-rules)#
Remove SDP
sip-manipulation
name stripSdp
description remove SDP from SIP message
mime-sdp-rule
name sdpStrip
msg-type request
methods INVITE
action delete
comparison-type case-sensitive
match-value
new-value
1-68
Chapter 1
MIME Support
action manipulate
comparison-type case-sensitive
match-value
new-value
sdp-media-rule
name removeVideo
media-type video
action delete
comparison-type case-sensitive
match-value
new-value
Add SDP
sip-manipulation
name addSdp
description add an entire SDP if one does
not exist
mime-sdp-rule
name addSdp
msg-type request
methods INVITE
action add
comparison-type case-sensitive
match-value
new-value “v=0\r\no=mhandley
2890844526 2890842807 IN IP4 “+$LOCAL_IP+”\r\ns=SDP Seminar\r\ni=A
Seminar on the session description protocol\r\nu=http:
//www.cs.ucl.ac.uk/staff/M.Handley/sdp.03.ps\r\ne=mjh@isi.edu
(Mark Handley)\r\nc=IN IP4 “+$LOCAL_IP+”\r\nt=2873397496
2873404696\r\na=recvonly\r\nm=audio 49170 RTP/AVP 0\r\n”
Manipulate Contacts
This rule changes the contact in the SDP to the value contained in the Contact header.
sip-manipulation
name changeSdpContact
description changes the contact in the SDP to the
value of the contact header
header-rule
name storeContact
header-name Contact
action store
comparison-type pattern-rule
msg-type request
methods INVITE
match-value
new-value
element-rule
name storeHost
parameter-name
type uri-host
1-69
Chapter 1
MIME Support
action store
match-val-type ip
comparison-type pattern-rule
match-value
new-value
mime-sdp-rule
name changeConnection
msg-type request
methods INVITE
action manipulate
comparison-type case-sensitive
match-value
new-value
sdp-session-rule
name changeCLine
action manipulate
comparison-type case-sensitive
match-value
new-value
sdp-line-rule
name updateConnection
type c
action replace
comparison-type case-sensitive
match-value $storeContact.$storeHost
new-
value $storeContact.$storeHost.$0
Remove a Codec
This rule changes the contact in the SDP to the value contained in the Contact header.
sip-manipulation
name removeCodec
description remove G711 codec if it exists
mime-sdp-rule
name removeCodec
msg-type request
methods INVITE
action manipulate
comparison-type case-sensitive
match-value
new-value
sdp-media-rule
name removeG711
media-type audio
action manipulate
comparison-type case-sensitive
match-value
new-value
sdp-line-rule
name remove711
type m
action replace
1-70
Chapter 1
MIME Support
comparison-type pattern-rule
match-value ^(audio [0-9]
{1,5} RTP.*)( [07]
\b)(.*)$
new-value $1+$3
sdp-line-rule
name stripAttr
type a
action delete
comparison-type pattern-rule
match-value ^(rtpmap|fmtp):
[07]\b$
new-value
Change Codec
sip-manipulation
name convertCodec
description changeG711toG729
mime-sdp-rule
name changeCodec
msg-type request
methods INVITE
action manipulate
comparison-type case-sensitive
match-value
new-value
sdp-media-rule
name change711to729
media-type audio
action manipulate
comparison-type case-sensitive
match-value
new-value
sdp-line-rule
name change711
type m
action replace
comparison-type pattern-rule
match-value ^(audio [0-9]{4,5}
RTP/AVP.*)( 0)(.*)$
new-value $1+” 18”+$3
sdp-line-rule
name stripAttr
type a
action delete
comparison-type pattern-rule
match-value ^rtpmap:0 PCMU/
.+$
new-value
sdp-line-rule
name addAttr
type a
action add
1-71
Chapter 1
MIME Support
comparison-type boolean
match-value $change711to729.
$stripAttr
new-value rtpmap:18
G729/8000
1-72
Chapter 1
HMR Import-Export
HMR Import-Export
Due to the complexity of SIP manipulations rules and the deep understanding of system
syntax they require, it is often difficult to configure reliable rules. This feature provides support
1-73
Chapter 1
HMR Import-Export
for importing and exporting pieces of SIP manipulation configuration in a reliable way
so that they can be reused.
Exporting
The SIP manipulation configuration contains an export command which sends the
previously selected configuration to the designated file. The syntax is export
[FILENAME]. The system compresses the file with gzip and writes it to the /code/
imports directory.
Note:
SIP manipulation configurations can only be exported one at a time.
To avoid conflicts when importing, the key and object ID are not included as part of the
exported XML.
Importing
The import command imports data from a previously exported file into the currently-
selected configuration. If no configuration was selected, a new one is created. The
syntax is import [FILENAME]. Include the .gz extension in the filename. After
importing, type done to save the configuration.
Importing a configuration with the same key as one that already exists returns an error.
In this case:
• Delete the object with the same key and re-import.
• Select the object with the same key and perform an import that will overwrite it with
new data.
1-74
Chapter 1
HMR Development
Removing Files
Using the delete-import command with the name of the file you want to delete removes it
from the system. Using this command, you can delete files that are no longer useful to you.
Carrying out this command is final and there is no warning before you go ahead with the
deletion. A failed deletion (for instance, because there is no such file) will produce an error
message; a successful deletion simply returns you to the system prompt.
HMR Development
Before you start developing an HMR, ask yourself whether you need an HMR. Check
whether an alternative is available. For example, you can configure the SBC to perform some
of the more common needed message manipulations like stripping telephone events from
SDP or resolving delayed offer issues. If you need more flexibility to address your problem,
then HMR is probably the answer.
Development Overview
Once you have decided you want to use HMR to resolve an issue, Oracle recommends you
follow this development procedure:
1. Understand regex. Your knowledge of regex is fundamental to building an HMR that
yields the desired result.
2. Identify the direction of the traffic in relation to the SBC to which you want to apply an
HMR (inbound or outbound).
3. Identify the SIP message portion on which you want the HMR to operate: header,
parameter, or body.
4. Identify the remote entities involved and know their represented in your SBC
configuration. Are they session agents, realms or SIP interfaces? Take into consideration
the order of precedence among these entities for applying HMRs.
5. Build the HMR and test it using the SBC's Testing SIP Manipulations.
6. Apply the HMR appropriately to your configuration. Oracle recommends that you develop,
test, and apply HMRs in test or laboratory environments only.
7. Analyze the data resulting from your HMR to confirm it is working as you intend.
Development Tips
• Define all storage rules first. Each subsequent header rule processes against the same
SIP message, so each additional header rules works off of the results from the
application of the rule that precedes it.
In general, you want to store values from the original SIP header rather than from the
iteratively changed versions.
1-75
Chapter 1
HMR Development
• Implement rules at the element rule rather than the header rule level. Header rules
should only be a container for element rules.
• Add additional element rules to modify a single header. Do not create multiple
header rules, each with one element rule. Instead, create multiple element rules
within a header rule.
• Think of performance. Reuse as many built in variables as possible
• Avoid lengthy string matches unless absolutely necessary
• Wherever possible, constrain your HMR appropriately by specifying a SIP method
and message type
• Build an HMR library
Planning Considerations
You want to plan your functionality carefully when developing HMRs and you want to
test it thoroughly before deploying it on your production system.
Traffic Direction
You need to determine if you want changes to occur on traffic that is relative to the
SBC inbound or outbound.
1-76
Chapter 1
HMR Development
The count for referencing is zero-based, meaning that the first instance of the header counts
as 0.
Note:
You cannot use a trailing [<index>] value after the header name to insert headers
into a specific location. Headers are added to the end of the list, except that Via
headers are added to the top.
HMR Sets
Although the SBC has a set method for how certain manipulation rules take precedence over
others; you can use multiple SIP HMR sets to
• Apply multiple inbound and outbound manipulations rules to a SIP message
• Provision the order in which the SBC applies HMRs
You cause the header rule in one HMR to invoke another HMR. Values from that invoked
HMR for the match value, comparison type, and methods are then supported. The invoked
HMR is performed when those values are true.
Create Pseudocode
You start with a high-level design, refine the design to pseudocode, and then refine the
pseudocode to source code. This successive refinement in small steps allows you to check
your design as you drive it to lower levels of detail. The result is that you catch high level
errors at the highest level, mid-level errors at the middle level, and low-level errors at the
lowest level -- before any of them becomes a problem or contaminates work at more detailed
levels.
Test HMRs
Test methodologies include:
• Wireshark traces to create SIPp scripts
• test-pattern-rule to test pattern matches from the ACLI
• test-sip-manipulation available through the ACLI
• log.sipd messages
test-sip-manipulation
You can use a tool that allows you to test the outcome of your SIP manipulation and header
rules without sending real traffic through the SBC to see if they work.
To use the tool, you enter the ACLI's test-sip-manipulation utility and reference the rule you
want to test using its name. Then you enter a mode where you put in a SIP message entered
in ASCII. You can cut and paste this message from sipmsg.log or from some other location.
Using <Ctrl-D> stops the SIP message collection and parses it.
The test informs you of any parsing errors found in the SIP message. Once the message is
entered, you can execute the SIP manipulation against the message. The output after this
1-77
Chapter 1
HMR Development
step is the modified SIP message after manipulations have been applied. You will also
find a debugging option, which displays SIP manipulation logging to the screen as the
manipulation takes place.
As a starting point for testing, this tool comes loaded with a default SIP message. It
cannot be associated with realms, session agents, or SIP interfaces, and so it also
comes with certain resolves reserved words, such
as: $LOCAL_IP, $TRUNK_GROUP_CONTEXT, and $REMOTE_PORT. In addition, you can use
your settings for testing across terminal sessions; if you choose to save your settings,
everything (including the SIP message) will be saved, with the exception of the
debugging option.
It is not recommended that you use this tool to add an ISUP message body.
Development Example
You want to perform specialized call routing for x11 numbers, such as 211, 311, 411
and so on, based on from where the call originated. You want to concatenate the user
part of the To URI with the seven digits following the +1 in the user part of the From
URI and to swap that value in the user part of the Request URI:
Note:
• To user-uri: 211
• From user-uri: +14167601262
• Desired Request-URI: 2114167601
1-78
Chapter 1
HMR Development
Note:
• A $ was used to denote the end of the string. Using a carriage return line feed
\r\n will not result in matches.
• $0 is the entire string being matched against.
• $1 is the string represented in the first set of parentheses. Here, $1 matches the
desired output so the regular expression is correct.
1-79
Chapter 1
HMR Development
element-rule
name constructRURI
parameter-name
type uri-user
action replace
match-val-type any
comparison-type pattern-rule
match-value
new-
value $RURI_USER.$0+$getFromURIDigits.$getDigits.$1
Note:
$RURI_USER.$0+$getFromURIDigits.$getDigits.$1
Concatenate the two and replace the uri-user of the R-URI. The plus sign (+)
serves as the concatenation operator when the comparison-type is pattern-
rule. Only the $1 from the second ruleset is used because it represents just
the subset of the From digits needed.
You might want to edit the Content-Length value default value of 276 or to remove the
header. Retaining that value causes test-sip-manipulation to transmit only the first 276
characters of the loaded SIP message.
Configuring Testing
Test Sip Manipulation:
sip-manipulation : ConstructRURI
debugging : enabled
direction : out
manipulation-string :
manipulation-pattern : \,+
tgrp-context :
local-ip : 192.168.1.60:5060
remote-ip : 192.168.1.61:5060
sip-message : parsed OK
Executing Testing
(test-sip-manipulation)# execute
Header Rule ConstructRURI (headerName=request-uri action=manipulate
cmpType=pattern-rule) does not apply to method INVITE
After Manipulation[ConstructRURI]
1-80
Chapter 1
Configuration Examples
Configuration Examples
This section shows you several configuration examples for HMR. This section shows the
configuration for the various rules that the Oracle Communications Session Border
Controllerapplied, and sample results of the manipulation. These examples present
configurations as an entire list of fields and settings for each ruleset, nested header rules and
nested element rules. If a field does not have any operation within the set, the field is shown
with the setting at the default or blank.
sip-manipulation
name removeHeader
header-rule
name removeCustom
header-name Custom
action delete
comparison-type boolean
match-value ^This is my.*
msg-type request
new-value
methods INVITE
header-rule
name goodByeHeader
header-name Goodbye
action store
comparison-type boolean
match-value ^Remove (.+)
msg-type request
new-value
methods INVITE
header-rule
name goodBye
1-81
Chapter 1
Configuration Examples
action delete
comparison-type pattern-rule
match-value $goodByeHeader
msg-type request
new-value
methods INVITE
sip-manipulation
name CustomerTgid
header-rule
name ruriRegex
header-name request-uri
action store
comparison-type pattern-rule
match-value
msg-type request
new-value
methods INVITE
element-rule
name tgidParam
parameter-name tgid
type uri-param
action store
match-val-type any
comparison-type pattern-rule
1-82
Chapter 1
Configuration Examples
match-value
new-value
header-rule
name addCustomer
header-name X-Customer-Profile
action add
comparison-type pattern-rule
match-value $ruriRegex.$tgidParam
msg-type request
new-value $ruriRegex.$tgidParam.$0
methods INVITE
header-rule
name delTgid
header-name request-uri
action manipulate
comparison-type pattern-rule
match-value $ruriRegex.$tgidParam
msg-type request
new-value
methods INVITE
element-rule
name tgidParam
parameter-name tgid
type uri-param
action delete-element
match-val-type any
comparison-type case-sensitive
match-
value $ruriRegex.$tgidParam.$0
new-value
1-83
Chapter 1
Configuration Examples
sip-manipulation
name modCustomHdr
header-rule
name customSearch
header-name Custom
action store
comparison-type pattern-rule
match-value (This is my )(.+)
( header)
msg-type request
new-value
methods INVITE
header-rule
name customMod
header-name Custom
action manipulate
comparison-type pattern-rule
match-value $customSearch
msg-type request
new-value
methods INVITE
element-rule
name hdrVal
parameter-name hdrVal
type header-value
action replace
match-val-type any
comparison-type case-sensitive
match-value
new-value $customSearch.$1+edited+$customSearch.$3
1-84
Chapter 1
Configuration Examples
sip-manipulation
name storeElemParam
header-rule
name Frohmr
header-name From
action store
comparison-type case-sensitive
match-value
msg-type request
new-value
methods INVITE
element-rule
name elementRule
parameter-name tag
type uri-param
action store
match-val-type any
comparison-type case-sensitive
match-value
new-value
header-rule
name newHeader
header-name FromTag
action add
comparison-type pattern-rule
match-value $FromHR.$elementRule
msg-type any
new-value $FromHR.$elementRule.$0
methods
1-85
Chapter 1
Configuration Examples
Call-ID: SDf1re601-f85059e74e1b443499587dd2dee504c2-06a3gu0
CSeq: 1 INVITE
Contact: <sip:sipp@192.168.200.61:5060;transport=udp>
Goodbye: Remove Me
Custom: This is my custom header
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
FromTag: 1
sip-manipulation
name modDisplayParam
header-rule
name storeDisplay
header-name Display
action store
comparison-type case-sensitive
match-value
msg-type request
new-value
methods INVITE
element-rule
name displayName
parameter-name display
type uri-display
action store
match-val-type any
comparison-type pattern-rule
match-value (s)(ip)(p )
new-value
header-rule
name modDisplay
header-name Display
action manipulate
comparison-type case-sensitive
match-value
msg-type request
new-value
methods INVITE
element-rule
1-86
Chapter 1
Configuration Examples
name modRule
parameter-name display
type uri-display
action replace
match-val-type any
comparison-type pattern-rule
match-
value $storeDisplay.$displayName
new-
value $storeDisplay.$displayName.$1+lur+$storeDisplay.$d
isplayName.$3
header-rule
name modFrom
header-name From
action manipulate
comparison-type pattern-rule
match-value
msg-type request
new-value
methods INVITE
element-rule
name fromDisplay
parameter-name
type uri-display
action replace
match-val-type any
comparison-type pattern-rule
match-value sipp
new-value "\"abc 123\" "
1-87
Chapter 1
Configuration Examples
sip-manipulation
name elemParams
header-rule
name StoreDisplay
header-name Display
action store
comparison-type case-sensitive
match-value
msg-type request
new-value
methods INVITE
element-rule
name displayName
parameter-name
type uri-display
action store
match-val-type any
comparison-type pattern-rule
match-value
new-value
element-rule
name userName
parameter-name user
type uri-user
action store
match-val-type any
comparison-type pattern-rule
match-value
new-value
element-rule
name uriParam
parameter-name up
type uri-param
action store
1-88
Chapter 1
Configuration Examples
match-val-type any
comparison-type pattern-rule
match-value
new-value
element-rule
name headerParam
parameter-name hp
type header-param
action store
match-val-type any
comparison-type pattern-rule
match-value
new-value
header-rule
name EditParams
header-name Params
action manipulate
comparison-type case-sensitive
match-value
msg-type request
new-value
methods INVITE
element-rule
name addHeaderParam
parameter-name display
type header-param
action add
match-val-type any
comparison-type case-sensitive
match-value
new-
value $StoreDisplay.$displayName.$0
element-rule
name addUriParam
parameter-name user
type uri-param
action add
match-val-type any
comparison-type case-sensitive
match-value
new-value
$StoreDisplay.$userName.$0
header-rule
name EditDisplay
header-name Display
action manipulate
comparison-type case-sensitive
match-value
msg-type request
new-value
methods INVITE
element-rule
name replaceUriParam
parameter-name up
type uri-param
1-89
Chapter 1
Configuration Examples
action replace
match-val-type any
comparison-type pattern-rule
match-
value $StoreDisplay.$uriParam
new-value def
element-rule
name delHeaderParam
parameter-name hp
type header-param
action delete-element
match-val-type any
comparison-type pattern-rule
match-value $StoreDisplay.$headerParam
new-value
sip-manipulation
name Params
header-rule
name storeParams
header-name Params
1-90
Chapter 1
Configuration Examples
action store
comparison-type case-sensitive
match-value
msg-type request
new-value
methods INVITE
element-rule
name storeUserName
parameter-name user
type uri-user
action store
match-val-type any
comparison-type case-sensitive
match-value
new-value
header-rule
name modEdit
header-name Edit
action manipulate
comparison-type pattern-rule
match-value
msg-type request
new-value
methods INVITE
element-rule
name addParam1
parameter-name c1
type uri-param
action add
match-val-type any
comparison-type case-sensitive
match-value
new-
value $storeParams[0].$storeUserName.$0
element-rule
name addParam2
parameter-name c2
type uri-param
action add
match-val-type any
comparison-type case-sensitive
match-value
new-
value $storeParams[1].$storeUserName.$0
1-91
Chapter 1
Configuration Examples
CSeq: 1 INVITE
Contact: <sip:sipp@192.168.200.61:5060;transport=udp>
Goodbye: Remove Me
Custom: This is my custom header
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;c1=sipp1;c2=sipp2>
Max-Forwards: 69
Subject: Performance Test
Content-Type: application/sdp
Content-Length: 140
sip-manipulation
name specialChar
header-rule
name searchParams
header-name Params
action store
comparison-type pattern-rule
match-value .*sip:(.+)@.*
msg-type request
new-value
methods INVITE
element-rule
name userName
parameter-name
type uri-user
action store
match-val-type any
comparison-type case-sensitive
match-value
new-value
1-92
Chapter 1
Configuration Examples
element-rule
name emptyUriParam
parameter-name abc
type uri-param
action store
match-val-type any
comparison-type pattern-rule
match-value
new-value
header-rule
name addUserLast
header-name Edit
action manipulate
comparison-type case-sensitive
match-value
msg-type request
new-value
methods INVITE
element-rule
name lastParamUser
parameter-name lpu
type uri-param
action add
match-val-type any
comparison-type case-sensitive
match-value
new-value $searchParams[^].$userName.$0
element-rule
name anyParamUser
parameter-name apu
type uri-param
action add
match-val-type any
comparison-type pattern-rule
match-value $searchParams[~]
new-value aup
element-rule
name allParamUser
parameter-name apu
type header-param
action add
match-val-type any
comparison-type pattern-rule
match-value $searchParams[*]
new-value apu
element-rule
name notParamYes
parameter-name not
type uri-param
action add
match-val-type any
comparison-type pattern-rule
match-
value !$searchParams.$emptyUriParam
new-value 123
1-93
Chapter 1
Configuration Examples
element-rule
name notParamNo
parameter-name yes
type uri-param
action add
match-val-type any
comparison-type pattern-rule
match-
value $searchParams.$emptyUriParam
new-value 456
sip-manipulation
name manip
description
1-94
Chapter 1
Configuration Examples
header-rule
name IsContentLength0
header-name Content-Length
action store
comparison-type pattern-rule
match-value 0
msg-type reply
new-value
methods
header-rule
name is183
header-name @status-line
action store
comparison-type pattern-rule
match-value
msg-type reply
new-value
methods
element-rule
name is183Code
parameter-name
type status-code
action store
match-val-type any
comparison-type pattern-rule
match-value 183
new-value
header-rule
name change183
header-name @status-line
action manipulate
comparison-type case-sensitive
match-value
msg-type reply
new-value
methods
element-rule
name make199
parameter-name
type status-code
action replace
match-val-type any
comparison-type pattern-rule
match-value $IsContentLength0
& $is183.$is183Code
new-value 199
1-95
Chapter 1
Configuration Examples
sip-manipulation
name deleteRoute
description delete all Route Headers
header-rule
name deleteRoute
header-name Route
action delete
comparison-type case-sensitive
match-value
msg-type request
new-value
methods INVITE
sip-manipulation
name addAndDelete
description Add a New header and delete
Route headers
header-rule
name addHeader
header-name New
action add
comparison-type case-sensitive
match-value
msg-type request
new-value "Some Value"
methods INVITE
header-rule
name storeRURI
header-name request-uri
action store
comparison-type pattern-rule
match-value
msg-type request
new-value
methods INVITE
element-rule
name storeUser
parameter-name
type uri-user
action store
match-val-type any
comparison-type pattern-rule
match-value 305.*
new-value
header-rule
name deleteHeader
header-name request-uri
action sip-manip
comparison-type Boolean
match-value $storeRURI.$storeUser
1-96
Chapter 1
Configuration Examples
msg-type request
new-value deleteRoute
methods INVITE
sip-manipulation
name addOrigIp
description
header-rule
name addIpParam
header-name From
action manipulate
comparison-type case-sensitive
match-value
msg-type request
new-value
methods INVITE
element-rule
name addIpParam
parameter-name newParam
type header-param
action add
match-val-type any
comparison-type case-sensitive
match-value
new-value $LOCAL_IP
element-rule
name addLocalPort
parameter-name lport
type header-param
action add
match-val-type any
comparison-type case-sensitive
match-value
new-value $LOCAL_PORT
element-rule
name addRemotePort
parameter-name rport
type header-param
action add
match-val-type any
comparison-type case-sensitive
match-value
new-value $REMOTE_PORT
1-97
Chapter 1
Configuration Examples
sip-manipulation
name manip
description
header-rule
name IsContentLength0
header-name Content-Length
action store
comparison-type pattern-rule
match-value 0
msg-type reply
new-value
methods
header-rule
name is183
header-name @status-line
action store
comparison-type pattern-rule
match-value
msg-type reply
new-value
methods
element-rule
name is183Code
parameter-name
type status-code
action store
match-val-type any
comparison-type pattern-rule
match-value 183
new-value
header-rule
name change183
header-name @status-line
action manipulate
comparison-type case-sensitive
match-value
msg-type reply
new-value
methods
1-98
Chapter 1
Configuration Examples
element-rule
name make699
parameter-name
type status-code
action replace
match-val-type any
comparison-type pattern-rule
match-value $IsContentLength0
& $is183.$is183Code
new-value 699
sip-interface
options dropResponse=699
The following four configuration examples are based on the this sample SIP INVITE:
1-99
Chapter 1
Configuration Examples
sip-manipulation
name removePtimeFromBody
description removes ptime attribute from all
bodies
header-rule
name CTypeManp
header-name Content-Type
action manipulate
comparison-type case-sensitive
match-value
msg-type request
new-value
methods INVITE
element-rule
name remPtime
parameter-name application/sdp
type mime
action find-replace-all
match-val-type any
comparison-type case-sensitive
match-value a=ptime:[0-9]
{1,2}(\n|\r\n)
new-value
The result of manipulating the original SIP INVITE (shown above) with the configured
SIP manipulation is:
1-100
Chapter 1
Configuration Examples
a=maxptime:200
--boundary
Content-Type: application/sdp
v=0
o=user1 53655765 2353687637 IN IP4 192.168.1.60
s=-
c=IN IP4 192.168.1.60
t=0 0
m=video 12345 RTP/AVP 34
a=rtpmap:34 H263a/90000
--boundary-
sip-manipulation
name changeToUser
description change user in the To header
header-rule
name ChangeHeader
header-name To
action manipulate
comparison-type case-sensitive
match-value
msg-type request
new-value
methods INVITE
element-rule
name replaceValue
parameter-name
type header-value
action replace
match-val-type any
comparison-type pattern-rule
match-value (.+)(service)(.+)
new-value $1+Bob+$3
The result of manipulating the original SIP INVITE (shown above) with the configured SIP
manipulation is:
1-101
Chapter 1
Configuration Examples
…
…
sip-manipulation
name std2prop-codec-name
description rule to translate standard to
proprietary codec name
header-rule
name CTypeManp
header-name Content-Type
action manipulate
comparison-type case-sensitive
match-value
msg-type any
new-value
methods
element-rule
name g729-annexb-no-
std2prop
parameter-name application/sdp
type mime
action find-replace-all
match-val-type any
comparison-type case-sensitive
match-value a=rtpmap:[0-9]
{1,3}(G729/8000/1\r\na=fmtp:[0-9]{1,3} annexb=no)[[:1:]]
new-value G729a/8000/1
The result of manipulating the original SIP INVITE (shown above) with the configured
SIP manipulation is:
1-102
Chapter 1
Configuration Examples
sip-manipulation
name prop2std-codec-name
description rule to translate proprietary to
standard codec name
header-rule
name CodecManp
header-name Content-Type
action manipulate
comparison-type case-sensitive
match-value
msg-type any
new-value
methods
element-rule
name H263a-prop2std
parameter-name application/sdp
type mime
action find-replace-all
match-val-type any
comparison-type case-sensitive
match-value a=rtpmap:([0-9]{1,3})
H263a/.*\r\n
new-value a=rtpmap:+$1+"
H263/90000"+$CRLF+a=fmtp:+$1+" QCIF=4"+$CRLF
The result of manipulating the original SIP INVITE (shown above) with the configured SIP
manipulation is:
1-103
Chapter 1
Configuration Examples
CSeq: 1 INVITE
Contact: <sip:sipp@192.168.1.60:5060;user=phone>
Max-Forwards: 70
Content-Type: multipart/mixed;boundary=boundary
Content-Length: 466
--boundary
Content-Type: application/sdp
v=0
o=user1 53655765 2353687637 IN IP4 192.168.1.60
s=-
c=IN IP4 192.168.1.60
t=0 0
m=audio 12345 RTP/AVP 8
a=rtpmap:18 G729/8000/1
a=fmtp:18 annexb=no
a=sendrecv
a=maxptime:200
--boundary
Content-Type: application/sdp
v=0
o=user1 53655765 2353687637 IN IP4 192.168.1.60
s=-
c=IN IP4 192.168.1.60
t=0 0
m=video 12345 RTP/AVP 34
a=rtpmap:34 H263/90000
a=fmtp:34 QCIF=4
--boundary-
1-104