[SR-Users] Modify VIA header in replied message

Huynh Quoc Bao baohq110 at gmail.com
Tue Jul 5 03:07:32 CEST 2016


Hi Daniel,

Thank for your answering.
yes, I'm really need to add some parameters to the top most via header. But
I only want to add to the outgoing RESPONSE message. I don't want to add to
the REQUEST message. how can i do that?


On Mon, Jul 4, 2016 at 5:35 PM, Daniel-Constantin Mierla <miconda at gmail.com>
wrote:

> Hello,
>
> do you really need them in the Via header?
>
> It is abit delicate to work with, because some UA may be strict in what
> they receive, given that the Via was added by them. There are standard
> parameters that should be added such as received or rport, which are added
> by kamailio automatically if the conditions required by them are met.
>
> Maybe you can get what you need by adding a header instead -- a header can
> be added to the reply using append_to_reply() function exported by textops
> module.
>
> Otherwise, here are the steps that you can try to add to the Via header:
>
>   1) use functions from textops or textops module to update the Via header
> of the incoming request (inside request_route block), such as:
>
>   *
> https://www.kamailio.org/docs/modules/stable/modules/textops.html#textops.f.subst_hf
>   *
> https://www.kamailio.org/docs/modules/stable/modules/textopsx.html#textopsx.f.insert_hf_value
>
>   2) do msg_apply_changes()
>
> From that moment Kamailio will see the new Via header, with the changes
> you did. When building a reply, Kamailio should use the entire Via header
> and you parameter should be visible in the reply.
>
> Cheers,
> Daniel
> On 04/07/16 03:45, Huynh Quoc Bao wrote:
>
> Hi all,
>
> Could someone give me some suggestion? Thank in advance.
>
> Brs/Bao
>
> On Fri, Jul 1, 2016 at 3:31 PM, Huynh Quoc Bao <baohq110 at gmail.com> wrote:
>
>> Hi all,
>>
>> As title, i want to add some additional parameters to the topmost via
>> header in replied message.
>> example. REGISTER ==> Kamailio ===> reply 200 OK. So in 200 OK message, i
>> will add some additional parameters.
>> And the same for the other message: INVITE, SUBSCRIBE, NOTIFY, MESSAGE
>> message.
>>
>> --
>> Brs/Bao
>>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users at lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Daniel-Constantin Mierlahttp://www.asipto.com - http://www.kamailio.orghttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160705/12d9cdeb/attachment.html>


More information about the sr-users mailing list