I cant see from the log what is happening. There doesnt seem to be anything wrong. But the call always hangs up on 30 seconds when calling into the pbx.
The problems with a PCAP are that you can’t match it up with what Asterisk thinks it is doing; PCAPs are taken before the firewall, so may show packets that never reach Asterisk; and they they can be too noisy and too difficult to redact.
Going back to the original trace, now that I know that the CANCEL is a red herring, you are getting no response to the OK sent to Twilio, which would typically mean that this line in the trace is wrong:
411. Contact: <sip:X.X.X.X:5160>
That would be typically the result of failing to have a valid public signalling address configured.
There is something weird at line 8370. The BYE is sent by TCP when the incoming request, contact, and record route all indicated UDP. I don’t think that is wrong from a SIP point of view, but it suggests that your configuration doesn’t agree with Twilio’s on the choice of transports.
However, the OK’s are sent using UDP, and the Contact header on those doesn’t override the transport, so I don’t see that it explains why there are no ACKs coming back from Twilio, assuming that the OK’s contact header contains the correct address.
As it looks like you probably have transport set to TCP, locally, outbound calls will not be using the same transport as responses to inbound calls, so there could be a problem with outbound UDP to Twilio, but then why have two people reported the problem.
As Twilio obviously accepts TCP, can it be configured to originate TCP?
Are you registering, or are you using IP authentication? In the case of registering, the contact URI in the REGISTER determines the transport. Maybe transport isn’t been set, but Twilio used to force TCP, but now Twilio is honouring the UDP default and that explains why incoming requests are UDP, although not why there is no ACK.
Though not directly related to the Twilio connection, line 531 Via: SIP/2.0/TCP 38.x.x.x:5160;rport=5060;branch=z9hG4bKPj51dda596-7039-45e8-8cfe-430af8081ec1;alias
seems to show that a router/firewall somewhere has external port 5160 forwarded to internal port 5060.
Are you also doing that in the Twilio path? If so, why? The Contact headers sent to Twilio show Asterisk is listening on port 5160, but if the original invite was sent to 5060 that won’t work properly.
I am registering. I have set everything to use TCP now and it still drops the call. The RTP stuff seems to be working. Here is another dropped call log