LTRT-28622 SIP Message Manipulations Quick Reference Guide
LTRT-28622 SIP Message Manipulations Quick Reference Guide
Version 6.6
August 2013
Document # LTRT-28623
Quick Reference Guide Contents
Table of Contents
1 Introduction ......................................................................................................... 7
2 Message Manipulation Table Fields .................................................................. 9
2.1 Manipulation Set ID ..............................................................................................10
2.2 Message Type ......................................................................................................11
2.3 Condition ..............................................................................................................12
2.4 Action ...................................................................................................................13
3 Detailed Field Syntax ........................................................................................ 15
3.1 Condition Operands..............................................................................................15
3.2 Action Operands...................................................................................................15
3.3 Strings ..................................................................................................................16
3.4 Headers................................................................................................................17
3.4.1 Header Field Examples ...........................................................................................18
3.4.2 Configuration Examples...........................................................................................19
3.5 Body .....................................................................................................................20
3.5.1 Body Examples ........................................................................................................20
3.5.2 Configuration Examples...........................................................................................20
3.6 Parameters ...........................................................................................................22
3.6.1 Message Parameter Syntax ....................................................................................22
3.6.2 IP Group Parameter Syntax ....................................................................................23
3.6.3 Call Parameter Syntax .............................................................................................23
3.6.4 Configuration Examples...........................................................................................24
3.7 Variables ..............................................................................................................25
3.8 Random Characters .............................................................................................26
3.9 Regular Expressions ............................................................................................27
4 Summary of Typical Examples ........................................................................ 29
5 Detailed SIP Header Syntax .............................................................................. 31
5.1 Wildcarding for Header Removal .......................................................................... 37
5.2 Message Manipulation using SDP Conditions ...................................................... 38
5.3 Using Regular Expressions (Regex) ..................................................................... 40
List of Tables
Table 2-1: Message Types Examples and Descriptions ........................................................................11
Table 2-2: Condition Examples and Descriptions ..................................................................................12
Table 2-3: Action Examples and Descriptions........................................................................................13
Table 3-1: Condition Operands and Descriptions ..................................................................................15
Table 3-2: Action Operands and Descriptions........................................................................................15
Table 3-3: Configuration Examples of Using Strings in Message Manipulations Table ........................16
Table 3-4: Header Fields Examples and Descriptions ...........................................................................18
Table 3-5: Configuration Examples for using Header Fields in Message Manipulations Table............19
Table 3-6: Message Body Examples and Descriptions ..........................................................................20
Table 3-7: Configuration Examples for Message Body in the Message Manipulations Table ..............20
Table 3-8: Message Parameter Syntax in the Message Manipulations Table .......................................22
Table 3-9: IP Group Parameter Syntax in Message Manipulations Table .............................................23
Table 3-10: Call Parameter Syntax in Message Manipulations Table ...................................................23
Table 3-11: Configuration Examples using Parameters in Message Manipulations Table ...................24
Table 3-12: Configuration Examples using Variables in Message Manipulations Table ......................25
Table 3-13: Configuration Examples using Random Letters & Numeric Characters in Message
Manipulations Table ............................................................................................................26
Table 3-14: Configuration Examples Regular Expressions in Message Manipulations Table ..............27
Table 4-1: Typical Examples For Message Manipulation Sets ..............................................................29
Table 5-1: Syntax for Manipulating SIP Headers ...................................................................................31
Notice
This document describes the Quick Reference Guide for configuring SIP Message
Manipulation.
Information contained in this document is believed to be accurate and reliable at the time of
printing. However, due to ongoing product improvements and revisions, AudioCodes cannot
guarantee accuracy of printed material after the Date Published nor can it accept responsibility
for errors or omissions. Before consulting this document, check the corresponding Release
Notes regarding feature preconditions and/or specific support in this release. In cases where
there are discrepancies between this document and the Release Notes, the information in the
Release Notes supersedes that in this document. Updates to this document and other
documents as well as software files can be downloaded by registered customers at
http://www.audiocodes.com/downloads.
Copyright 2013 AudioCodes Ltd. All rights reserved.
This document is subject to change without notice.
Date Published: August-07-2013
Trademarks
AudioCodes, AC, AudioCoded, Ardito, CTI2, CTI, CTI Squared, HD VoIP, HD VoIP
Sounds Better, InTouch, IPmedia, Mediant, MediaPack, NetCoder, Netrake, Nuera, Open
Solutions Network, OSN, Stretto, TrunkPack, VMAS, VoicePacketizer, VoIPerfect,
VoIPerfectHD, Whats Inside Matters, Your Gateway To VoIP and 3GX are trademarks or
registered trademarks of AudioCodes Limited. All other products or trademarks are
property of their respective owners. Product specifications are subject to change without
notice.
WEEE EU Directive
Pursuant to the WEEE EU Directive, electronic and electrical waste must not be disposed
of with unsorted waste. Please contact your local recycling authority for disposal of this
product.
Customer Support
Customer technical support and service are generally provided by AudioCodes
Distributors, Partners, and Resellers from whom the product was purchased. For technical
support for products purchased directly from AudioCodes, or for customers subscribed to
AudioCodes Customer Technical Support (ACTS), contact [email protected].
Documentation Feedback
AudioCodes continually strives to produce high quality documentation. If you have any
comments (suggestions or errors) regarding this document, please fill out the
Documentation Feedback form on our Web site at http://www.audiocodes.com/downloads.
Your valuable feedback is highly appreciated.
Related Documentation
Manual Name
MediaPack User's Manual
Mediant 600 and 1000 SIP User's Manual
Mediant 800 Gateway and E-SBC User's Manual
Mediant 800 MSBR User's Manual
Mediant 850 MSBR User's Manual
Mediant 1000B Gateway and E-SBC User's Manual
Mediant 1000B MSBR User's Manual
Mediant 2000 User's Manual
Mediant 3000 User's Manual
Mediant 4000 E-SBC User's Manual
Mediant Software E-SBC User's Manual
1 Introduction
This document provides a quick reference on how to configure SIP Message Manipulations
using AudioCodes embedded Web server. The document includes examples that have
been implemented in the field.
The following topics are covered in this document:
Message Manipulation table fields - see Section 2 on page 12.
Detailed Field Syntax - see Section 3 on page 15.
Typical Examples - see Section 4 on page 29.
For a detailed configuration of SIP Message Manipulations, refer to the relevant product's
User's Manual.
Reader's Notes
This section describes the Message Manipulation table fields and their syntax used for
entering the values:
Manipulation Set ID see Section 2.1 on page 10
Message Type see Section 2.2 on page 11
Condition see Section 2.3 on page 12
Action - See Section 2.4 on page 13
Action Subject
Action Type
Action Value
Syntax:
<0-19>
where:
<0-19> specifies the Manipulation Set ID. You can define up to 20 message
manipulation rule sets and up to 100 rules (there is no rule limit per set).
Syntax:
<SIP-method/any>.<request/response/any>.<response-type>
where:
<SIP-method/any> specifies the SIP method used with the option to specify requests
of all method types.
<request/response/any> specifies the SIP request or SIP response type with the
option to specify any request or response type.
<response-type> specifies the SIP response type.
The following table provides examples of different message types.
Table 2-1: Message Types Examples and Descriptions
2.3 Condition
The 'Condition' field is used to test specific parts of the header in the message with
specified values. Conditions may be combined with other conditions using logical operators
(and/or).
Syntax:
<subject> <operand> <value>
where:
<subject> specifies the subject of the condition using the following format:
header/body/parameter
<operand> specifies the operand of the condition using the following format:
condition-operand
<value> specifies the value of the condition using the following format:
string/header/body/parameter/random/variable/regex
Condition Description
header.expires.time < '88888' Returns true if expires time is less than '88888'.
header.user-agent contains 'Android- Returns true if the user agent is 'Android-VMAS'
VMAS' or 'MP252'.
OR header.user-agent contains
'MP252'
param.message.sdp.address == Returns true if the "c=" line contains the given
'10.132.10.101' IP address.
header.request- Returns true if the message method type is
uri.methodtype=='415' '415'.
header.diversion.0 regex Returns true if the REGEX engine matches
(<.*)(;urlparam=[a-z]*)(.*>) urlparam=<specific value>.
2.4 Action
The following describes the syntax of the 'Action' field:
Syntax:
<Action Subject>
where:
<Action Subject> specifies the message component upon which you wish to
manipulate, using the following format:
header/body/variable
Syntax:
<Action Type>
where:
<Action Type> specifies the type of action you wish to perform on the message
component, using the following format:
action-operand
Syntax:
<Action Value>
where:
<Action Value> specifies the value to assign to the Action Type and Action Subject,
using the following format:
string/header/body/parameter/random/variable/regex
Reader's Notes
3.3 Strings
The string type is the most basic of all syntax types. A string is a series of characters
enclosed by single apostrophe. It can be used as the value for the following Message
Manipulation table fields:
Condition
Action Value
The following table provides configuration examples for using strings in the Message
Manipulations table.
Table 3-3: Configuration Examples of Using Strings in Message Manipulations Table
3.4 Headers
This section describes the syntax used for SIP headers in the Message Manipulations
table.
Syntax:
header.<header-name>.<header-index>.<sub-type>
where:
<header-name> specifies the header name as it arrives in the message. For example:
From, To, Contact (not case sensitive).
<header-index> refers to a specific header, in the event where more than one header
of the same type is present in the message. The index starts at 0, therefore in order to
refer to the first header in the list, the header-index value should be 0. For example,
header.contact.2 would refer to the third header in the list.
If <header-index> is not specified; however, a <sub-type> exists, then the sub-type
would reference the first header in the list, i.e. header.contact.url.user is identical to
header.contact.0.url.user.
If both <header-index> and <sub-type> are not specified, then the subject would refer
to all headers of this type. For example, to remove or modify all headers of a specific
type, refer to the header as header.contact.
<sub-type> specifies a specific part of the message. For example, url.user, url.host
etc.
For a complete list of all the sub-types available for each header, refer to the
''Message Manipulation'' Section in the relevant User's Manual.
Header Description
3.5 Body
This section describes the syntax used for the SIP body in the Message Manipulations
table.
Syntax:
body.<body-name>
where:
<body-name> specified the body name as it arrives in the message. For example,
'application/sdp' (case-insensitive).
Subject Description
3.6 Parameters
This section describes the syntax used for the following SIP parameter types in the
Message Manipulations table:
Message Parameters
IP Group Parameters
Call Parameters
Subject Description
Subject Description
Subject Description
3.7 Variables
There are two types of variables used in the Message Manipulation tables:
Call variables are used to store information throughout the lifetime of a call; SRC or
DST references which can be stored in the call leg. Note data stored in the call
variables is only valid for the duration of the call.
Global variables, which are similar to call variables; however, their lifetime is not
restricted to the duration of a call.
The following syntax shows how to specify the call source variable.
Syntax:
var.call.src.<0>
where:
<0> specifies the variable ID (note that only one source call variable can be defined).
The following syntax shows how to specify the call destination variable.
Syntax:
var.call.dst.<0>
where:
<0> specifies the variable ID (note that only one destination call variable can be defined).
The following syntax shows how to specify the global variables.
Syntax:
var.global.<0-9>
where:
<0-9> specifies the global variable ID. You can define up to nine global variables i.e.
var.globa.0 var.global.1.
The following table provides configuration examples for using variables in the Message
Manipulations table.
Table 3-12: Configuration Examples using Variables in
Message Manipulations Table
Syntax:
rand.string.<n>.a.z
where:
<n> is the number of random letter characters you wish to specify in the range a to z.
The following syntax shows how to specify random letter and/or numeric characters in the
range 0 to z in the Message Manipulations table.
Syntax:
Rand.string.<n>.0.z
where:
<n> is the number of random letter and/or numeric characters you wish to specify in
the range 0 to z.
The following syntax shows how to specify random numbers between n and m in the
Message Manipulations table.
Syntax:
Rand.number.<n>.<m>
where:
<n> specifies the start value of the range of the random numbers that you wish to
specify.
<m> specifies the end value of the range of the random numbers that you wish to
specify.
The following table provides configuration examples for using random letters and numeric
characters in the Message Manipulations table.
Table 3-13: Configuration Examples using Random Letters & Numeric Characters
in Message Manipulations Table
Syntax:
<regular expression>
where:
<Regular expression> is used as part of the value in a condition and contains a
regular expression.
Syntax:
<$n>
where:
<$n> is used to reference a resulting sub-expression after executing a regex in a
condition; where n is an integer referencing the sub-expression.
The following table provides configuration examples for using regular expressions in the
Message Manipulations table.
Table 3-14: Configuration Examples Regular Expressions
in Message Manipulations Table
Reader's Notes
Action Action
Message Type Condition Action Value
Subject Type
Reader's Notes
Attribute to
SIP Header Manipulation Syntax Example
Manipulate
Attribute to
SIP Header Manipulation Syntax Example
Manipulate
Attribute to
SIP Header Manipulation Syntax Example
Manipulate
Vector
P-Preferred- Header itself header.p-preferred-identity
Identity
Name (string) header.p-preferred-
identity.name
URL (see URL for header.p-preferred-identity.url
Contact header)
Privacy Header itself header.privacy
Privacy types: header.privacy.privacy.<type> header.privacy.pr
none ivacy.user
header
session
user
critical
identity
history
Proxy-Require Header itself header.proxy-require
SIP Capabilities: header.proxy- header.proxy-
earlymedia require.<capability> require.earlymedi
reliableresponse
timer
earlysession
privacy
replaces
history
unknown
gruu
resourcepriority
targetdialog
sdpanat
Reason Header itself header.reason
Reason types: header.reason.reason.<type> header.reason.re
Reason ason.reason
Cause
text
MLPP: header.reason.mlpp
Type: Preemption (0),
MLPP (1)
cause
Referred-By Header itself header.referred-by
Parameter header.referred-by.param header.referred-
by.param.p1
URL (see URL for header.referred-by.url header.referred-
Contact header) by.url.host
Refer-To Header itself header.refer-to
Attribute to
SIP Header Manipulation Syntax Example
Manipulate
Parameter header.remote-party-id.param
Attribute to
SIP Header Manipulation Syntax Example
Manipulate
priority.namespace
RPriority header.resource-
priority.rpriority
Retry-After Header itself header.retry-after
Time header.retry-after.time
Server or User- Header itself header.user-agent
Agent header.server
Service-Route Header itself header.service-route
Service route list entry header.service- header.servicero
route.<entry>.serviceroute ute.1.servicerout
e
Session-Expires Header itself header.session-expires
Parameter header.session- header.session-
expires.param expires.param.lo
ngtimer
Refresher header.session-
expires.refresher
Time header.session-expires.time
Subject Header itself header.subject
Supported Header itself header.supported
SIP Capabilities (see header.supported.<capability header.supporte
SIP Capabilities for > d.path
Proxy-Require header)
To Header itself header.to
Display name header.to.name
Parameter header.to.param header.to.param.
artist
tag header.to.tag
URL (see URL for header.to.url header.to.url.use
Contact header) rphone
Unsupported Header itself header.unsupported
SIP Capabilities (see header.unsupported.<capabili header.unsuppor
SIP Capabilities for ty> ted.path
Proxy-Require header)
User-To-User Header itself header.x-usertouser
and X-
UserToUser User-to-User header.x-
Descriptor usertouser.user2user
Protocol Descriptor header.x-usertouser.pd
(PD)
Attribute to
SIP Header Manipulation Syntax Example
Manipulate
Example 2: Changes the RTP mode to sendonly if the SDP "c=" line address is
0.0.0.0:
Message Action Action Action
Condition
Type Subject Type Value
reinvite. param.mess param.messa Modify 'sendonly'
request age.sdp.ip ge.sdp.rtpmo
== '0.0.0.0' de
Example 3: Changes the SDP "c=" line to the same address as the "o=" line:
Action Action
Message Type Action Subject
Type Value
- param.message.sdp.ip Modify param.message.sdp.
originaddress
You can configure several such manipulation rules and then apply them per IP Group using
the 'Inbound Message Manipulation Set' parameter.
Explanation: These rules are slightly complex as both the To and From headers
are inspected. This rule executes
If the dialed number is prefixed with a number 6-8 (inclusive)
If the calling party number is prefixed with 2001
If these conditions exist, then:
Remove the first five digits of the dialled string.
Prefix the result with the digit 3.
The first rule matches a dialled number that occurs in the To header (e.g.,
85262146). If a match occurs, it uses a variable to store the remaining three digits
and adds the digit 3 as the prefix. The second rule inspects the From header. If it
contains the string 2001, then the user part of the To header is modified with the
prepared variable. For example, the user (at 20011234) dials 85262146, which
generates the following substring from the first rule:
$1 85262
$2 146
$3 10.132.10.100;user=phone>
Note: This configuration isolates the last three digits in the dialed number and
prefixes them with '3'. The variable now is set to '3146'. The second rule does
not use sub-expressions. It simply searches for 2001 in the From header and
if there is a match the user part of the To header is manipulated using the
standard manipulation syntax.
Explanation: This rule matches everything up to the a=ptime in the SDP body as
$1, and stores as $3 everything after the 0 in the ptime attribute line. This is used
as the closing \r\n in the SDP body. The modify action then refers to the sub-
expressions $1 and $3, but does not make use of $2, instead replacing it with
a=ptime:10.
Reader's Notes
www.audiocodes.com