Hi, I know there are commands called sipaddheader and sipgetheader but I can't find any method to replace/remove header. Does anyone know how to replace/remove a header in the sip message? Say, I have a header field in the sip message: Remote-Party-ID: someone@somewhere.com. I want to replace it to :Remote-Party-ID: me@nowhere.com Thanks
Hi, I know there are commands called sipaddheader and sipgetheader but I can't find any method to replace/remove header. Does anyone know how to replace/remove a header in the sip message? Say, I have a header field in the sip message: Remote-Party-ID: someone@somewhere.com. I want to replace it to :Remote-Party-ID: me@nowhere.com Thanks
On Wed, 2006-07-19 at 16:27 +0800, unplug wrote:> I have a header field in the sip message: Remote-Party-ID: > someone@somewhere.com. > I want to replace it to :Remote-Party-ID: me@nowhere.comIn Asterisk 1.2 and the trunk, the SipAddHeader and SipGetHeader applications are deprecated. There is a SIP_HEADER dialplan function, instead. You can use it for exactly this purpose. exten => 1234,1,Set(SIP_HEADER(Remote-Party-ID)=me@nowhere.com) -- Russell Bryant Software Developer Digium, Inc.
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@somewhere.com) ...do something... exten => 1234,10,Set(SIP_HEADER(Remote-Party-ID)=me@nowhere.com) On 7/20/06, Russell Bryant <russell@digium.com> wrote:> On Wed, 2006-07-19 at 16:27 +0800, unplug wrote: > > I have a header field in the sip message: Remote-Party-ID: > > someone@somewhere.com. > > I want to replace it to :Remote-Party-ID: me@nowhere.com > > In Asterisk 1.2 and the trunk, the SipAddHeader and SipGetHeader > applications are deprecated. There is a SIP_HEADER dialplan function, > instead. You can use it for exactly this purpose. > > exten => 1234,1,Set(SIP_HEADER(Remote-Party-ID)=me@nowhere.com) > > -- > Russell Bryant > Software Developer > Digium, Inc. > > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users >
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@somewhere.com) > ...do something... > exten => 1234,10,Set(SIP_HEADER(Remote-Party-ID)=me@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.