[asterisk-users] header replacement

Russell Bryant russell at digium.com
Wed Jul 19 21:14:26 MST 2006


On Thu, 2006-07-20 at 09:18 +0800, unplug wrote:
> Do you mean I can set the header first and use the same command to
> reset the header afterward without adding 2 same header field?  Does
> there is only one remote-pary-id header in the sip message finally in
> the example below?
> e.g.
> exten => 1234,1,Set(SIP_HEADER(Remote-Party-ID)=someone at somewhere.com)
> ...do something...
> exten => 1234,10,Set(SIP_HEADER(Remote-Party-ID)=me at nowhere.com)

No, it does not actually work this way.  When I made my first reply, I
was speaking from how I thought it *should* work in my mind, not how
this actually works.  Now I need to point out some things I said that
are not correct.

First, the SIP_HEADER dialplan function is currently only implemented to
*read* headers, not write to them.

To add a header, you still use the SIPAddHeader application.  Going back
to your example, if you do the following:

exten => 1234,1,SIPAddHeader(X-MyHeader: Some info here)
...
exten => 1234,10,SIPAddHeader(X-MyHeader: Some different info here)

This will *not* overwrite the original header that you added.  This will
simply add an additional header and both will be present.  There is
currently no reliable way to go back and modify existing headers.

-- 
Russell Bryant
Software Developer
Digium, Inc.




More information about the asterisk-users mailing list