Codec Policies for SIP
The Oracle Communications Session Border Controller has the ability to add, strip, and reorder codecs for SIP sessions. This builds on the Oracle Communications Session Border Controller’s pre-existing abilities to route by codec and reorder one codec in an SDP offer by allowing you to configure the order of multiple codecs and to remove specific codecs within the media descriptions in SDP offers.
You can enable the Oracle Communications Session Border Controller to perform these operations on SDP offers by configuring codec policies. Codec policies are sets of rules that specify the manipulations to be performed on SDP offers. They are applied on an ingress and egress basis using the realm and session agent configurations.
Oracle Communications Session Border Controller supports three types of codec policies:
- Ingress policy—Codec policy that the Oracle Communications Session Border Controller applies to the SDP offer for incoming traffic
- Egress policy—Codec policy that the Oracle Communications Session Border Controller applies to the SDP offer for traffic leaving the Oracle Communications Session Border Controller
- Conditional policy—Codec policy that the Oracle Communications Session Border Controller applies to the SDP offer for traffic leaving the Oracle Communications Session Border Controller. A conditional policy differs from an egress policy in providing the capability to perform standard codec manipulations (add and strip) dynamically, based on the codec list and associated parameters contained in the original SDP offer.
The Oracle Communications Session Border Controller applies codec policies during the offer phase of media format negotiation. If codec manipulation is enabled, then the Oracle Communications Session Border Controller performs the modification according to the specific policy and forwards on the traffic.
For example, when the Oracle Communications Session Border Controller receives a SIP INVITE with SDP, it refers to the realm through which the INVITE arrived and performs any manipulations specified by an ingress codec policy that may have been assigned to the ingress realm. With the media description possibly changed according to the ingress codec policy, the Oracle Communications Session Border Controller passes the SDP offer to the outgoing realm so that the an egress codec policy can be applied. Note that the SDP to be evaluated by the egress codec policy may match the original SDP, or it may have been changed during transit through the ingress realm. After applying the egress coded policy, the Oracle Communications Session Border Controller forwards the INVITE.
![This image displays the OCSBC managing codec advertisement via configured codec policy. This image displays the OCSBC managing codec advertisement via configured codec policy.](img/transcoding_diagram1-sbca.jpg)
Since the offer-answer exchange can occur at different stages of SIP messaging, the assigned ingress and egress roles follow the media direction rather than the signaling direction. It might be, for example, that the offer is in an OK that the Oracle Communications Session Border Controller modifies.
You can apply codec policies to realms and to session agents; codec policies configured in session agents take precedence over those applied to realms. However, it is not required that there be both an ingress and an egress policy either for realms or for session agents. If either one is unspecified, then no modifications take place on that side. If neither ingress nor egress policies specified, SDP offers are forwarded as received.
Relationship to Media Profiles
For each codec that you specify in a codec policy, there must be a corresponding media profile configuration on the Oracle Communications Session Border Controller. You configure media profiles in the ACLI via the session-router path. In them, you can specify codec type, transport protocol, required bandwidth, and a number of constraints.
Manipulation Modes
You can configure a codec policy to perform several different kinds of manipulations:
- Allow—List of codecs that are allowed for a certain codec policy; if a codec does not appear on this list, then the
Oracle Communications Session Border Controller removes it. You can wildcard this list with an asterisk (*) so that all codecs are allowed. Further, you can create exceptions to a wildcarded allow list.
- You make an exception to the wildcarded list of codecs by entering the codec(s) that are not allowed with a
no attribute. This tells the
Oracle Communications Session Border Controller to allow all codecs except the one(s) you specify.
ACMEPACKET(codec-policy)# allow-codecs (* PCMA:no)
- You can also create exceptions to allow lists such that audio or video codecs are removed. However, when the allow list specifies the removal of all audio codecs and an INVITE arrives at the
Oracle Communications Session Border Controller with only audio codecs, the
Oracle Communications Session Border Controller behaves in accordance with RFC 3264. This means that the resulting SDP will contain one attribute line, with the media port for the media line set to 0. The terminating side will need to supply new SDP in its reply because the result of the manipulation is the same as an INVITE with no body.
ACMEPACKET(codec-policy)# allow-codecs (* audio:no)
- You make an exception to the wildcarded list of codecs by entering the codec(s) that are not allowed with a
no attribute. This tells the
Oracle Communications Session Border Controller to allow all codecs except the one(s) you specify.
- Order—List of the codecs where you specify their preferred order in the outgoing media offer. The
Oracle Communications Session Border Controller arranges matching codecs according to the rule you set, and any remaining ones are added to the list in the same relative order they took in the incoming media offer. If your list specifies a codec that is not present, then the ordering proceeds as specified but skips the missing codec.
You can use an asterisk (*) as a wildcard in this list, too. The placement of the asterisk is key, as you can see in the following examples:
- For an order rule set this way
ACMEPACKET(codec-policy)# order (A B C *)
codecs A, B, and C will be placed at the front of the codec list in the order specified; all other codecs in the offer will follow A, B, and C in the same relative order they had in the original SDP offer.
- For an order rule set this way:
ACMEPACKET(codec-policy)# order (* A B C)
codecs A, B, and C will be placed at the end of the codec list in the order specified; all other codecs in the offer will come before A, B, and C in the same relative order they had in the original SDP offer.
- For an order rule set this way
ACMEPACKET(codec-policy)# order (A * B C)
codec A will be placed at the beginning of the codec list, to be followed by all other codecs in the offer in the same relative order they had in the original SDP offer, and then B and C will end the list.
- For an order rule set this way
- Force—An attribute you can use in the allow list with
one codec to specify that all other codecs should be stripped from the outgoing
offer. You can specify multiple forced codecs in your rules.
- If you set multiple codecs in the allow list and one of them is forced, then the outgoing offer will contain the forced codec.
- If you set multiple codecs in the
allow list and the one that is forced is not present in the offer, then the
Oracle Communications Session Border Controller will select a non-forced codec for the outgoing offer.
ACMEPACKET(codec-policy)# allow (PCMU G729:force)
You cannot use the force attribute with a wildcarded allow list.Note:
The Force attribute can only be applied to ingress realms receiving the offers, and is not applied to egress realms. - No—An attribute that allows you to strip specified codecs or codec types from a wildcarded allow list.
ACMEPACKET(codec-policy)# allow (* PCMA:no)
In-Realm Codec Manipulation
In addition to being able to apply codec policies in realms, the realm configuration supports a setting for determining whether codec manipulation should be applied to sessions between endpoints in the same realm.
In-realm codec manipulation can be used for simple call flows that traverse two realms. If the originating and terminating realms are the same, the Oracle Communications Session Border Controller checks to see if you have enabled this capability. If you have enabled it, then the Oracle Communications Session Border Controller performs the specified manipulations. If this capability is not enabled, or if the realm’s media management in realm (mm-in-realm) setting is disabled, then the Oracle Communications Session Border Controller does not perform codec manipulations.
For more complex calls scenarios that involve call agent or reinitiation of a call back to the same realm, the Oracle Communications Session Border Controller does not perform in-realm codec manipulation.
Codec Policy Configuration
This section gives instructions and examples for how to configure codec policies and then apply them to realms and session agents. It also shows you how to configure settings for in-realm codec manipulation.
Applying a Codec Policy to a Realm
Note that codec policies defined for session agents always take precedence over those defined for realms.
To apply a codec policy to a realm: