Are you having an audio issues in your Asterisk?

Well it’s a common issue with Asterisk PBX to have audio issues like one way audio or no audio. Sometimes only caller can hear remote party or remote party only can hear the caller. You must be wondering what causes this issue? This problem in audio is mainly because of the NAT issues. We recommend to use NAT with enabling 10000-20000 UDP ports on firewalls and also to enable natting on trunks

Example:

[didforsale1]
type=peer
host=209.216.2.211
nat=yes
canreinvite=no
disallow=all
allow=ulaw&g729
context=from-trunk
dtmfmode=auto

—————————————————————————–

[didforsale2]
type=peer
host=209.216.15.70
nat=yes
canreinvite=no
disallow=all
allow=ulaw&g729
context=from-trunk
dtmfmode=auto

The Second possible reason for causing one way audio could possibly be Codec, This often happens when a call comes in with ULAW and the system tries to accept with other codecs which can cause superfluous codec negotiation. To avoid this we need to remove the unwanted codec on your switch. For example if you are using G729 then remove ULAW parameter from our trunks. If you are using ULAW then remove g729.

Example

[didforsale1]
type=peer
host=209.216.2.211
nat=yes
canreinvite=no
disallow=all
allow=g729 (Use either one of the codec you want)
context=from-trunk
dtmfmode=auto

Well if both of the previous steps don’t work for you. Then check if you are in a local network? If Yes, then you will need to add additional parameters in /etc/asterisk/sip.conf

Under the general context add your Public IP, NAT and local IP

Example

[general]
externip= (Your public ip)
localnet= (your local network address)
nat = yes

Say your public IP is 208.54.15.6 and your local network is 192.168.1.0
externip= 208.54.15.6
localnet= 192.168.1.0/255.255.255.0
nat = yes

Hope these steps resolve the Asterisk audio issues for you!.