Hello community! I would like to ask for your help in solving a case. I thank you in advance for any collaboration.
I have the following setup:
- *Asterisk (internal)* → *Kamailio (Proxy)* → *SIP Provider (PSTN)*
Both Asterisk and Kamailio are under my responsibility.
*Problem:*
When I initiate a call from Asterisk, I use Kamailio as the *outbound proxy*. The *INVITE* is sent to the SIP provider, and the dialogue proceeds normally until the provider responds with a *200 OK*, indicating the call was answered.
However, the *200 OK* received from the provider contains a modification in the *Contact* header, introducing a new IP address into the dialogue. Presumably, this new IP is where the subsequent *ACK* should be sent.
The issue arises when Kamailio receives this *200 OK*: it overwrites the *Contact* field, replacing the received IP with its own LAN IP, used for communication with Asterisk. As a result, Asterisk sends the *ACK* back to Kamailio, which, instead of forwarding it to the new IP from the *Contact* in the *200 OK*, sends it to the SIP provider at the same address used for the initial *INVITE*.
Since the *ACK* does not reach the IP expected by the provider (the new IP introduced in the *Contact*), the provider continues to send repeated *200 OK* responses, until the call is disconnected due to a timeout, as a valid *ACK* was never received.
I looked for conceptual answers in *RFC 3261* to support my conclusions, but I couldn’t clearly relate the information there to the behavior observed in this scenario.
*Key Questions:*
1.
*Should Kamailio forward the ACK to the new IP provided in the Contact header of the 200 OK?* 2.
*Is the SIP provider correct in expecting the ACK to be sent to a different address from the original one used in the INVITE?* 3.
*How can I configure Kamailio to ensure the dialogue proceeds correctly and the ACK is sent to the correct IP?*
You should use the loose_route function from the rr module. Loose Routing is defined in 3261.
1. Maybe. If there are Record-Route header field(s) in the SIP-200 response, then they should be used for routing instead. 2. Yes. If the provider's setup is like yours, with a proxy, then that's the correct way to do it, in which case Record-Route should be used. 3. Understand Loose Routing, and use the loose_route function.
James
On Wed, Sep 18, 2024, 08:51 XPTO via sr-users sr-users@lists.kamailio.org wrote:
Hello community! I would like to ask for your help in solving a case. I thank you in advance for any collaboration.
I have the following setup:
- *Asterisk (internal)* → *Kamailio (Proxy)* → *SIP Provider (PSTN)*
Both Asterisk and Kamailio are under my responsibility.
*Problem:*
When I initiate a call from Asterisk, I use Kamailio as the *outbound proxy*. The *INVITE* is sent to the SIP provider, and the dialogue proceeds normally until the provider responds with a *200 OK*, indicating the call was answered.
However, the *200 OK* received from the provider contains a modification in the *Contact* header, introducing a new IP address into the dialogue. Presumably, this new IP is where the subsequent *ACK* should be sent.
The issue arises when Kamailio receives this *200 OK*: it overwrites the *Contact* field, replacing the received IP with its own LAN IP, used for communication with Asterisk. As a result, Asterisk sends the *ACK* back to Kamailio, which, instead of forwarding it to the new IP from the *Contact* in the *200 OK*, sends it to the SIP provider at the same address used for the initial *INVITE*.
Since the *ACK* does not reach the IP expected by the provider (the new IP introduced in the *Contact*), the provider continues to send repeated *200 OK* responses, until the call is disconnected due to a timeout, as a valid *ACK* was never received.
I looked for conceptual answers in *RFC 3261* to support my conclusions, but I couldn’t clearly relate the information there to the behavior observed in this scenario.
*Key Questions:*
*Should Kamailio forward the ACK to the new IP provided in the Contact header of the 200 OK?* 2.
*Is the SIP provider correct in expecting the ACK to be sent to a different address from the original one used in the INVITE?* 3.
*How can I configure Kamailio to ensure the dialogue proceeds correctly and the ACK is sent to the correct IP?*
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: