<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Hi There, </div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
If I look at the latest SIP trace you shared:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
SIP/2.0 200 OK
<div>Via: SIP/2.0/UDP 64.###.###.###:5060;branch=z9hG4bK26ab.5547ac15.0</div>
<div>Via: SIP/2.0/UDP 206.###.###.###:5060;rport=5060;received=206.###.###.###;branch=z9hG4bK6gj48a00dolcl3jm2gq0.1</div>
<div>Record-Route: <sip:10.###.###.254;r2=on;lr=on;ftag=as04035ef0></div>
<div>Record-Route: <sip:209.###.###.###;r2=on;lr=on;ftag=as04035ef0></div>
<div>Record-Route: <sip:64.###.###.###;lr;ftag=as04035ef0></div>
<div>From: "Anonymous" <sip:anonymous@anonymous.invalid:5060>;tag=as04035ef0</div>
<div>To: <sip:928#######@64.###.###.###:5060>;tag=as7047ed05</div>
<div>Call-ID: 5ab1525b3712f34c2ab272ae55e649e5@10.44.###.###:5060</div>
<div>CSeq: 102 INVITE</div>
<div>Server: Asterisk PBX 16.18.0</div>
<div>Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE</div>
<div>Supported: replaces, timer</div>
<div>Contact: <sip:928#######@10.###.###.104:5060></div>
<div>Content-Type: application/sdp</div>
<div>Content-Length: 274</div>
<div><br>
</div>
<div>v=0</div>
<div>o=root 1911037741 1911037741 IN IP4 209.###.###.###</div>
<div>s=Asterisk PBX 16.18.0</div>
<div>c=IN IP4 209.###.###.###</div>
<div>t=0 0</div>
<div>m=audio 11384 RTP/AVP 0 101</div>
<div>a=rtpmap:0 PCMU/8000</div>
<div>a=rtpmap:101 telephone-event/8000</div>
<div>a=fmtp:101 0-16</div>
<div>a=ptime:20</div>
<div>a=maxptime:150</div>
<div>a=sendrecv</div>
<div>a=nortpproxy:yes</div>
<div><br>
</div>
<div>ACK sip:928#######@209.###.###.###:5060 SIP/2.0</div>
<div>Via: SIP/2.0/UDP 64.###.###.###:5060;branch=z9hG4bK26ab.5547ac15.2</div>
<div>Via: SIP/2.0/UDP 206.###.###.###:5060;rport=5060;received=206.###.###.###;branch=z9hG4bK91l3it006gr9oiulcqn0.1</div>
<div>Max-Forwards: 67</div>
<div>From: "Anonymous" <sip:anonymous@anonymous.invalid:5060>;tag=as04035ef0</div>
<div>To: <sip:928#######@64.###.###.###:5060>;tag=as7047ed05</div>
<div>Contact: <sip:anonymous@206.###.###.###:5060;transport=udp></div>
<div>Call-ID: 5ab1525b3712f34c2ab272ae55e649e5@10.44.###.###:5060</div>
<div>CSeq: 102 ACK</div>
<div>User-Agent: packetrino</div>
<div>Content-Length: 0</div>
<div>Route: <sip:209.###.###.###;r2=on;lr=on;ftag=as04035ef0></div>
Route: <sip:10.###.###.254;r2=on;lr=on;ftag=as04035ef0><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
The ACK is getting sent to the Kamailio with correct Route information:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="margin:0px; background-color:rgb(255,255,255)">Route: <sip:209.###.###.###;r2=on;lr=on;ftag=as04035ef0> </span><br>
<span style="background-color:rgb(255,255,255); display:inline!important">Route: <sip:10.###.###.254;r2=on;lr=on;ftag=as04035ef0> </span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
The Kamailio server should strip the 1<sup>st</sup> and 2<sup>nd</sup> Route(s) header from the ACK and should relay it towards the next-hop as per the request URI. Please note that Kamailio is sending Double RR headers ( When a Proxy receives a request on
 one network interface and sends it onwards using a different interface e.g. WAN to LAN, this will normally require the addition of an extra Record-Route header. i.e. the Proxy must add two RR headers where you might normally expect it to add one.)</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><span><br>
</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><span><span style="margin:0px; background-color:rgb(255,255,255)">Record-Route: <sip:10.###.###.254;</span><span style="margin:0px; background-color:rgb(255,255,0)">r2=on</span><span style="margin:0px; background-color:rgb(255,255,255)">;lr=on;ftag=as04035ef0> </span>
<div style="margin:0px; background-color:rgb(255,255,255)">Record-Route: <sip:209.###.###.###;<span style="background-color:rgb(255,255,0)">r2=on</span>;lr=on;ftag=as04035ef0> </div>
</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><span><br>
</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
The problem is, the peer behavior is not compliant with the specs. It is sending the ACK with RURI set to:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255, 255, 255);display:inline !important">ACK sip:</span><span style="background-color: rgb(255, 255, 0); display: inline !important;">928#######@</span><span style="background-color: rgb(255, 255, 0); display: inline !important;">209.###.###.###</span><span style="background-color: rgb(255, 255, 0); display: inline !important;">:5060</span><span style="background-color:rgb(255, 255, 255);display:inline !important">
 SIP/2.0</span><br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255, 255, 255);display:inline !important">Ideally, it should have sent the ACK with the following Request-URI:</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255, 255, 255);display:inline !important"><span style="background-color:rgb(255, 255, 255);display:inline !important"><span> ACK </span>sip:</span><span style="background-color: rgb(0, 255, 0); display: inline !important;">928#######@10.###.###.104:5060</span><span style="background-color:rgb(255, 255, 255);display:inline !important"> <span style="background-color:rgb(255, 255, 255);display:inline !important">SIP/2.0</span></span><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><span><br>
</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><span>Once this ACK will be received on Kamailio, it will relay it towards the Asterisk IP, which is <span style="background-color:rgb(255, 255, 255);display:inline !important">10.###.###.104.</span></span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><span><br>
</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><span>For further understanding of the ACK routing, you can refer to the following post:</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><span><br>
</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><span><a href="https://lists.cs.columbia.edu/pipermail/sip-implementors/2019-February/031229.html" id="LPlnk185119">https://lists.cs.columbia.edu/pipermail/sip-implementors/2019-February/031229.html</a><br>
</span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important">The peer is not copying the 200 OK Contact header URI into the ACK message and it is a problem. </span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important">Lastly, the trace might be showing only part of the puzzle, it is also suggested to get a capture on the remote peer end, because it is sending the <span style="background-color:rgb(255, 255, 255);display:inline !important">209.###.###.###
 IP in the ACK, which seems to be the public interface of the Kamailio server. I am not sure if there is some device in the path, that is changing the contact IP in the 200 OK to the Kamailio public IP? </span></span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important">Ovidiu also explained the same point, I just added a little bit more information for you to fight with your SIP provider. It is better to ask what RFC they are following on the basis
 of which they are writing the Kamailio public IP in the 200 OK ACK message?<br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important"><br>
</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<span style="background-color:rgb(255,255,255); display:inline!important">Regards,</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Shah Hussain</div>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div id="appendonsend"></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> sr-users <sr-users-bounces@lists.kamailio.org> on behalf of Chad <ccolumbu@hotmail.com><br>
<b>Sent:</b> Sunday, January 16, 2022 10:14 AM<br>
<b>To:</b> Ovidiu Sas <osas@voipembedded.com><br>
<b>Cc:</b> Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org><br>
<b>Subject:</b> Re: [SR-Users] Help with rewriting headers for NAT manually</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Ok so in short I was not doing anything wrong (although I had some miss-configurations), but the carrier is (i.e. they
<br>
are a bad actor). When they said I was doing it wrong, they did not mean in the RFC sense they meant in the "to work
<br>
with us" sense. Now in order for me to get it to work with their SBC I have to mangle the contact on the way out an
<br>
unmangle it on the return in Kamailio somehow, as I originally purposed.<br>
However I have no idea how to do that :)<br>
<br>
Shouldn't we (the Kamailio community) assume there are lots of bad actors out there and possibly many Kamailio users
<br>
with this exact same issue (I personally know of at least 2 bad actor carriers right now) and create some kind of
<br>
template or snippet that we can publicly publish on the Kamailio docs or wiki for all of the Kamailio community to use
<br>
for this use case?<br>
<br>
I have been fighting with carriers about this for years and they always said I was doing it wrong and I don't know the
<br>
SIP RFC well enough to fight back. So why not build a solution for everyone out there that has to deal with a bad actor?<br>
<br>
--<br>
^C<br>
<br>
<br>
On 1/15/22 11:40 AM, Ovidiu Sas wrote:<br>
> As expected, your carrier is bogus and "thinks" it knows better.<br>
> Your carrier is treating your setup as a dumb endpoint and is<br>
> re-writing the Contact header:<br>
> You provide this contact header in 200 OK:<br>
> Contact: <sip:928#######@10.###.###.104:5060><br>
> The carrier should set the RURI in ACK like this:<br>
> ACK sip:928#######@10.###.###.104:5060 SIP/2.0<br>
> Instead, your ACK is sent to you like this:<br>
> ACK sip:928#######@209.###.###.###:5060 SIP/2.0<br>
> <br>
> The RURI in ACK should point to the private IP of the asterisk server,<br>
> not to the public IP of the kamailio server.<br>
> You need to ask the carrier to follow the SIP RFC and not treat your<br>
> endpoints like dumb SIP endpoints.<br>
> <br>
> There's a high chance that they won't do it :)<br>
> Your best chance is to manually mangle the URI in Contact in the 200<br>
> OK in a way that when you receive the ACK with the mangled RURI, you<br>
> can restore the original URI and let kamailio do the proper routing to<br>
> the private IP of the asterisk serverr.<br>
> You should be able to achieve this by using one of the following functions:<br>
> <a href="https://kamailio.org/docs/modules/5.5.x/modules/mangler.html#mangler.f.encode_contact">
https://kamailio.org/docs/modules/5.5.x/modules/mangler.html#mangler.f.encode_contact</a><br>
> <a href="https://kamailio.org/docs/modules/5.5.x/modules/siputils.html#siputils.f.encode_contact">
https://kamailio.org/docs/modules/5.5.x/modules/siputils.html#siputils.f.encode_contact</a><br>
> <a href="https://kamailio.org/docs/modules/5.5.x/modules/siputils.html#siputils.f.contact_param_encode">
https://kamailio.org/docs/modules/5.5.x/modules/siputils.html#siputils.f.contact_param_encode</a><br>
> <br>
> Regards,<br>
> Ovidiu Sas<br>
> <br>
> On Sat, Jan 15, 2022 at 1:28 PM Chad <ccolumbu@hotmail.com> wrote:<br>
>><br>
>> I changed the listen per your advice and here is the 200 and ACK.<br>
>> I get no audio and the the call disconnects and I see this is the Asterisk log:<br>
>> [Jan 15 10:17:13] WARNING[29953] chan_sip.c: Retransmission timeout reached on transmission<br>
>> 5ab1525b3712f34c2ab272ae55e649e5@10.44.109.143:5060 for seqno 102 (Critical Response) -- See<br>
>> <a href="https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions">https://wiki.asterisk.org/wiki/display/AST/SIP+Retransmissions</a><br>
>> Packet timed out after 6401ms with no response<br>
>> [Jan 15 10:17:13] WARNING[29953] chan_sip.c: Hanging up call 5ab1525b3712f34c2ab272ae55e649e5@10.44.109.143:5060 - no<br>
>> reply to our critical packet (see <a href="https://wiki.asterisk.org/wik">https://wiki.asterisk.org/wik</a><br>
>><br>
>> FYI 10.###.###.254 is the private virtual IP on the Kamailio server and 10.###.###.104 is the asterisk box.<br>
>><br>
>> SIP/2.0 200 OK<br>
>> Via: SIP/2.0/UDP 64.###.###.###:5060;branch=z9hG4bK26ab.5547ac15.0<br>
>> Via: SIP/2.0/UDP 206.###.###.###:5060;rport=5060;received=206.###.###.###;branch=z9hG4bK6gj48a00dolcl3jm2gq0.1<br>
>> Record-Route: <sip:10.###.###.254;r2=on;lr=on;ftag=as04035ef0><br>
>> Record-Route: <sip:209.###.###.###;r2=on;lr=on;ftag=as04035ef0><br>
>> Record-Route: <sip:64.###.###.###;lr;ftag=as04035ef0><br>
>> From: "Anonymous" <sip:anonymous@anonymous.invalid:5060>;tag=as04035ef0<br>
>> To: <sip:928#######@64.###.###.###:5060>;tag=as7047ed05<br>
>> Call-ID: 5ab1525b3712f34c2ab272ae55e649e5@10.44.###.###:5060<br>
>> CSeq: 102 INVITE<br>
>> Server: Asterisk PBX 16.18.0<br>
>> Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE<br>
>> Supported: replaces, timer<br>
>> Contact: <sip:928#######@10.###.###.104:5060><br>
>> Content-Type: application/sdp<br>
>> Content-Length: 274<br>
>><br>
>> v=0<br>
>> o=root 1911037741 1911037741 IN IP4 209.###.###.###<br>
>> s=Asterisk PBX 16.18.0<br>
>> c=IN IP4 209.###.###.###<br>
>> t=0 0<br>
>> m=audio 11384 RTP/AVP 0 101<br>
>> a=rtpmap:0 PCMU/8000<br>
>> a=rtpmap:101 telephone-event/8000<br>
>> a=fmtp:101 0-16<br>
>> a=ptime:20<br>
>> a=maxptime:150<br>
>> a=sendrecv<br>
>> a=nortpproxy:yes<br>
>><br>
>> ACK sip:928#######@209.###.###.###:5060 SIP/2.0<br>
>> Via: SIP/2.0/UDP 64.###.###.###:5060;branch=z9hG4bK26ab.5547ac15.2<br>
>> Via: SIP/2.0/UDP 206.###.###.###:5060;rport=5060;received=206.###.###.###;branch=z9hG4bK91l3it006gr9oiulcqn0.1<br>
>> Max-Forwards: 67<br>
>> From: "Anonymous" <sip:anonymous@anonymous.invalid:5060>;tag=as04035ef0<br>
>> To: <sip:928#######@64.###.###.###:5060>;tag=as7047ed05<br>
>> Contact: <sip:anonymous@206.###.###.###:5060;transport=udp><br>
>> Call-ID: 5ab1525b3712f34c2ab272ae55e649e5@10.44.###.###:5060<br>
>> CSeq: 102 ACK<br>
>> User-Agent: packetrino<br>
>> Content-Length: 0<br>
>> Route: <sip:209.###.###.###;r2=on;lr=on;ftag=as04035ef0><br>
>> Route: <sip:10.###.###.254;r2=on;lr=on;ftag=as04035ef0><br>
>><br>
>><br>
>> --<br>
>> ^C<br>
>><br>
>><br>
>> On 1/15/22 10:21 AM, Ovidiu Sas wrote:<br>
>>> This is false. The IP in the Contact header must be routable by the<br>
>>> SIP hop from the top Record-Route header in the reply.<br>
>>> The carrier (and it seems that they have a PROXY also) must be able to<br>
>>> route to their adjacent SIP hop, which is your public IP (the IP in<br>
>>> the second Record-Route header).<br>
>>> It seems that the carrier is not taking into account that they might<br>
>>> interface with other proxies.<br>
>>> Most likely, your carrier expects to interface with a simple SIP UA,<br>
>>> not with another proxy. This is a pretty common setup for most of the<br>
>>> carriers, although many new carrier implementations are taking care of<br>
>>> the proxy to proxy calls.<br>
>>><br>
>>> It would be helpful to see the ACK that is sent by the carrier in<br>
>>> response to your 200ok (after you fix your config and you have your<br>
>>> private IP listed in the Record-Route header).<br>
>>><br>
>>> -ovidiu<br>
>>><br>
>>> On Sat, Jan 15, 2022 at 12:33 PM Chad <ccolumbu@hotmail.com> wrote:<br>
>>>><br>
>>>> Hmm, I don't think you are right that the Contact header can be a private IP even if the RR is correct.<br>
>>>> I did some research on it and I found several places saying it must be a routable IP which is what the carrier also said.<br>
>>>><br>
>>>> "The Contact header contains the SIP URI where the client wants to be contacted for subsequent requests. That means that<br>
>>>> the host part of the URI must be globally reachable by anyone.<br>
>>>> If your contact contains a private IP (behind a NAT?) then it is wrong, because other peers cannot reach you with that."<br>
>>>><br>
>>>><br>
>>>> --<br>
>>>> ^C<br>
>>>><br>
>>>><br>
>>>> On 1/15/22 9:05 AM, Ovidiu Sas wrote:<br>
>>>>> You have a different problem then.<br>
>>>>> Having private IPs in Contact is fine. You need to lose route the<br>
>>>>> calls (kamailio will add two Record-Route headers) and the origination<br>
>>>>> server will set the RURI to the private IP from Contact, but it will<br>
>>>>> send the in-dialog requests to the public IP of kamailio. This has<br>
>>>>> nothing to do with virtual IPs.<br>
>>>>> Maybe you have a buggy client that doesn't do proper loose routing.<br>
>>>>><br>
>>>>> -ovidiu<br>
>>>>><br>
>>>>> On Sat, Jan 15, 2022 at 11:50 AM Chad <ccolumbu@hotmail.com> wrote:<br>
>>>>>><br>
>>>>>> Ovidiu,<br>
>>>>>> Thank you again for your response.<br>
>>>>>> One is public (an internet IP) and one is private (a 10.x ip).<br>
>>>>>> Apparently this is a known problem with virtual IPs, it does not work.<br>
>>>>>> When the asterisk server responds to the invite it sends a contact header with the private IP and Kamailio does not<br>
>>>>>> rewrite it to the advertised public IP. So the originating server sees the private IP in the Contact header and tries to<br>
>>>>>> send the traffic to the 10.x IP (which is non-routable) and the call dies.<br>
>>>>>> I have been trying things for a long time to fix this (years) what you are saying will not fix it because of the virtual<br>
>>>>>> IPs.<br>
>>>>>> If it was a normal IP it would work fine. It has something to do with the routing table and how mhomed detects networks.<br>
>>>>>><br>
>>>>>> --<br>
>>>>>> ^C<br>
>>>>>><br>
>>>>>><br>
>>>>>> On 1/15/22 8:36 AM, Ovidiu Sas wrote:<br>
>>>>>>> Hello Chad,<br>
>>>>>>><br>
>>>>>>> The floating IPs that you have, are they both private IPs or one<br>
>>>>>>> private IP and the other one a public IP?<br>
>>>>>>><br>
>>>>>>> If you have to two floating private IPs, then you need a config like this:<br>
>>>>>>> listen=FLOATING_UDP_PRIVATE1 advertise PUBLIC_UDP_IP<br>
>>>>>>> listen=FLOATING_UDP_PRIVATE2<br>
>>>>>>><br>
>>>>>>> In the config, before relaying the initial INVITE you need to detect<br>
>>>>>>> the direction of the call and set $fs accordingly:<br>
>>>>>>> if (CAL_FROM_PRIVATE_TO_PUBLIC) {<br>
>>>>>>>         $fs = udp:FLOATING_UDP_PRIVATE1<br>
>>>>>>> }<br>
>>>>>>> else {<br>
>>>>>>>         $fs = udp:FLOATING_UDP_PRIVATE2<br>
>>>>>>> }<br>
>>>>>>><br>
>>>>>>> If you have a floating private IPs and a floating public IP, then you<br>
>>>>>>> need a config like this:<br>
>>>>>>> listen=FLOATING_UDP_PRIVATE<br>
>>>>>>> listen=FLOATING_UDP_PUBLIC<br>
>>>>>>><br>
>>>>>>> There should be no need to force the socket, but if you do, there's no<br>
>>>>>>> harm (actually it's better and faster).<br>
>>>>>>><br>
>>>>>>> Hope this clarifies things and helps,<br>
>>>>>>> -ovidiu<br>
>>>>>>><br>
>>>>>>> On Sat, Jan 15, 2022 at 9:48 AM Chad <ccolumbu@hotmail.com> wrote:<br>
>>>>>>>><br>
>>>>>>>> Ovidiu,<br>
>>>>>>>> Thank you for your response.<br>
>>>>>>>><br>
>>>>>>>> I have done that, in addition to the linux ip_nonlocal_bind I have also set the Kamailio ip_free_bind=1 and it does not<br>
>>>>>>>> work.<br>
>>>>>>>> Here are my relevant config lines:<br>
>>>>>>>> listen=LISTEN_UDP_PRIVATE advertise MY_PUBLIC_IP:5060<br>
>>>>>>>> listen=LISTEN_UDP_PUBLIC<br>
>>>>>>>><br>
>>>>>>>> mhomed=1<br>
>>>>>>>> ip_free_bind=1<br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>> In my /etc/sysctl.conf I have (yes I applied it with sysctl -p, and I have been using it for a long time and have<br>
>>>>>>>> rebooted as well):<br>
>>>>>>>> net.ipv4.ip_nonlocal_bind=1<br>
>>>>>>>> --<br>
>>>>>>>> ^C<br>
>>>>>>>><br>
>>>>>>>><br>
>>>>>>>> On 1/15/22 4:55 AM, Ovidiu Sas wrote:<br>
>>>>>>>>> Hello Chad,<br>
>>>>>>>>><br>
>>>>>>>>> You can add a listen directive to your config for the virtual IPs<br>
>>>>>>>>> (both public and private) and then you don't need to manually modify<br>
>>>>>>>>> any headers or use force_send_socket().<br>
>>>>>>>>> You need to enable non local IP binding so kamailio can start on the<br>
>>>>>>>>> server that doesn't have the virtual IP:<br>
>>>>>>>>> echo 1 > /proc/sys/net/ipv4/ip_nonlocal_bind<br>
>>>>>>>>> To make the change permanent, edit your sysctl.conf file and enable it there:<br>
>>>>>>>>> net/ipv4/ip_nonlocal_bind = 1<br>
>>>>>>>>><br>
>>>>>>>>> Regards<br>
>>>>>>>>> Ovidiu Sas<br>
>>>>>>>>><br>
>>>>>>>>><br>
>>>>>>>>> On Sat, Jan 15, 2022 at 4:16 AM Chad <ccolumbu@hotmail.com> wrote:<br>
>>>>>>>>>><br>
>>>>>>>>>> We are looking for some help (possibly a paid consultant) to help us with our Kamailio setup.<br>
>>>>>>>>>> To keep this as short as possible: we use Kamailio as a NAT proxy to bridge our external IP and our private IP asterisk<br>
>>>>>>>>>> servers (via dispatcher).<br>
>>>>>>>>>> However both the external IP and the internal IP that the Kamailio server uses are virtual IPs created by keepalived.<br>
>>>>>>>>>> Because of that neither mhomed nor fix_nated_contact work, and we use force_send_socket to direct the traffic.<br>
>>>>>>>>>> We run linux Debian 10 for the OS.<br>
>>>>>>>>>> Also we do not use a DB at all, everything is done with local config files.<br>
>>>>>>>>>><br>
>>>>>>>>>> The problem is that when traffic goes out the Contact header has a private IP in it, like:<br>
>>>>>>>>>> Contact: <sip:##########@10.10.10.###]:5060><br>
>>>>>>>>>><br>
>>>>>>>>>> There are 2 possible solutions to this:<br>
>>>>>>>>>> 1. Make changes to linux, keepalived and/or Kamailio so that Kamailio recognize the virtual IPs so that mhomed and<br>
>>>>>>>>>> fix_nated_contact work as usual.<br>
>>>>>>>>>><br>
>>>>>>>>>> 2. Create a manual header rewrite system.<br>
>>>>>>>>>><br>
>>>>>>>>>> If solution #2:<br>
>>>>>>>>>> What we need to do is create a way to rewrite the contact header to the external IP on the way out, and on the way back<br>
>>>>>>>>>> rewrite it back to the internal server that the call is already connected to.<br>
>>>>>>>>>><br>
>>>>>>>>>> Not sure if we will need to store those paths on the server or if we can do some kind of cheat with another persistant<br>
>>>>>>>>>> header like P-Preferred-Identity or P-Asserted-Identity (i.e. store the internal IP in the name field or something).<br>
>>>>>>>>>><br>
>>>>>>>>>> If anyone out there know of a way to do this or wants to give it a try please reach out to me.<br>
>>>>>>>>>><br>
>>>>>>>>>> Thank you all for your time.<br>
>>>>>>>>>><br>
>>>>>>>>>> --<br>
>>>>>>>>>> ^C<br>
>>>>>>>>>> Chad<br>
>>>>>>>>>><br>
>>>>>>>>>> __________________________________________________________<br>
>>>>>>>>>> Kamailio - Users Mailing List - Non Commercial Discussions<br>
>>>>>>>>>>        * sr-users@lists.kamailio.org<br>
>>>>>>>>>> Important: keep the mailing list in the recipients, do not reply only to the sender!<br>
>>>>>>>>>> Edit mailing list options or unsubscribe:<br>
>>>>>>>>>>        * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
>>>>>>>>><br>
>>>>>>>>><br>
>>>>>>>>><br>
>>>>>>>>> --<br>
>>>>>>>>> VoIP Embedded, Inc.<br>
>>>>>>>>> <a href="http://www.voipembedded.com">http://www.voipembedded.com</a><br>
>>>>>>>>><br>
>>>>>>>>> __________________________________________________________<br>
>>>>>>>>> Kamailio - Users Mailing List - Non Commercial Discussions<br>
>>>>>>>>>        * sr-users@lists.kamailio.org<br>
>>>>>>>>> Important: keep the mailing list in the recipients, do not reply only to the sender!<br>
>>>>>>>>> Edit mailing list options or unsubscribe:<br>
>>>>>>>>>        * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
>>>>>>><br>
>>>>>>><br>
>>>>>>><br>
>>>>><br>
>>>>><br>
>>>>><br>
>>><br>
>>><br>
>>><br>
> <br>
> <br>
> <br>
<br>
__________________________________________________________<br>
Kamailio - Users Mailing List - Non Commercial Discussions<br>
  * sr-users@lists.kamailio.org<br>
Important: keep the mailing list in the recipients, do not reply only to the sender!<br>
Edit mailing list options or unsubscribe:<br>
  * <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</div>
</span></font></div>
</body>
</html>