routr icon indicating copy to clipboard operation
routr copied to clipboard

[BUG]: Interop issue with Twilio for outbound calls (ACK not received from the SIP endpoint)

Open psanders opened this issue 11 months ago • 2 comments

What happened?

We are encountering errors when sending calls to Twilio, where the ACK in response to the 200 OK is not received from the SIP endpoint. Twilio either has not received these messages or has deemed them invalid.

Steps to reproduce

  1. Create a SIP domain and an agent.
  2. Create a trunk with outbound settings using Twilio.
  3. Assign one of your Twilio numbers to the trunk you created.
  4. Call a number on the PSTN and observe the signaling.

You will notice that the call hangs after 30 seconds.

Expected behavior

It should work...

Additional context

This only happens for outbound calls.

We should look at testing the same flow with other providers.

I will continue updating this as it is considered a critical signaling issue.

psanders avatar Jan 30 '25 21:01 psanders

Quick update: I tried downgrading JAIN SIP in case it was a regression and ended up with the same issue.

psanders avatar Jan 31 '25 03:01 psanders

After analyzing the signaling, I found several contributing factors adding to this issue.

  1. The CSeq was getting wrongly increased
  2. The VIA header calculation was wrong (and had to create a new alteration)
  3. We were overwriting the contact header, which breaks the SIP protocol

I will continue investigating the issue and testing until I verify that these changes won't break something else.

Also, I noticed that I cannot hang up from the callee side for outbound (to the PSTN) calls.

psanders avatar Feb 01 '25 02:02 psanders