How to convert SIP headers into SIP parameters names in messages
The SIP parameters that are comming into a message are named as: sip_headername.
The processing module will set message's parameters named osip_headername to be returned in the SIP response.
Contents |
How to convert SIP headers into SIP parameters and in what messages
For SIP calls you can add from routing parameters named osip_HeaderName=value, this will add to the INVITE sent a header like this: HeaderName: value.
You can set any custom headers and a few standard SIP headers, however critical headers (those used by transactions and dialogs) cannot be modified.
In many other places (18x, 200, BYE) you can add SIP headers by setting osip_headername parameters in the relevant message:
On incoming messages the SIP headers are added in Yate messages as sip_headername where headername is the lowercase version of the received header.
A particular message where you cannot currently add headers is REGISTER. Also you cannot add headers to ACK as it's generated internally.
Examples
How to set Remote-Party-ID header with the value of the callename
You can set a header by adding a parameter starting with 'osip_' prefix.
For Remote-Party-ID the parameter would be osip_Remote-Party-ID.
In regexroute.conf, the line setting it from callername would look like:
${callername}.=;osip_Remote-Party-ID=${callername}
How to set X-Test header
For example to copy (only if present and not empty) the X-Test header from an incoming to an outbound call you should do like this in regexroute.conf:
${sip_x-test}.=;osip_X-Test=${sip_x-test}
See also