Test Case 2: Adding a Media Attribute in SDP

Last Updated : Apr 24, 2018 |

Use case

You must add or modify the SDP attributes or the connection parameters for interoperability.

Script


/*Looks into messages in the INVITE session only (It includes all messages in the INVITE dialog)

within session "INVITE" {
*/act on request where %DIRECTION="INBOUND" and %ENTRY_POINT="AFTER_NETWORK"
	{

			/*The “m=” field in SDP contains information about the type of media session.	It includes the format-list parameter for specifying the codecs. Assuming that the message comes in with 2 codecs, we add a third codec as 101 */

			%SDP[1]["s"]["m"][1].FORMATS[3]="101";

			/*The “a=” field contains attributes to provide more information on the codecs.			Assuming that the message does not have any fmtp attribute,we add the first one as 101 0-16*/			%SDP[1]["s"]["m"][1].ATTRIBUTES["fmtp"][1]="101 0-16";
	}

}

Description

The script processes all the messages of the INVITE session. A session is defined as a SIP dialog and has the same lifetime as that of a dialog. A new format-type and an attribute is added corresponding to fmtp.

Limitations

You must know the number of codecs and the number of formats in format list parameter and attributes. Else, you might replace an existing format type.