Brekeke SIP Server Wiki

3. Editing SIP Headers

Editing a SIP header means replacing the SIP header’s contents to a specified value or to add a SIP header or to delete a SIP header. If the specified SIP header field exists in the SIP packet, the contents of the SIP header will be replaced with a new value. If it doesn’t exist, the header field will be added to the SIP packet. If the setting value is empty (the text length is 0), the SIP header will be removed from the SIP packet.

 

By editing a specified SIP header, it is possible to block leaks of the caller’s information or to become interoperable with the call destination.

 

3.1. Replacing an Existing SIP Header

 

Ex 1. Changing the caller’s display name to “Ted” if his/her user name is “admin”
Matching Patterns Deploy Patterns
$request = ^INVITE
$geturi(From) = (sip:admin@.+)
From = "Ted" <%1>
$replaceuri = true

 

Ex 2. Changing the Expires’s value to 200 if it is less than 200
Matching Patterns Deploy Patterns
$request = ^INVITE
Expires = ^[01][0-9].$
Expires = 200

 

Ex 3. Replacing the User-Agent’s value to contain “Beta” if it contains “Alpha”
Matching Patterns Deploy Patterns
$request = ^INVITE
User-Agent = (.*)Alpha(.*)
User-Agent = %1Beta%2

 


3.2. Appending SIP Header
Ex 1. Appending new header “X-Example”
Matching Patterns Deploy Patterns
$request = ^INVITE

X-Example = hello

 


3.3. Deleting SIP Header
Ex 1. Deleting the User-Agent header
Matching Patterns Deploy Patterns
$request = ^INVITE

User-Agent =

 

 

Related Links:

 

Yes No
Suggest Edit