[BUG]: Interop issue with Twilio for outbound calls (ACK not received from the SIP endpoint)
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
- Create a SIP domain and an agent.
- Create a trunk with outbound settings using Twilio.
- Assign one of your Twilio numbers to the trunk you created.
- 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.
Quick update: I tried downgrading JAIN SIP in case it was a regression and ended up with the same issue.
After analyzing the signaling, I found several contributing factors adding to this issue.
- The CSeq was getting wrongly increased
- The VIA header calculation was wrong (and had to create a new alteration)
- 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.