Hello Asterisk Community,
We are experiencing a consistent one-way audio issue when placing outbound calls from Asterisk to Twilio SIP Trunk and then to the PSTN.
Problem Summary
-
Outbound calls are established successfully.
-
Audio from Asterisk → Twilio → Callee works correctly (TTS prompts are heard).
-
Audio from Caller → Twilio → Asterisk is not received.
-
Asterisk receives no inbound RTP packets.
-
ARI application generates recordings with only a 44-byte WAV header, indicating no audio data.
Example Recording Log
-
Processing recording file: 44 bytes
-
OUTBOUND CALL DIAGNOSIS: Empty recording (44-byte WAV header only)
-
Confirms no inbound audio is reaching Asterisk.
Audio Path Summary
-
Asterisk → Twilio → Callee: Working
-
Caller → Twilio → Asterisk: Not working
-
Indicates possible NAT, firewall, or RTP traversal issue.
Environment Details
-
Asterisk version: 22.6.0
-
OS: Ubuntu 22.04.5 LTS, Kernel 6.8.0-87-generic
-
Deployment: KVM Virtual Machine
-
Firewall status:
-
UFW: inactive
-
iptables: UDP 5060 and UDP 10000–20000 allowed
-
-
Public IP: 125.22.172.57
-
Device behind NAT: Yes
-
Twilio SIP trunking: UDP, SIP signaling range 54.172.60.0/23
Relevant PJSIP Configuration
Simplified Endpoint Section
-
direct_media=no
-
rtp_symmetric=yes
-
force_rport=yes
-
rewrite_contact=yes
Full PJSIP Configuration
Endpoint
-
type=endpoint
-
transport=0.0.0.0-udp
-
context=from-trunk
-
disallow=all
-
allow=ulaw,alaw,gsm,g726,g722,h264,mpeg4
-
aors=Twilio-Out
-
outbound_auth=Twilio-Out
-
from_domain=microgrid.pstn.twilio.com
-
from_user=17372323899
-
trust_id_inbound=yes
-
send_pai=yes
-
direct_media=no
-
rewrite_contact=yes
-
rtp_symmetric=yes
-
dtmf_mode=rfc4733
-
media_address=49.204.231.27
-
language=en
AOR
-
contact=sip:freepbxsip@microgrid.pstn.twilio.com:5060
-
qualify_frequency=60
-
default_expiration=3600
-
maximum_expiration=7200
-
minimum_expiration=60
Auth
-
auth_type=userpass
-
username=freepbxsip
-
password=Microgrid@123
Identify
-
endpoint=Twilio-Out
-
match=54.172.60.0/23
Request for Assistance
We are trying to determine why Asterisk is not receiving inbound RTP from Twilio despite:
-
Outbound RTP working correctly.
-
SIP/SDP negotiation appearing normal.
-
Twilio IP ranges configured properly.
-
RTP/SIP ports opened in firewall.
-
No inbound RTP visible using rtp set debug on.
What We Need Help With
-
Additional logs required?
-
Specific SIP traces?
-
Packet captures (tcpdump)?
-
Any configuration we should adjust or verify?
-
Any known Twilio/Asterisk NAT or media-handling considerations?