Codec and Conditional Codec Policies for SIP

The Oracle® Enterprise Session Border Controller (E-SBC) can add, strip, and reorder codecs for SIP sessions. This builds on the E-SBC pre-existing abilities to route by codec and re-order 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 E-SBC to perform these operations on SDP offers by configuring codec policies. Codec policies are sets of rules that specify the manipulations that you want the E-SBC to perform on SDP offers. The E-SBC applies the policies on an ingress and egress basis using the realm and session agent configurations.

E-SBC supports the following types of codec policies:

  • Ingress policy—applies to the SDP offer for incoming traffic
  • Egress policy—applies to the SDP offer for traffic leaving the E-SBC
  • Conditional policy—applies to the SDP offer for traffic leaving the E-SBC. A conditional policy differs from an egress policy in providing the capability to perform standard codec manipulations (add, strip and re-order) dynamically, based on the codec list and associated parameters contained in the original SDP offer. See Conditional Codec Policies for specific details regarding the use and construction of conditional policies.

The E-SBC applies codec policies during the offer phase of media format negotiation. When you enable codec manipulation, the E-SBC performs the modification according to the specific policy and forwards the traffic.

For example, when the E-SBC receives a SIP INVITE with SDP, it refers to the realm through which the INVITE arrived and performs any manipulations specified by the ingress codec policy that you assigned to the ingress realm. With the media description possibly changed according to the ingress codec policy, the E-SBC passes the SDP offer to the outgoing realm and applies the egress codec policy. 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 E-SBC forwards the INVITE.

This image displays the OCSBC managing codec advertisement based on configured conditional policy.

Because 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 E-SBC modifies.

You can apply codec policies to realms and to session agents. Note that codec policies configured in session agents take precedence over those applied to realms. The system does not require both an ingress policy and an egress policy for either realms or for session agents. When either one is unspecified, no modifications take place on that side. When you specify neither an ingress nor egress policy, the E-SBC forwards SDP offers 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® Enterprise 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® Enterprise 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® Enterprise Session Border Controller to allow all codecs except the one(s) you specify.
      ORACLE(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® Enterprise Session Border Controller with only audio codecs, the Oracle® Enterprise 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.
      ORACLE(codec-policy)# allow-codecs (* audio:no)
  • Order—List of the codecs where you specify their preferred order in the outgoing media offer. The Oracle® Enterprise 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
      ORACLE(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:
      ORACLE(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
      ORACLE(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.

  • 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® Enterprise Session Border Controller will select a non-forced codec for the outgoing offer.
      ORACLE(codec-policy)# allow (PCMU G729:force)

      You cannot use the force attribute with a wildcarded allow list.

  • No—An attribute that allows you to strip specified codecs or codec types from a wildcarded allow list.
    ORACLE(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® Enterprise Session Border Controller checks to see if you have enabled this capability. If you have enabled it, then the Oracle® Enterprise 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® Enterprise 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® Enterprise Session Border Controller does not perform in-realm codec manipulation.

Conditional Codec Policies

A codec policy performs actions conditionally when any of its parameters includes a conditional value. A conditional value includes a target codec paired with a requirement for executing the action. The Oracle® Enterprise Session Border Controller manipulates SDP according to this value pair if the ingress SDP or a previous manipulation to the SDP meets the condition's criteria. The user configures this "conditional manipulation" by extending upon the syntax of three core parameters in the codec-policy configuration element, including:

  • allow-codecs,
  • add-codecs-on-egress, and
  • order-codecs.

The system establishes conditions on a codec policy as a sequence of allowing, adding, and re-ordering. Each step in this sequence can occur with or without conditions. Allowing is required. Any applied policy, whether or not it is conditional, without an allow blocks all traffic. Allow all, using the wildcard asterisk character is a typical setting. Adding only applies to egress policies.

To establish conditions, the user configure the parameter with pairs that consist of target codecs followed by the condition(s) that trigger the action. Each policy parameter can include one or more of these pairs. When configuring a parameter with multiple values, the user encloses them within parenthesis, whether or not there are conditions.

The system processes all policies serially, regardless of whether any includes a condition. Specifically, the system first determines which codecs to allow, then which to add (none on ingress), then the codec order. The system also processes parameter values serially. The user, therefore, must configure all parameter values based on what may have been changed previously. This is particularly important when using both ingress and egress codec policies. Consistent with this serial concept, egress policies operate on what the system presents to them, which includes the results of any ingress policies.

Note that the use of conditional order-codecs is often done in conjunction with add-codecs-on-egress to define the location of user-added codecs to the list presented at egress. When order-codecs is not used, the system places all added codecs at the beginning of the list in the order they were added. It is often desirable to place an added codec in a different position, using order-codecs.

Conditional Codec Lists

Conditional codec policies are constructed using existing ACLI configuration commands — allow-codecs, add-codecs-on-egress, and order-codecs — in conjunction with keywords and operators. Conditions are defined by a continuous character string (no spaces allowed) that starts with the :( character sequence and is terminated by a closing parenthesis. For example,

ORACLE(codec-policy)# allow-codecs PCMU:(!G729)

which can be interpreted as — allow PCMU if the G729 codec is not in the SDP offer after ingress codec policy processing.

An example of using add-codecs-on-egress is:

ORACLE(codec-policy)# add-codecs-on-egress PCMU:(PCMA)

which can be interpreted as — add PCMU if PCMA codec is in the SDP offer after ingress codec policy processing.

If PCMA is in the SDP offer after ingress codec policy processing, the add-codecs-on-egress ACLI command is treated as add-codecs-on-egress PCMU. If PCMA is not in the SDP offer after ingress codec policy processing, add-codecs-on-egress is treated as empty.

Both the conditioned codec and/or the condition itself can contain subnames. For example,

ORACLE(codec-policy)# add-codecs-on-egress AMR::ONE:(AMR::TEST0)

which can be interpreted as — add AMR::ONE if AMR::TEST0 codec is in the SDP offer after ingress codec policy processing.

Codecs contained in the condition can be wildcarded. For example,

ORACLE(codec-policy)# add-codecs-on-egress AMR::ONE:(AMR::*)

which can be interpreted as — add AMR::ONE if any AMR codec is in the offer after ingress codec policy processing.

An example of using order-codecs is:

ORACLE(codec-policy)# order-codecs (PCMU:(PCMU) *)

which can be interpreted as — set the codec order to PCMU followed by the list after ingress codec policy processing if PCMU is not present. When the system adds a codec, the codec goes to the end of the offered list. This conditional format may be used to place an added codec at the front of list.

Conditional Codec Operators

Three logical operators are available to construct conditional lists

the OR operator (|)

ORACLE(codec-policy)# add-codecs-on-egress AMR::ONE:(AMR::*|PCMU)

which can be interpreted as — add AMR::ONE if any AMR:: codec is in the SDP offer after ingress codec policy processing, or if PCMU is in the SDP offer after ingress codec policy processing.

the AND operator (&)

ORACLE(codec-policy)# add-codecs-on-egress AMR::ONE:(AMR::*&PCMU)

which can be interpreted as — add AMR::ONE if any AMR:: codec is in the SDP offer after ingress codec policy processing, and if PCMU is in the SDP offer after ingress codec policy processing.

the NOT operator (!)

ORACLE(codec-policy)# add-codecs-on-egress AMR::ONE:(!AMR::*)

which can be interpreted as — “add AMR::ONE if no AMR:: codec is in the SDP offer after ingress codec policy processing.

Each operator applies only to the codec immediately following it. Operators are processed left to right until all conditions have been tested. The condition result is accumulated as each of the conditions is processed. For example:

ORACLE(codec-policy)#add-codecs-on-egress AMR::ONE:
(!AMR::TEST1&AMR::TEST0|AMR::TEST2)
  • Test SDP offer for AMR::TEST1 (a NOT operation).

    If AMR:TEST1 is NOT present, set accumulated result to TRUE.

    If AMR:TEST1 is present, set accumulated result to FALSE.

  • Test SDP offer for AMR::TEST0 (an AND operation).

    If AMR is present, no change to accumulated result.

    If AMR is not present, set accumulated result to FALSE.

  • Test SDP offer for AMR::TEST2 (an OR operation).

    If AMR is present, set accumulated result to TRUE.

    If AMR is not present, no change to accumulated result.

Multiple conditions can be concatenated; in this case, individual conditions are separated by SPACE characters and the ACLI command argument is bracketed with double quotation marks ...). For example:

ORACLE(codec-policy)#add-codecs-on-egress (PCMU G729:(G726) G723:(PCMA))
  • PCMU is unconditionally added to the egress codec list.
  • Process the first condition — G729:(G726)

    If G726 is present, the result is TRUE; add G729 to the egress codec list.

    If G726 is not present, the result is FALSE; do not add G729 to the egress codec list.

  • Process the second condition — G723:(PCMA)

    If PCMA is present, the result is TRUE; add G723 to the egress codec list.

    If PCMA is not present, the result is FALSE; do not add G723 to the egress codec list.

ACLI Instructions and Examples

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.

Creating a Codec Policy

To create a codec policy:

  1. In Superuser mode, type configure terminal and press Enter.
    ORACLE# configure terminal
  2. Type media-manager and press Enter to access the signaling-related configurations.
    ORACLE(configure)# media-manager
    ORACLE(media-manager)#
  3. Type codec-policy and then press Enter.
    ORACLE(media-manager)# codec-policy
    ORACLE(codec-policy)#
  4. name—Enter the unique name for the codec policy. This is the value you will use to refer to this codec policy when you apply it to realms or session agents. This parameter is required and is empty by default.
  5. allow-codecs—Enter the list of media format types (codecs) to allow for this codec policy. In your entries, you can use the asterisk (*) as a wildcard, the force attribute, or the no attribute so that the allow list you enter directly reflects your configuration needs. Enclose entries of multiple values in parentheses ( ( ) ). For more information, refer to the Manipulation Modes section above.

    The codecs that you enter here must have corresponding media profile configurations.

    allow-codecs can be used to construct ingress, egress, or conditional codec policies. For details of conditional codec policies, refer to Conditional Codec Policies.

  6. add-codecs-on-egress—Enter the codecs that the Oracle® Enterprise Session Border Controller adds to an egress SDP offer if that codec is not already there. This parameter applies only to egress offers. For more information, refer to the Manipulation Modes section above.

    The codecs that you enter here must have corresponding media profile configurations.

    add-codecs-on-egress can be used to construct ingress, egress, or conditional codec policies. For details of conditional codec policies, refer to Conditional Codec Policies.

  7. order-codecs—Enter the order in which you want codecs to appear in the outgoing SDP offer. Remember that you can use the asterisk (*) as a wildcard in different positions of the order to directly reflect your configuration needs. Enclose entries of multiple values in parentheses ( ( ) ). For more information, refer to the Manipulation Modes section above.

    The codecs that you enter here must have corresponding media profile configurations.

    order-codecs can be used to construct ingress, egress, or conditional codec policies. For details of conditional codec policies, refer to Conditional Codec Policies.

  8. Save and activate your configuration.

    Your codec policy configuration will resemble the following example:

    codec-policy
            name            private
            allow-codecs    g723:no pcmu video:no
            order-codecs    pcmu *

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:

  1. In Superuser mode, type configure terminal and press Enter.
    ORACLE# configure terminal
  2. Type media-manager and press Enter.
    ORACLE(configure)# media-manager
  3. Type realm-config and press Enter.
    ORACLE(media-manager)# realm-config

    If you are adding support for this feature to a pre-existing realm, then you must select (using the ACLI select command) the realm that you want to edit.

  4. codec-policy—Enter the name of the codec policy that you want to apply to this realm. By default, this parameter is empty.
  5. Save and activate your configuration.

Applying a Codec Policy to a Session Agent

Note that codec policies that are defined for session agents always take precedence over those that are defined for realms.

To apply a codec policy to a realm:

  1. In Superuser mode, type configure terminal and press Enter.
    ORACLE# configure terminal
  2. Type session-router and press Enter.
    ORACLE(configure)# session-router
  3. Type session-agent and press Enter.
    ORACLE(session-router)# session-agent

    If you are adding support for this feature to a pre-existing session agent, then you must select (using the ACLI select command) the realm that you want to edit.

  4. codec-policy—Enter the name of the codec policy that you want to apply to this realm. By default, this parameter is empty.
  5. Save and activate your configuration.

In-Realm Codec Manipulations

To enable in-realm codec manipulations:

  1. In Superuser mode, type configure terminal and press Enter.
    ORACLE# configure terminal
  2. Type media-manager and press Enter.
    ORACLE(configure)# media-manager
  3. Type realm-config and press Enter.
    ORACLE(media-manager)# realm-config

    If you are adding support for this feature to a pre-existing realm, then you must select (using the ACLI select command) the realm that you want to edit.

  4. codec-manip-in-realm—Enter the name of the codec policy that you want to apply to this realm. The default value is disabled. The valid values are:
    • enabled | disabled

  5. Save and activate your configuration.