No Audio on SIP PSTN call

I have an Asterisk PBX hosted in Amazon AWS. All ports are open on it for all incoming and outgoing connections for all protocols. I have registered successfully with my provider and created a peer for outgoing calls. I am able to dial numbers and have my phone ring but there is absolutely no audio and caller id transmission is incorrect. What’s worse is that just after 5 seconds of the call connecting it automatically disconnects.

I have included a link to the log file which I have collected and it shows some pretty strange things. Lines 103 and 119 show Unauthorised messages, and lines 287 and 363 show “Proxy Authentication Required”.

What am I doing wrong ?

FYI I have removed actual IP addresses from the file, for example, < softphone_ip > refers to the IP of my softphone, < pbx_public_ip > refers to my pbx IP that I am connecting to. So on and so forth. If there are any confusions about what is what in the log please let me know.

My PBX is on the cloud, and has both public and private IP, do I have to enable NAT on it ? My softphone is on my laptop and definitely has NAT.

Please let me know where I am going wrong, since I need this for my startup.

As far as I am aware in an AWS configuration it uses NAT so the public IP is not directly on the Asterisk. Have you configured Asterisk with correct settings to place the public IP address into the signaling? This would be localnet/externip in sip.conf or local_net and external_signaling_address and external_media_address in pjsip.conf.

First of all I don’t think I am using pjsip since I am using Asterisk 11.6. Correct me if I am wrong. Secondly can you please detail what you mean by “place the public IP address into the signaling?” I am not familiar with VOIP as you can guess, so if you can help me that would be great.

SIP puts the IP address in the messages themselves, and the remote side sends messages back and media. If this contains the private AWS address then you won’t get audio.

You have to configure sip.conf with the localnet and externip options. The localnet option is the local network (192.168.1.0/255.255.255.0 for example) and the externip option is the external address (8.8.8.8 for example). This allows chan_sip to know when to put the external address in the messages.

1 Like

What about configuring the nat option ? Do I have to configure that ? If so then to what ?

The nat option is if the remote device is behind NAT, if they are then set the applicable options on it. (force_rport,comedia)

Unfortunately, the average user seems to think that something called nat must be required, or worse, is the only thing required, for the simple NAT case of Asterisk inside and the peer public, so all the ITSP configuration cook books used to have nat=yes, and now that that is deprecated, have nat=force_rport,comedia.

Correct me if I am wrong, but since my PBX has both a public and private IP, doesn’t that mean that the PBX is behind a NAT ? I have configured nat=force_rport,comedia for my soft-phone and the provider peer. Is it correct ?

Both my soft-phone and the PBX is behind a NAT AFAIK.

If the machine has both public and private addresses, it is dual homed, not NATted. As this is broken dual homing (the networks are not mutually routable) you will need to disable direct medai. (With unbroken multi-homing, you would have two public addresses, either of which would successfully reach you from anywhere on the internet, and, in general, you would be reached via the interface with the shortest route, not necessarily the one used in the request.)

If this were NAT and the only thing outside the NAT was the ITSP, and the ITSP was not themselves behind NAT, , the defaults for nat= would probaby be sufficient. You would still need to disable directmedia, or at least use directmedia=nonat (for broken multi-homing, you may need directmedia=no).

This is my sip.conf file. Could you please help me with what I am missing over here -:

[general]
context=public                  ; Default context for incoming calls. Defaults to 'default'
allowoverlap=no                 ; Disable overlap dialing support. (Default is yes)
udpbindaddr=0.0.0.0             ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
bindport=50600
tcpenable=no                    ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=0.0.0.0             ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
transport=udp                   ; Set the default transports.  The order determines the primary default transport.
externip=<external_ip>
localnet=<private_ip>/<subnet_ip>
srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
canreinvite=no
qualify=yes

register => username:password@sip.voip.com

[authentication]
[basic-options](!)                ; a template
        dtmfmode=rfc2833
        context=from-office
        type=friend
[natted-phone](!,basic-options)   ; another template inheriting basic-options
        directmedia=no
        host=dynamic
[public-phone](!,basic-options)   ; another template inheriting basic-options
        directmedia=yes
[my-codecs](!)                    ; a template for my preferred codecs
        disallow=all
        allow=ilbc
        allow=g729
        allow=gsm
        allow=g723
        allow=ulaw
[ulaw-phone](!)                   ; and another one for ulaw-only
        disallow=all
        allow=ulaw

[voipfibre] (This is the ITSP)
	type=friend
	secret=password
	defaultuser=username
	host=sip.voip.com
	dtmfmode=rfc2833
	context=inbound
	disallow=all
	allow=ulaw,alaw
	insecure=port,invite
	fromdomain=sip.voip.com
	nat=force_rport,comedia

[sreyan32] (This is the softphone)
	type=friend
	context=outgoing
	disallow=all
	allow=ulaw,alaw
	secret=password
	dtmfmode=rfc2833
	host=dynamic
	nat=force_rport,comedia

How about describing the current problem and providing logs? (sip set debug on and rtp set debug on)? Are you still receiving no audio?

jcolp Sir you are amazing. Finally after 6 months of trying I was finally able to get audio and place proper phone calls. You were absolutely right about setting the localnet and externip.

If I ever meet you, beers are on me.

On a serious note, now part of the problem is solved. Now I have to solve the erratic caller id transmission. But I think that’s something I have to take up with my provider. Will be back here if I need help.

Once again, thanks a ton !!!