Rate this page:

SIP Header Manipulation

This feature is available in beta now

There are always many variances with SIP when you work with multiple providers/vendors. SIP Header Manipulation enables you to change any portion of the SIP header and helps you offset any of those variances.

Using header manipulation you can manipulate the From Number (I.e From User, PAI User, RPID User, Contact User) and To Number (i.e To User, RURI User) of the SIP request message. You can configure this using the console and APIs.

Only console is supported for beta

Login into the console and navigate to Elastic SIP Trunking page. You will find SIP Header Manipulation under a new menu called “Settings”.

This feature will be applicable to Elastic SIP Trunking, SIP Interfaces and BYOC.

Only Elastic SIP Trunking is supported for beta.

Manipulation Policy

Manipulation Policy consists of Friendly Name, Policy SID, Rules and Test Manipulation Policy.

Maximum number of SIP Manipulation per account is 1000.

With each SIP Manipulation,

  • You can create multiple response and request rules
  • Each request/response rules can have multiple Conditions and Actions
  • You can validate your manipulation policy using Test Manipulation Policy

You can create a “Manipulation Policy” according to your requirements.


Rules consist of Conditions and Actions.


Maximum number of conditions per rule is 20.

Conditions allow you to match full or partial portions of the SIP Header and you can create this using Field, Operator and Value. You can create one or many conditions based on the requirement. Also, you can change the order of the condition after you created and delete the conditions that are not needed.

These conditions will be carried out based on the execution type you have selected. There are three executions type and they are:

  • If any of these conditions are met
  • If all of these conditions are met
  • If none of these conditions are met

The default execution type is “if any of these conditions are met”

You can create conditions based on the below mentioned SIP Header Field that are supported by Twilio:

  • From header
  • Calling number or destination
  • From display name
  • From URI
  • From user
  • From host
  • To header
  • Called number or destination
  • To display name
  • To URI
  • To user
  • To host
  • Request URI
  • Request URI user
  • Request URI host or domain
  • P-Asserted-Identity header
  • P-Asserted-Identity display name
  • P-Asserted-Identity URI
  • P-Asserted-Identity user
  • P-Asserted-Identity host or domain
  • Remote-Party-Id header
  • Remote-Party-Id display name
  • Remote-Party-Id URI
  • Remote-Party-Id user
  • Remote-Party-Id host or domain
  • Contact header
  • Contact display name
  • Contact URI
  • Contact user
  • Contact host or domain
  • Diversion header
  • Diversion display name
  • Diversion URI
  • Diversion user
  • Diversion host or domain
  • P-Charge-Info header
  • P-Charge-Info display name
  • P-Charge-Info URI
  • P-Charge-Info user
  • P-Charge-Info host or domain

After you have identified the necessary Field you can set the matching value using the Operators such as

  • Equals
  • Does not equal
  • Starts with
  • Does not start with
  • Contains
  • Does not contain
  • Ends with
  • Does not end with

Maximum number of actions per rule is 20.

Actions will be carried out if the SIP Header matches the conditions that you have created. You can create one or many actions based on Field, Action and Value. Actions will be executed in order it was created. Similar to Conditions you can change the order of the action after you created and delete the actions that are not needed.

You will be able to manipulate the From Number and To Number of the SIP Request message using the supported Action such as

  • Add prefix
  • Add suffix
  • Remove prefix
  • Remove suffix
  • Remove number of prefix
  • Remove number of suffix
  • Replace with
  • When you Select From Number in Action, Twilio will manipulate the following portions of the SIP headers such as From User, PAI User, RPID User, Contact User.
  • When you Select To Number in Action, Twilio will manipulate the following portions of the SIP headers such as To User, RURI User.

Test Manipulation Policy:

After you create one or many rules, you can test your manipulation policy before you associate it with different products. You can start with “populate with example” which provides a predefined SIP message for your convenience. Validate the rule that you created with various conditions and actions. Once you are satisfied you can associate with the SIP products.

Elastic SIP Trunking:

Navigate to your Elastic SIP Trunking Trunk page and select the Trunk of your choice. The “Header Manipulation” that you have created now can be associated with the Trunk Termination and/or Origination side.

Sign up for Beta

Beta Signup

Please fill the form.

Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.


        Thank you for your feedback!

        We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        Step 1

        Get link

        Get a free personal referral link here

        Step 2

        Give $10

        Your user signs up and upgrade using link

        Step 3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more