[SR-Users] Contact header modification - Kamailio

Ankit Jayswal ankit.jayswal at engagely.ai
Thu Aug 4 12:09:33 CEST 2022


Hello,

This way the contact header is *not* getting inserted.

Below syntax is only able to insert it.
insert_hf("Contact: <sip:00912269240500 at 10.52.26.98:5060>\r\n", "Contact");

My problem is with *remove_hf(); *function only. It does not remove the
value.








On Thu, Aug 4, 2022 at 2:05 PM Henning Westerholt <hw at gilawa.com> wrote:

> Hello,
>
>
>
> please do not add the Contact header as second parameter to the insert_hf.
>
>
>
> Try this out:
>
>
>
> remove_hf("Contact");
> insert_hf("Contact: <sip:00912269240500 at 10.52.26.98:5060>\r\n");
>
>
>
> Cheers,
>
>
>
> Henning
>
>
>
> --
>
> Henning Westerholt – https://skalatan.de/blog/
>
> Kamailio services – https://gilawa.com
>
>
>
> *From:* sr-users <sr-users-bounces at lists.kamailio.org> *On Behalf Of *Ankit
> Jayswal
> *Sent:* Thursday, August 4, 2022 7:27 AM
> *To:* Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>
> *Subject:* Re: [SR-Users] Contact header modification - Kamailio
>
>
>
> Yes,
>
> When I use *remove_hf()* and *insert_hf()* it doesn't remove the value of
> the Contact header properly.
>
>
>
> Below code executed:
>
> remove_hf("Contact");
> insert_hf("Contact: <sip:00912269240500 at 10.52.26.98:5060>\r\n",
> "Contact");
>
>
>
> I have given the sngrep INVITE request below after applying the above
> code. See the highlighted contact header not removing previous value
> properly.
>
>
>
>
>
>
>
>
>
>
>
> On Wed, Aug 3, 2022 at 8:30 PM Alex Balashov <abalashov at evaristesys.com>
> wrote:
>
> How did you conclude that it doesn’t work?
>
> > On Aug 3, 2022, at 8:06 AM, Ankit Jayswal <ankit.jayswal at engagely.ai>
> wrote:
> >
> > Hello,
> >
> > Can you suggest directly replacing the value of the Contact header ? As
> remove_hf("Contact") does not work for me.
> >
> > I need just Contact: <sip:009122692405xx at 10.52.26.98:5060> instead of,
> > Contact: <sip:0091692405xx at 45.118.162.x:5080;alias=10.52.26.102~5080~1>
> >
> >
> > On Tue, Aug 2, 2022 at 12:56 PM Alex Balashov <abalashov at evaristesys.com>
> wrote:
> > The suggestion given by Henning was to remove the existing Contact
> header, and replace it with whatever value you like.
> >
> > > On Aug 2, 2022, at 1:12 AM, Ankit Jayswal <ankit.jayswal at engagely.ai>
> wrote:
> > >
> > > Hello,
> > > Whenever I try the remove_hf("Contact") function the call leg is
> divided into the two parts and the call is not getting set up properly and
> not progressing.
> > > I am just looking for a function that can modify the Contact header
> value of an existing Contact header.
> > >
> > > On Mon, Aug 1, 2022 at 8:31 PM Henning Westerholt <hw at gilawa.com>
> wrote:
> > > Hello,
> > >
> > >
> > >
> > > you need to do a “remove_hf(“Contact”)” before.
> > >
> > >
> > >
> > > Cheers,
> > >
> > >
> > >
> > > Henning
> > >
> > >
> > >
> > > --
> > >
> > > Henning Westerholt – https://skalatan.de/blog/
> > >
> > > Kamailio services – https://gilawa.com
> > >
> > >
> > >
> > > From: Ankit Jayswal <ankit.jayswal at engagely.ai>
> > > Sent: Monday, August 1, 2022 4:26 PM
> > > To: Henning Westerholt <hw at gilawa.com>
> > > Cc: Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>;
> Amey Naik <amey.naik at engagely.ai>; Devanand Jalla <
> devanand.jalla at engagely.ai>
> > > Subject: Re: [SR-Users] Contact header modification - Kamailio
> > >
> > >
> > >
> > > Hello,
> > > Thanks for your reply, but I am looking to replace the value in the
> Contact header. Which function can help me to do this ?
> > > I tried,
> > > assign_hf_value("Contact", "<sip:00912269240xxx at 10.52.26.98:5060>");
> > >
> > >
> > > But that is not working properly, it assigns value but previous value
> also remains in it.
> > >
> > >
> > >
> > > On Mon, Aug 1, 2022 at 6:11 PM Henning Westerholt <hw at gilawa.com>
> wrote:
> > >
> > > Hello,
> > >
> > >
> > >
> > > the topos module can do that, among other things. Alternatively there
> is also the topoh module, which do not need any backend storage.
> > >
> > >
> > >
> > > Cheers,
> > >
> > >
> > >
> > > Henning
> > >
> > >
> > >
> > > --
> > >
> > > Henning Westerholt – https://skalatan.de/blog/
> > >
> > > Kamailio services – https://gilawa.com
> > >
> > >
> > >
> > > From: sr-users <sr-users-bounces at lists.kamailio.org> On Behalf Of
> Ankit Jayswal
> > > Sent: Monday, August 1, 2022 2:37 PM
> > > To: sr-users at lists.kamailio.org
> > > Cc: Amey Naik <amey.naik at engagely.ai>; Devanand Jalla <
> devanand.jalla at engagely.ai>
> > > Subject: [SR-Users] Contact header modification - Kamailio
> > >
> > >
> > >
> > > Hello Team,
> > >
> > > I am in need to modify the contact header in Kamailio before sending
> an INVITE request to the SIP trunk provider. Basically the IP address I
> need to modify in the contact header. Please suggest a better way to do
> this. Below is an example.
> > >
> > > OLD (Existing):
> > >
> > > Contact: <sip:009169240xxx at 45.118.162.x:5080;alias=10.52.26.102~5080~1
> >
> > >
> > >
> > >
> > > NEW (Needed):
> > >
> > > Contact: <sip:00912269240xxx at 10.52.26.98:5060>
> > >
> > > I tried various functions from the textops module but no hope.
> > > I am looking for a function that can replace the contact header's
> value. Please help me with this.
> > >
> > >
> > >
> > > --
> > >
> > > Thanks & Regards,
> > > Ankit Jayswal | Specialist - Software Development
> > >
> > > __________________________________________________________
> > > Kamailio - Users Mailing List - Non Commercial Discussions
> > >  * sr-users at lists.kamailio.org
> > > Important: keep the mailing list in the recipients, do not reply only
> to the sender!
> > > Edit mailing list options or unsubscribe:
> > >  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> >
> > --
> > Alex Balashov | Principal | Evariste Systems LLC
> >
> > Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
> > Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
> >
> >
> > __________________________________________________________
> > Kamailio - Users Mailing List - Non Commercial Discussions
> >   * sr-users at lists.kamailio.org
> > Important: keep the mailing list in the recipients, do not reply only to
> the sender!
> > Edit mailing list options or unsubscribe:
> >   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> > __________________________________________________________
> > Kamailio - Users Mailing List - Non Commercial Discussions
> >  * sr-users at lists.kamailio.org
> > Important: keep the mailing list in the recipients, do not reply only to
> the sender!
> > Edit mailing list options or unsubscribe:
> >  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
> --
> Alex Balashov | Principal | Evariste Systems LLC
>
> Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
> Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220804/548eb324/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 99045 bytes
Desc: not available
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220804/548eb324/attachment.png>


More information about the sr-users mailing list