PJSIP: no audio on bridge between trunks

Hello there,

I have the following setup:

WebAPP <----> twilio PJSIP Trunk <----> Asterisk 16_16 <----> Cisco Gateway <----> PSTN

Anybody at the PSTN can call to my phone number, the cisco gateway answer the call and transfer it to my asterisk. Asterisk answer the call and transfer it to twilio PJSIP Trunk. My users answer the call from a web application connected to the twilio service. Everything on this scenario works properly.

My Problem is when I try to call from the WebAPP to a PSTN number, any RTP that comes from Twilio arrives to Asterisk but are not sent to cisco. The weird part is that every RTP that came from the PSTN through cisco, asterisk and then twilio arrives to the webApp.

When I receive the call from twilio, I just modify the default contexts in order to add an “Answer(500)” before the “Dial()”.

I’ll really appreciate any clue about it.

Best regards,

Carlos

This URL gives you a google document with the configurations and the call log:

After check logs and network packets captures, I noticed that the RTP packets comming from Twilio arrives to asterisk but asterisk is not using them… I don’t know why.

Do they show up when “rtp set debug on” is done? Do you have a firewall in place on the system? A packet capture occurs before firewall.

I’m capturing the packages using tcpdump at the same asterisk. Inside the pcap file are the RTP packets that came from twilio… in that way a firewall is discarted.

Executing “rtp set debug on” I only can see the following all the time:

[2023-09-21 18:08:41] VERBOSE[27217][C-0000001f] res_rtp_asterisk.c: Got RTP packet from 172.24.1.31:46154 (type 00, seq 046554, ts 684855816, len 000160)
[2023-09-21 18:08:41] VERBOSE[27217][C-0000001f] res_rtp_asterisk.c: Sent RTP packet to 3.122.181.108:17234 (type 00, seq 002302, ts 684855816, len 000160)
[2023-09-21 18:08:41] VERBOSE[27217][C-0000001f] res_rtp_asterisk.c: Got RTP packet from 172.24.1.31:46154 (type 00, seq 046555, ts 684855976, len 000160)
[2023-09-21 18:08:41] VERBOSE[27217][C-0000001f] res_rtp_asterisk.c: Sent RTP packet to 3.122.181.108:17234 (type 00, seq 002303, ts 684855976, len 000160)
[2023-09-21 18:08:41] VERBOSE[27217][C-0000001f] res_rtp_asterisk.c: Got RTP packet from 172.24.1.31:46154 (type 00, seq 046556, ts 684856136, len 000160)
[2023-09-21 18:08:41] VERBOSE[27217][C-0000001f] res_rtp_asterisk.c: Sent RTP packet to 3.122.181.108:17234 (type 00, seq 002304, ts 684856136, len 000160)
[2023-09-21 18:08:41] VERBOSE[27217][C-0000001f] res_rtp_asterisk.c: Got RTP packet from 172.24.1.31:46154 (type 00, seq 046557, ts 684856296, len 000160)
[2023-09-21 18:08:41] VERBOSE[27217][C-0000001f] res_rtp_asterisk.c: Sent RTP packet to 3.122.181.108:17234 (type 00, seq 002305, ts 684856296, len 000160)
[2023-09-21 18:08:41] VERBOSE[27217][C-0000001f] res_rtp_asterisk.c: Got RTP packet from 172.24.1.31:46154 (type 00, seq 046558, ts 684856456, len 000160)
[2023-09-21 18:08:41] VERBOSE[27217][C-0000001f] res_rtp_asterisk.c: Sent RTP packet to 3.122.181.108:17234 (type 00, seq 002306, ts 684856456, len 000160)

172.24.1.31 is my cisco gateway
3.122.181.108 is the twilio media server

As you can see, I only can send RTP to twilio, but asterisk is not receiving RTP packages from twilio.

And is there a firewall on the system blocking the RTP packets from Twilio?

There is not firewall blocking from Twilio 'cause I receive the RTP packets at the asterisk’s network interface:

But, as you see in logs… Asterisk is ignoring them :cry:

[2023-09-21 18:44:09] VERBOSE[28342][C-00000011] pbx.c: Executing [6@ext-trunk:4] Playback(“PJSIP/freshCaller-00000004”, “silence/1”) in new stack
[2023-09-21 18:44:09] VERBOSE[28342][C-00000011] res_rtp_asterisk.c: Sent RTP packet to 3.122.181.74:16756 (type 00, seq 021193, ts 000160, len 000160)
[2023-09-21 18:44:09] VERBOSE[28342][C-00000011] file.c: <PJSIP/freshCaller-00000004> Playing ‘silence/1.gsm’ (language ‘es’)
[2023-09-21 18:44:09] VERBOSE[28342][C-00000011] res_rtp_asterisk.c: Sent RTP packet to 3.122.181.74:16756 (type 00, seq 021194, ts 000320, len 000160)
[2023-09-21 18:44:09] VERBOSE[28342][C-00000011] res_rtp_asterisk.c: Sent RTP packet to 3.122.181.74:16756 (type 00, seq 021195, ts 000480, len 000160)
[2023-09-21 18:44:09] VERBOSE[28342][C-00000011] res_rtp_asterisk.c: Sent RTP packet to 3.122.181.74:16756 (type 00, seq 021196, ts 000640, len 000160)
[2023-09-21 18:44:10] VERBOSE[28342][C-00000011] res_rtp_asterisk.c: Sent RTP packet to 3.122.181.74:16756 (type 00, seq 021197, ts 000800, len 000160)
[2023-09-21 18:44:10] VERBOSE[28342][C-00000011] res_rtp_asterisk.c: Sent RTP packet to 3.122.181.74:16756 (type 00, seq 021198, ts 000960, len 000160)
[2023-09-21 18:44:10] VERBOSE[28342][C-00000011] res_rtp_asterisk.c: Sent RTP packet to 3.122.181.74:16756 (type 00, seq 021199, ts 001120, len 000160)

Thanks for your attention.

Best regards,

Carlos

That packet capture is BEFORE any firewall on the system. Is there a firewall on the system itself using something like iptables?

iptables and firewalld are disabled on this system.

I can give you pcap and asterisk log if you wish…