[SR-Users] subst_hf to rewrite a contact header

Ben Hood ben at relops.com
Mon Sep 24 23:46:44 CEST 2018


The literal contact header (after subst_hf mangling) became

Contact: <sip:2018092417381900003 at 81.x.x.x <sip:2018092417381900003 at 81.x.x.x>>
sip:b73c6f29-0101-4802-afcd-efb63f1e6d8f at 10.10.10.12:5090;transport=udp <sip:b73c6f29-0101-4802-afcd-efb63f1e6d8f at 10.10.10.12:5090;transport=udp>

Which is completely bogus.

I was trying (as a temporary hack) to mangle this to become

Contact: <sip:2018092417381900003 at 81.x.x.x <sip:2018092417381900003 at 81.x.x.x>>

Which would have matched the contact header from the INVITE and then I would have seen whether this affects the subsequent ACK for the 200 OK.

But my usage of subst_hf() turned this (syntactically correct yet uninterpretable) header

Contact: <sip:b73c6f29-0101-4802-afcd-efb63f1e6d8f at 10.10.10.12:5090;transport=udp>

into

Contact: <sip:2018092417381900003 at 81.x.x.x <sip:2018092417381900003 at 81.x.x.x>>
sip:b73c6f29-0101-4802-afcd-efb63f1e6d8f at 10.10.10.12:5090;transport=udp <sip:b73c6f29-0101-4802-afcd-efb63f1e6d8f at 10.10.10.12:5090;transport=udp>

The code for the mangling is this:

$var(ctct) = "<sip:2018092417381900003 at 81.x.x.x <sip:2018092417381900003 at 81.x.x.x>>";
subst_hf("Contact", “/\<.+\>/$var(ctct)\r\n/", "a”);

Which is why I originally asked about how to use subst_hf just to debug the missing ACK.



> On 24 Sep 2018, at 19:25, Alex Balashov <abalashov at evaristesys.com> wrote:
> 
> On Mon, Sep 24, 2018 at 06:27:51PM +0100, Ben Hood wrote:
> 
>> Contact: <sip:2018092417381900003 at 81.x.x <sip:2018092417381900003 at 81.x.x>.x>
> 
> Is this literally your Contact header? If so, it is definitely not
> grammatically valid, and you are entirely right to assume that the
> end-to-end ACK, along with any other in-dialog messages, will not be
> routed from the caller correctly.
> 
> -- 
> 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 (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> 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/20180924/8d952a04/attachment.html>


More information about the sr-users mailing list