Manipulation of Headers and Request URIs in SIP Messages

The header manipulation feature enables you to add, modify, or remove fields in SIP headers and to modify the request URI in SIP messages. It also enables you to reject SIP messages based on information in the SIP header.

This feature is useful for solving interoperability issues between vendors and peers.

How Header Manipulation Works

To use this feature, you set up message manipulation rules and then add the rules to new transaction policies. Message manipulation rules can specify the following actions for SIP headers:

You can also set up message manipulation rules that specify the modifications that you want to perform on regular expressions in the request URI of SIP messages.

Applying Message Manipulation Rules

After you create your message manipulation rules, you apply them using new transaction policies. Message manipulation affects the transaction that matches the policy as well as any transactions that belong to a dialog that results from the transaction.

You can apply the message manipulation rules in the following directions:

Header Manipulation Examples

This topic provides examples of manipulating SIP headers.

Example: Removing a Text String from the Alert-Info Field

Apply the remove-alert-info manipulation rule to the forward direction in a new transaction policy:

manipulation-rule remove-alert-info {
    actions {
        sip-header Alert-Info {
            field-value {
                remove-regular-expression DummyDomain;
            }
        }
    }
}

The second appearance of Alert-Info in the following example is removed:

Alert-Info:<http://www.example.com/sounds/moo.wav>Alert-Info:<http://www.DummyDomain.net/user/ringback.mp3>Alert-Info:<http://wwww.example.com/alice/photo.jpg>

Example: Rejecting a Message Based on the Field Value of the From Header

Apply the reject-from manipulation rule to the forward direction in a new transaction policy:

manipulation-rule reject-from {
    actions {
        sip-header From {
            field-value {
                reject-regular-expression anonymous;
            }
        }
    }
}

A received SIP message request with From header with the following field value is rejected with a 403 Forbidden SIP response.

From: Anonymous <sip:anonymous@atlanta.com>;tag=1928301774

Example: Using a Regular Expression to Modify the P-Asserted-Identity Field Value

Apply the modify-p-asserted-identity manipulation rule to the forward direction in a new transaction policy:

manipulation-rule modify-p-asserted-identity {
    actions {
        sip-header P-Asserted-Identity {
            field-value {
                modify-regular-expression "sip:[0-9]+@.*" with "sip:P-Asserted-Identiy@juniper.net";
            }
        }
    }
}

A ReINVITE request received from the UAS with P-Asserted-Identity: sip:987654321@SomeDomain.com is modified to P-Asserted-Identity: sip:P-Asserted-Identiy@juniper.net and then forwarded to the UAC.

Example: Adding the Transport Protocol and “q” Parameter to the Contact Header

Apply the add-transport-q manipulation rule to the forward direction in a new transaction policy:

manipulation-rule add-transport-q {
    actions {
        sip-header contact {
            field-value {
                modify-regular-expression "(.*)" with "<\1;transport=UDP>;q=0.7";
            }
        }
    }
}

A request received from with Contact: sip:70.100.101.1 is modified to Contact: <sip:70.100.101.1:5060;transport=UDP>;q=0.7.

Using High Availability with Message Manipulation

In the case of an active standby switchover, dialogs that were matched to a policy before the switchover continue to use the policy even if the policy is modified or deleted from the CLI.

In the case of a stateful restart, the new BSG process applies message manipulation rules to dialogs that were already matched to a policy before the switchover occurred as follows:

Displaying Message Manipulation Rules That Are Currently Being Applied

You can use the following show commands to view the message manipulation rules that are currently being applied to active calls on a specific BSG:

show services border-signaling-gateway by-contact contact detailed gateway gateway-nameshow services border-signaling-gateway by-request-uri request-uri detailed gateway gateway-name

Related Topics