AudioCodes Session Border Controllers provide a great way to manipulate nearly every aspect of a SIP message. Whilst their Message Manipulate feature is a powerful and flexible tool, for newcomers or those with experience, achieving results can be complicated. Due to this, we’ve provided an overview article containing our most common AudioCodes message manipulation examples. However, we will first explain the main concepts of how an manipulation is applied. A message manipulation is comprised of five main areas:
Message Type – The message type is the kind of SIP message you are looking to change. For example at the start of a call an INVITE is produced, in which you could change the host domain or username. Perhaps you need to change SDP information in a 200 OK? The message type denotes what kind of SIP message you want to change. If you leave this field blank, the message manipulation you create will apply to any SIP message.
Condition – A condition is essentially a match criteria and an important field to populate. What should the SBC look for in order to apply the message manipulation? For example, are you looking to change one specific telephone number, perhaps change the sending domain or even change an SDP property such as the contact field or supported codecs. You need to use the condition field to say “only if you see this, do this”.
Action Subject – This is often a misinterpreted field, however this is area whereby you tell the SBC which part of the SIP message you want to change. By this point, we’ve created our condition to say only make this change if you match this criteria and we’ve told the SBC what type of SIP message we want to alter. However, a SIP message is made up of multiple different sections, some are within the header and some are contained within the SDP or otherwise know as the body. In the action subject we are telling the SBC to edit one specific part of the message, for example header.from.url.host would change the domain name that the in the FROM field.
Action Type – This drop down box is reasonably self explanatory. After you’ve chosen your action subject, i.e. the specific part of the SIP message you want to change, the action type denotes the way in which you want to change it. For example, you may want to completely remove the action subject you have specified, as a SIP carrier doesn’t support that part of the message. It may be you need to modify the action subject to change what it says, for example renaming the host domain.
Action Value – Here we are at the final field where you specify what you want the action subject to be changed to. A really important part of this field is ensuring anything you add is encompassed in opening and closing apostrophes as if it isn’t, it simply doesn’t get applied. For example if I wanted to change my host domain to siplifi.com, I would specify it as ‘siplifi.com’
Message Manipulation Examples
Now that we’ve provided some background on what each of the five key areas of a message manipulation do, here are some our of most used. It should also be noted that when you create a message manipulation you need to assign it to a Manipulation Set ID. You can assign many message manipulations to the same ID, however the ID itself must be applied to an IP Group for it to take affect.
For the purposes of keeping things simple, let’s take a look at a straight forward manipulation that changes the host name of a SIP URI in an INVITE message:
In the above example, we are taking any INVITE message without a condition and changing the FROM fields host name to siplifi.com. The means for example, should this manipulation set ID be applied to our SIP Carrier IP Group, any call originating from Skype for Business would be sent to the carrier as +firstname.lastname@example.org instead of +email@example.com.
Add Session Expires
Another simple example of how to add a field to a SIP message, is placing a session expiry in the header of a SIP message. In the below example we are adding a Session-Expires attribute to the header of an INVITE message, with a value of 8000. This same method can be used to add a field to any area of the given message type.
Another common manipulation, although this can also be achieved also by enabling the feature in an IP Profile is to add the P-Asserted Identity to an INVITE. This is achieved by adding the P-Asserted Identity to the INVITE by taking the value of the Header.From field and using this as P-Asserted identity value itself.
More advanced message manipulations are often required when performing interoperability with other SBC’s or PBX’s. In these cases, message manipulations are beneficial if you need to alter SIP messages so they are accepted by the receiving system in a format they understand. In general, manipulations of this nature require condition matching via regular expressions. We’ll be covering regular expressions in another blog post soon, however here’s some examples we’ve used in our integrations.
In the above two examples, a condition is being set using regular expressions (regex) to apply the action should the condition be met. In the first manipulation, a regular expression has been set to look for the coder with the details “RTP/AVP 8 96“. When this has been identified, we are using an action type of modify and then reconstruct the SIP message to add “13” to the coder detail. To do this, in the action value, we use regex variables and include ‘13‘ to create “RTP/AVP 8 96 13“.
In the second example we are applying a completely new codec to any REINVITE message by adding this to the SDP body. This is performed by using a regular expression to place the SDP into a variable and then add the “a=rtpmap: 13 CN/8000\\” entry by using an action type of add and then reconstructing the message in the action value using variables.
Message Manipulations are a hugely powerful tool when performing PBX interoperability or integration with another SIP entity that requires the modification of SIP messages. AudioCodes have a very useful Message Manipulation Syntax Guide that provides detailed information on the areas of a SIP message that can be manipulated and the syntax to use in fields such as the condition and action subjects. You can find the latest version of the guide at the following URL:
We hope this AudioCodes message manipulation example overview has been helpful in providing an understanding of how Message Manipulations work on an SBC along with a collection of examples that are ready to implement. If you need any assistance with implementing message manipulations please feel free to send us a message using the form below or check out our support services.