Hi Federico,

Thank you so much for your answer and help. 
I know this version is old but it is difficult to change at this time as there are some challenges. I will definitely do the upgrade in the next few months.
Now regarding my issue. It might be silly but, my question is, the NATDETECT route that is on top of request_route is not sufficient to add the alias with the set_contact_alias that the below code has? Why is it not added on the re-invite as it is added on the initial invite?

route[NATDETECT] {

if (nat_uac_test("19")) {
   if (is_method("REGISTER")) {
      fix_nated_register();
   } else {
      if(is_first_hop()) {
         set_contact_alias();
      }
   }
   setflag(FLT_NATS);
}
return;
}

Regards,
Angelo


Στις Τετ 15 Φεβ 2023 στις 8:54 μ.μ., ο/η Federico Cabiddu <federico.cabiddu@gmail.com> έγραψε:
Hi,
your Kamailio version is very old (4.3) and unsupported, so my first advice would be to upgrade to a recent version (5.6.3 is the latest stable).
Anyhow, your problem is not the kamailio version you are using but the fact that the Contact header URI of the re-INVITE 200 OK only contains the private port and not the public one, thus the R-URI in the ACK only contains the private one and Kamailio cannot do anything else than forwarding the ACK there. The 200 OK Contact URI relied to the re-INVITE's sender should contain an 'alias' parameter (like in the re-INVITE R-URI) with the public IP/port. You can add it using natheper's add_contact_alias function (module https://www.kamailio.org/docs/modules/5.6.x/modules/nathelper.html#nathelper.f.add_contact_alias): be sure that you call it in the reply route that processes the 200 OK. Then upon receiving the ACK use handle_ruti_alias function from the same module to forward it to the public/ip/port.
Hope this helps,

Federico

On Wed, Feb 15, 2023 at 7:06 PM Angelo Sipper <sippro97@gmail.com> wrote:
None?

Στις Σάβ 11 Φεβ 2023 στις 5:55 π.μ., ο/η Angelo Sipper <sippro97@gmail.com> έγραψε:
Any sugestions?

Στις Παρ 27 Ιαν 2023 στις 9:04 μ.μ., ο/η Angelo Sipper <sippro97@gmail.com> έγραψε:
Hi,

Any help on this topic?

Regards,
Angelo

Στις Πέμ 26 Ιαν 2023 στις 9:33 μ.μ., ο/η Angelo Sipper <sippro97@gmail.com> έγραψε:
Hi,

My setup has: (TLS)UAC 77.1.1.1 -> (TLS)Kamailio 17.17.17.211 (UDP) -> (UDP)Kamailio 17.17.17.181 (UDP) -> Carrier(UDP)
Both Kamailio are 4.3 with minor modifications on default cfg, and Topoh and TLS modules are used.

I am having an issue on some outbound calls from nated UACs. On these calls our SBC sometimes receives reverse invites from the carrier side within the call. When this happens, my SBC(17.17.17.211) sends the invite to UAC and the UAC sends back 200 OK (SDP). Unfortunately my SBC(17.17.17.211) sends back the ACK not to the correct UAC public port but instead to the UAC internal port making the call to crash with several retries from my SBC to send 200 OK as ACK was never received from UAC!

If you look the below traces of reverse invite past within the call, the reinvite has port private 20125 and alias the public port 2314 of UAC but the ACK bellow is send to 20125  and not to 2314 

2023/01/26 09:48:30.668634 17.17.17.181:5060 -> 17.17.17.211:5060
INVITE sip:301234567890@77.1.1.1:20125;alias=77.1.1.1~2314~1 SIP/2.0
Via: SIP/2.0/UDP 17.17.17.181;branch=z9hG4bK7b5d.78276307977b5b2776919ce1f1e76d49.0
From: <sip:300987654321@sip.mydomain.com>;tag=gK0e80b4b9
To: "301234567890" <sip:301234567890@sip.mydomain.com>;tag=07ece97c
Call-ID: 1q5nE37RGZ8a8ChI6rqShw..
CSeq: 29227 INVITE
Max-Forwards: 69
Allow: INVITE,ACK,CANCEL,BYE,INFO,PRACK,UPDATE,OPTIONS
Accept: application/sdp, application/isup, application/dtmf, application/dtmf-relay,  multipart/mixed
Supported: timer
Session-Expires: 600;refresher=uas
Min-SE: 90
Content-Length:  297
Content-Disposition: session; handling=required
Content-Type: application/sdp
Route: <sip:17.17.17.211;lr;ftag=07ece97c;vsf=AAAAAFpUAgECBwAACnAGAW5FUF4ZXUdDUUhEX1hRUC5ldQ--;vst=AAAAAAAAAAAAAAAAAAAAAABCXkYAQkdeVEJDQVtSVBRQRTYw;did=5fc.669;nat=yes>
Contact: <sip:atpsh-b5-62dfd3a3-cd5ed-1d354@17.17.17.181>

v=0
o=Sonus_UAC 14218 13519 IN IP4 14.1.1.30
s=SIP Media Capabilities
c=IN IP4 14.1.1.30
t=0 0
m=audio 18600 RTP/AVP 8 18 101
a=maxptime:20
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:18 annexb=no
a=fmtp:101 0-15
a=sendrecv
a=rtcp:18601


2023/01/26 09:48:30.679743 17.17.17.211:5060 -> 17.17.17.181:5060
SIP/2.0 100 trying -- your call is important to us
Via: SIP/2.0/UDP 17.17.17.181;branch=z9hG4bK7b5d.78276307977b5b2776919ce1f1e76d49.0;rport=5060
From: <sip:300987654321@sip.mydomain.com>;tag=gK0e80b4b9
To: "301234567890" <sip:301234567890@sip.mydomain.com>;tag=07ece97c
Call-ID: 1q5nE37RGZ8a8ChI6rqShw..
CSeq: 29227 INVITE
Server: Supervoice
Content-Length: 0



2023/01/26 09:48:30.740803 17.17.17.211:5060 -> 77.1.1.1:2314
INVITE sip:301234567890@77.1.1.1:20125 SIP/2.0
Via: SIP/2.0/UDP 17.17.17.211;branch=z9hG4bK7b5d.90b692fac0d1cc8a2ac460a67a02aec9.0
Via: SIP/2.0/UDP 17.17.17.181;rport=5060;branch=z9hG4bK7b5d.78276307977b5b2776919ce1f1e76d49.0
From: <sip:300987654321@17.17.17.211:5060>;tag=gK0e80b4b9
To: "301234567890" <sip:MyTrunk@77.1.1.1:20125>;tag=07ece97c
Call-ID: 1q5nE37RGZ8a8ChI6rqShw..
CSeq: 29227 INVITE
Max-Forwards: 68
Allow: INVITE,ACK,CANCEL,BYE,INFO,PRACK,UPDATE,OPTIONS
Accept: application/sdp, application/isup, application/dtmf, application/dtmf-relay,  multipart/mixed
Supported: timer
Session-Expires: 600;refresher=uas
Min-SE: 90
Content-Length:  297
Content-Disposition: session; handling=required
Content-Type: application/sdp
Contact: <sip:atpsh-b5-62dfd3a3-cd5ed-1d354@17.17.17.181>

v=0
o=Sonus_UAC 14218 13519 IN IP4 14.1.1.28
s=SIP Media Capabilities
c=IN IP4 14.1.1.28
t=0 0
m=audio 13288 RTP/AVP 8 18 101
a=maxptime:20
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:18 annexb=no
a=fmtp:101 0-15
a=sendrecv
a=rtcp:13289


2023/01/26 09:48:30.893512 77.1.1.1:2314 -> 17.17.17.211:5060
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 17.17.17.211;branch=z9hG4bK7b5d.90b692fac0d1cc8a2ac460a67a02aec9.0
Via: SIP/2.0/UDP 17.17.17.181;rport=5060;branch=z9hG4bK7b5d.78276307977b5b2776919ce1f1e76d49.0
To: "301234567890" <sip:MyTrunk@77.1.1.1:20125>;tag=07ece97c
From: <sip:300987654321@17.17.17.211:5060>;tag=gK0e80b4b9
Call-ID: 1q5nE37RGZ8a8ChI6rqShw..
CSeq: 29227 INVITE
Content-Length: 0



2023/01/26 09:48:31.026742 77.1.1.1:2314 -> 17.17.17.211:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP 17.17.17.211;branch=z9hG4bK7b5d.90b692fac0d1cc8a2ac460a67a02aec9.0
Via: SIP/2.0/UDP 17.17.17.181;rport=5060;branch=z9hG4bK7b5d.78276307977b5b2776919ce1f1e76d49.0
Require: timer
Contact: <sip:301234567890@77.1.1.1:20125>
To: "301234567890"<sip:MyTrunk@77.1.1.1:20125>;tag=07ece97c
From: <sip:300987654321@17.17.17.211:5060>;tag=gK0e80b4b9
Call-ID: 1q5nE37RGZ8a8ChI6rqShw..
CSeq: 29227 INVITE
Session-Expires: 600;refresher=uas
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE, UPDATE
Content-Type: application/sdp
Supported: replaces, timer
User-Agent: 3CXPhoneSystem 18.0.6.905 (905)
Content-Length: 259

v=0
o=3cxPS 792019937001472 2393157908037634 IN IP4 77.1.1.1
s=3cxPS Audio call
c=IN IP4 77.1.1.1
t=0 0
m=audio 9054 RTP/AVP 8 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=sendrecv


2023/01/26 09:48:31.093656 17.17.17.211:5060 -> 17.17.17.181:5060
SIP/2.0 200 OK
Via: SIP/2.0/UDP 17.17.17.181;rport=5060;branch=z9hG4bK7b5d.78276307977b5b2776919ce1f1e76d49.0
Require: timer
Contact: <sip:301234567890@77.1.1.1:20125>
To: "301234567890" <sip:301234567890@sip.mydomain.com>;tag=07ece97c
From: <sip:300987654321@sip.mydomain.com>;tag=gK0e80b4b9
Call-ID: 1q5nE37RGZ8a8ChI6rqShw..
CSeq: 29227 INVITE
Session-Expires: 600;refresher=uas
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REGISTER, SUBSCRIBE, NOTIFY, REFER, INFO, MESSAGE, UPDATE
Content-Type: application/sdp
Supported: replaces, timer
User-Agent: 3CXPhoneSystem 18.0.6.905 (905)
Content-Length: 276

v=0
o=3cxPS 792019937001472 2393157908037634 IN IP4 14.1.1.28
s=3cxPS Audio call
c=IN IP4 14.1.1.28
t=0 0
m=audio 13278 RTP/AVP 8 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:18 annexb=no
a=sendrecv
a=rtcp:13279


2023/01/26 09:48:31.254591 17.17.17.181:5060 -> 17.17.17.211:5060
ACK sip:301234567890@77.1.1.1:20125 SIP/2.0
Via: SIP/2.0/UDP 17.17.17.181;branch=z9hG4bK7b5d.48f49235d45a0f6f9efdad9d6d8224bd.0
From: <sip:300987654321@sip.mydomain.com>;tag=gK0e80b4b9
To: "301234567890" <sip:301234567890@sip.mydomain.com>;tag=07ece97c
Call-ID: 1q5nE37RGZ8a8ChI6rqShw..
CSeq: 29227 ACK
Max-Forwards: 69
Content-Length: 0
Route: <sip:17.17.17.211;lr;ftag=07ece97c;vsf=AAAAAFpUAgECBwAACnAGAW5FUF4ZXUdDUUhEX1hRUC5ldQ--;vst=AAAAAAAAAAAAAAAAAAAAAABCXkYAQkdeVEJDQVtSVBRQRTYw;did=5fc.669;nat=yes>
Contact: <sip:atpsh-b5-62dfd3a3-cd5ed-1d354@17.17.17.181>



2023/01/26 09:48:31.260901 17.17.17.211:5060 -> 77.1.1.1:20125
ACK sip:301234567890@77.1.1.1:20125 SIP/2.0
Via: SIP/2.0/UDP 17.17.17.211;branch=z9hG4bK7b5d.e8fb34e79623843d516ae77257014e2d.0
Via: SIP/2.0/UDP 17.17.17.181;rport=5060;branch=z9hG4bK7b5d.48f49235d45a0f6f9efdad9d6d8224bd.0
From: <sip:300987654321@17.17.17.211:5060>;tag=gK0e80b4b9
To: "301234567890" <sip:MyTrunk@77.1.1.1:20125>;tag=07ece97c
Call-ID: 1q5nE37RGZ8a8ChI6rqShw..
CSeq: 29227 ACK
Max-Forwards: 68
Content-Length: 0
Contact: <sip:atpsh-b5-62dfd3a3-cd5ed-1d354@17.17.17.181>

Any help will be much appreciated. 

Thank you!
Regards,
Angelo
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe: