[SR-Users] "remove_hf" and "append_hf" one after the other , twice, issue.

Carsten Bock carsten at ng-voice.com
Tue Mar 27 14:17:39 CEST 2012


Hi,

when you are adding the new Contact-Header in Failure-Route (after you
received the 3xx reply), you are working on the original message
again. So the old Contact is still removed and the new Contact is
added (as for the initial request).

There are two options for you:
1) Move your remove_hf/append_hf into a branch route (so the changes
are only for the current branch)
2) Use "msg_apply_changes()" before removing and adding the header
again (see http://kamailio.org/docs/modules/devel/modules/textopsx.html#textopsx.msg_apply_changes)

I i were you, i'd choose option 1, since for Option 2 the message and
the headers need to be parsed again.... (performance penalty).

Good luck,
Carsten

2012/3/27 Uri Shacked <ushacked at gmail.com>:
> Hi,
>
>
>
> In the scenario i am using, the flow is as followed:
>
> 1. Getting the INVITE from the user
>
> 2. Sending an INVITE with RURI changes to the NP server (sip NP server)
>
> 3. Getting a 301 reply (using the reply for the NP code)
>
> 4. Sending the call to the destination.
>
>
>
> My problem is that the NP server needs some parameters in the contact
> header.
>
> So, here is what i do :
>
>
>
> First, before sending the invite to the NP:
>
>
>
> remove_hf("Contact");
>
> append_hf("Contact
> :<sip:XXX at server_ip:port;param1=p1;param2=p2>\r\n","Contact");
>
>
>
> (The invite is sent perfectly and works great)
>
>
>
> After the NP reply i do:
>
>
>
> remove_hf("Contact");
>
> append_hf("Contact :$ct","Contact");
>
>
>
> Now I notice there are two contact headers. It seems that the remove_hf
> didn’t work this time.
>
> Any ideas?
>
>
>
> Thanks,
>
> Uri
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>



-- 
Carsten Bock
CEO (Geschäftsführer)

ng-voice GmbH
Schomburgstr. 80
D-22767 Hamburg / Germany

http://www.ng-voice.com
mailto:carsten at ng-voice.com

Mobile +49 179 2021244
Office +49 40 34927219
Fax +49 40 34927220

Sitz der Gesellschaft: Hamburg
Registergericht: Amtsgericht Hamburg, HRB 120189
Geschäftsführer: Carsten Bock
Ust-ID: DE279344284

Hier finden Sie unsere handelsrechtlichen Pflichtangaben:
http://www.ng-voice.com/imprint/

-- 
Meet ng-voice at LinuxTag 2012 in Berlin - May 23rd - 26th, 2012. Save the 
date!



More information about the sr-users mailing list