[SR-Users] subst_hf to rewrite a contact header

Ben Hood ben at relops.com
Mon Sep 24 19:27:51 CEST 2018


:-)

The real reason is because I am not getting an ACK back from a 200 OK and I suspected that the remote peer doesn’t like the contact header I’m sending back:

2018/09/24 16:38:19.089883 81.187.30.116:5060 -> 10.10.10.14:5080
INVITE sip:b73c6f29-0101-4802-afcd-efb63f1e6d8f at provider:5060 SIP/2.0
Via: SIP/2.0/UDP 81.187.30.116;branch=z9hG4bK2018092417381900003-1;rport
CSeq: 1 INVITE
Max-Forwards: 68
User-Agent: FireBrick/1.49.016
Call-ID: 2018092417381900003 at 2700-0344-0103-359
From: "07858 592563" <sip:07858592563 at provider>;tag=2018092417381900003
To: <sip:b73c6f29-0101-4802-afcd-efb63f1e6d8f at provider:5060>
Contact: <sip:2018092417381900003 at 81.x.x <sip:2018092417381900003 at 81.x.x>.x>
Content-Type: application/sdp
Content-Length: 188

The 200 that gets no ACK looks like this:

2018/09/24 16:38:20.774332 10.10.10.14:5080 -> 81.x.x.x:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP 81.x.x.x.x;received=81.x.x.x;branch=z9hG4bK2018092417381900003-1;rport=5060
Record-Route: <sip:10.10.10.14:5080;lr;ftag=2018092417381900003>
From: "07858 xxxxxx" <sip:07858xxxxxx at provider>;tag=2018092417381900003
To: <sip:b73c6f29-0101-4802-afcd-efb63f1e6d8f at provider:5060>;tag=22v0rKN4eeN7Q
Call-ID: 2018092417381900003 at 2700-0344-0103-359
CSeq: 1 INVITE
Contact: <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>>
User-Agent: FreeSWITCH-mod_sofia/1.6.13+git~20161129T154639Z~e755b430da~64bit
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY
Supported: timer, path, replaces
Allow-Events: talk, hold, conference, refer
Content-Type: application/sdp
Content-Disposition: session
Content-Length: 224

This is after invoking fix_nated_contact() on the reply.

So I thought I’d try to break the problem down and send back the exact same contact header in the 200 as I received in the original INVITE.

And to do that, I thought the easiest way to just hack this in temporarily was to with subst_hf().

I thought if I can craft the contact header manually and see if that makes a difference.


> On 24 Sep 2018, at 18:02, Alex Balashov <abalashov at evaristesys.com> wrote:
> 
> The real question is, why are you rewriting a Contact header? :-) That
> might be what you're really doing wrong ...
> 
> On Mon, Sep 24, 2018 at 05:54:04PM +0100, Ben Hood wrote:
> 
>> Hi,
>> 
>> I’m wondering how to use subst_hf() properly.
>> 
>> I’m trying to debug a broken flow by manually rewriting the contact header from
>> 
>> Contact: <sip:b73c6f29-0101-4802-afcd-efb63f1e6d8f at 10.10.10.12:5090;transport=udp>
>> 
>> to
>> 
>> Contact: <sip:2018092417381900003 at 81.x.x.x>
>> 
>> by using
>> 
>> $var(ctct) = "<sip:2018092417381900003 at 81.x.x.x>";
>> subst_hf("Contact", “/\<.+\>/$var(ctct)\r\n/", "a”);
>> 
>> but the result is
>> 
>> Contact: <sip:2018092417381900003 at 81.x.x.x>
>> sip:b73c6f29-0101-4802-afcd-efb63f1e6d8f at 10.10.10.12:5090;transport=udp
>> 
>> Testing the regex with an external tool appears to match all of the original header, so I’m wondering why subst_hf doesn’t appear to rewrite the entire header.
>> 
>> Is there something I’m doing wrong?
>> 
>> TIA,
>> 
>> Ben
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org
>> 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 (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/5b8374d3/attachment.html>


More information about the sr-users mailing list