Hi James,

thanks for the reply. Yes, record_route() is used in INVITE request.
Meanwhile I found the cause I think here:
https://community.asterisk.org/t/asterisk-rewrites-record-route-header-with-incorrect-tcp-port/91202

So the Record-Route header contains kamailio’s IP and listening TLS port 443 
until asterisk. When asterisk sends back 200/OK, it rewrites the port and 
client wants to send ACK to this port which is not a listening port of kamailio.
My quick (but don’t know if proper) solution is that in reply route of INVITE I 
check that If replay comes from asterisk, I add the following:


if (route(FROMASTERISK)) {

          remove_hf("Record-Route");

          append_hf("Record-Route: sips:KAMAILIO_IP:443;transport=TLS\r\n");

}

Now the ACK can go back to kamailio which forward it to asterisk.
There was another problem with ACK when it contains private IP, the 
fix_nated_contact() in on_reply route solved this.

Peter


From: James Browne <ja...@frideo.com>
Date: Wednesday, 2023. May 3. 17:17
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Subject: [SR-Users] Re: Kamailio - asterisk - ACK
If the 200-OK to client A also contains Record-Route header fields,
then the routing of the ACK from client A should be done using that
route, not using the internal IP address of asterisk.
Are you using record_route() function from the rr module?

James

On Wed, 26 Apr 2023 at 09:20, Péter Dr. Barabás
<dr.peter.bara...@gmail.com> wrote:
>
> Hi all,
>
>
>
> we are developing a softphone mobile application which registers to asterisk 
> through kamailio. Kamailo proxies the request to asterisk and replies from 
> asterisk to the clients.
>
> Registration works fine with asterisk authentication. The problem appears in 
> the following flow:
>
> Mobile client A calls client B.
> Asterisk gets INVITE through kamailo, sends back 401, and get INVITE with 
> credentials.
> Asterisk sends invite to client B towards kamailio.
> Kamailio forwards INVITE if client is registered or sends a push notification 
> to client B. When client B registers, kamailio continue the suspended 
> transaction and forwards INVITE.
> Client B gets INVITE, sends a SIP OK.
> Asterisk gets SIP OK through kamailio and sends an ACK to client B, which is 
> OK.
> Asterisk sends the SIP OK to client A through kamailio.
> Kamailio forwards SIP OK to client A but the contact address contains the 
> asterisk IP instead kamailio.
> Clilent A try to send ACK but it does not arrive to asterisk, and the call 
> will be hungup after 30 secs.
>
>
>
> So the question is what is missing, what is the correct solution? I try to 
> use the provided configuration given in following link:
>
> https://kb.asipto.com/asterisk:realtime:kamailio-4.0.x-asterisk-11.3.0-astdb
>
>
>
> The difference is that kamailio has no access to asterisk database.
>
>
>
> Thanks for your help.
>
>
>
> With kind regards,
>
> Peter
>
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
> To unsubscribe send an email to sr-users-le...@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-le...@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-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

Reply via email to