1. One-Way Audio Fix
Problem: Caller can hear the remote party but the remote party cannot hear the caller (or vice versa). Audio flows in only one direction.
Cause: Almost always caused by NAT (Network Address Translation) or firewall issues. The SIP signaling gets through but RTP (audio) packets are sent to the wrong IP address or blocked by a firewall. SIP ALG on routers can also rewrite SDP headers incorrectly.
Configuration / Commands
; === sip.conf (chan_sip) === [general] nat=force_rport,comedia externaddr=YOUR_PUBLIC_IP ; or externhost=your.domain.com localnet=192.168.0.0/255.255.0.0 localnet=10.0.0.0/255.0.0.0 localnet=172.16.0.0/255.240.0.0 directmedia=no ; Prevent direct RTP between endpoints ; Per-peer settings [my-peer] nat=force_rport,comedia directmedia=no qualify=yes ; === pjsip.conf (PJSIP) === [transport-udp] type=transport protocol=udp bind=0.0.0.0:5060 external_media_address=YOUR_PUBLIC_IP external_signaling_address=YOUR_PUBLIC_IP local_net=192.168.0.0/16 local_net=10.0.0.0/8 [my-endpoint] type=endpoint rtp_symmetric=yes force_rport=yes rewrite_contact=yes direct_media=no ; === rtp.conf === [general] rtpstart=10000 rtpend=20000 ; === Firewall (iptables) === # Open RTP port range iptables -A INPUT -p udp --dport 10000:20000 -j ACCEPT # Open SIP signaling iptables -A INPUT -p udp --dport 5060 -j ACCEPT
Step-by-Step Fix
- Set nat=force_rport,comedia in sip.conf [general] and per-peer sections
- Configure externaddr with your public IP (or externhost for dynamic IP)
- Set localnet for all your private subnets
- Set directmedia=no (or direct_media=no for PJSIP) to force media through Asterisk
- Open UDP ports 10000-20000 in your firewall for RTP traffic
- Disable SIP ALG on your router/firewall (this is critical)
- For PJSIP: set rtp_symmetric=yes and force_rport=yes on endpoints
- Test with: asterisk -rx "rtp set debug on" to trace RTP packets