[Asterisk-Dev] Playing around with SIP headers

Olle E. Johansson oej at edvina.net
Sat Nov 13 08:08:27 MST 2004


I've uploaded two patches to chan_sip to the bug tracker:

* sipgetheader()
* sipaddheader()

SIPgetheader takes any sip header from the incoming INVITE and adds it
to a variable. With this function, we can safely remove the patch that
was added a few days ago, where we read a header and store it in the
CDR userfield - it can now be done in the dial plan with any header.

SIPaddheader() adds a SIP header. Of course, you need to know what you
do with this function. You can add any header of your own, that you
need to communicate with another node. One thing you could do in an
Asterisk network is add the account code to the INVITE...
You can not replace SIP headers with this function, only add new ones.
Remember: If you add non-standard headers, prefix them with "x-",
like in e-mail. Note that this function only works in cvs head, since
it requires a change in app_dial that was committed a while ago.

Please test these patches. If you like them and would like to see them
in CVS, please add your thoughts to the bug tracker. If you find any
bugs, please add a comment.

These functions has been running in the chan_sip2 channel for a while
now in my internal network. I use them quite a lot for adding
attributes in SER, sending them to Asterisk and the other way around.

/Olle



More information about the asterisk-dev mailing list