No audio outside local network

I am trying to establish a call between softphones. I have created two extensions and configured as them on softphones.

When I make a call in a local network (both softphones are in local network), the call quality is fine. But, when I make a call from a local network softphone to another softphone which is not in the local network, it rings the phone, but when I answer it, there is no audio.

The asterisk server used is not in my local network, (hosted on AWS) and I’ve already allowed the following ports on my asterisk server firewall: 5060, 5061, 10000-20000.

The configuration I used for extension looks like this:

[extension-name]
type=friend
context=phones
secret=extension-secret
callerid=extension-caller-id
host=dynamic
domain=public-ip-of-asterisk-server
qualify=5000
nat=force_rport,comedia

I’ve read some posts on the forum and found that perhaps I should use STUN server. But, I don’t quite understand that. Could someone advise me on what I should do in this case?

Thanks in advance.

Add the following parameters :
directmedia=no
localnet
externaddr
media_address

1 Like