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

Uri Shacked ushacked at gmail.com
Tue Mar 27 14:35:57 CEST 2012


Thanks.
I read option 2 and i agree on 1 :-)
Didnt use any "branch stuff" yet :-(... it seems very logical to do so when
i send the call to the NP server.
Will hit the docs...


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<http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>
>:
>* 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<http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>
: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
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120327/07954838/attachment.htm>


More information about the sr-users mailing list