No audio for sip calls

So our asterisk is on an Azure server and we can register the sip phone, but don’t hear audio when making calls. We opened ports 15000-19000 on the firewall and changed rtp.conf to start at 15000 and end at 19000. Here is the output I get when calling an extension that is supposed to just hangup immediately. I changed the IP of the computer with the soft phone on it to XXX.XXX.XXX.XXX and the IP of the asterisk server to YY.YY.YYY.YY

<--- SIP read from UDP:XXX.XXX.XXX.XXX:32731 --->
INVITE sip:106@YY.YY.YYY.YY:5060 SIP/2.0
Via: SIP/2.0/UDP 165.0.2.248:52724;branch=z9hG4bK-524287-1---ebef1a0e07d98036;rport
Max-Forwards: 70
Contact: <sip:test@XXX.XXX.XXX.XXX:32731;rinstance=23120e854527371f>
To: <sip:106@YY.YY.YYY.YY:5060>
From: "Adam"<sip:test@YY.YY.YYY.YY:5060>;tag=ffe7ae03
Call-ID: 84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM
CSeq: 1 INVITE
Allow: SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO, OPTIONS, MESSAGE
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite release 4.9.8 stamp 84253
Content-Length: 332

v=0
o=- 13141937637581563 1 IN IP4 165.0.2.248
s=X-Lite release 4.9.8 stamp 84253
c=IN IP4 165.0.2.248
t=0 0
m=audio 16778 RTP/AVP 9 8 120 0 84 101
a=rtpmap:120 opus/48000/2
a=fmtp:120 useinbandfec=1; usedtx=1; maxaveragebitrate=64000
a=rtpmap:84 speex/16000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
--- (13 headers 12 lines) ---
Sending to XXX.XXX.XXX.XXX:32731 (NAT)
Sending to XXX.XXX.XXX.XXX:32731 (NAT)
Using INVITE request as basis request - 84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM
Found peer 'test' for 'test' from XXX.XXX.XXX.XXX:32731

<--- Reliably Transmitting (NAT) to XXX.XXX.XXX.XXX:32731 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 165.0.2.248:52724;branch=z9hG4bK-524287-1---ebef1a0e07d98036;received=XXX.XXX.XXX.XXX;rport=32731
From: "Adam"<sip:test@YY.YY.YYY.YY:5060>;tag=ffe7ae03
To: <sip:106@YY.YY.YYY.YY:5060>;tag=as4d064252
Call-ID: 84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM
CSeq: 1 INVITE
Server: Asterisk PBX 14.5.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="1852df8b"
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM' in 6400 ms (Method: INVITE)

<--- SIP read from UDP:XXX.XXX.XXX.XXX:32731 --->
ACK sip:106@YY.YY.YYY.YY:5060 SIP/2.0
Via: SIP/2.0/UDP 165.0.2.248:52724;branch=z9hG4bK-524287-1---ebef1a0e07d98036;rport
Max-Forwards: 70
To: <sip:106@YY.YY.YYY.YY:5060>;tag=as4d064252
From: "Adam"<sip:test@YY.YY.YYY.YY:5060>;tag=ffe7ae03
Call-ID: 84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM
CSeq: 1 ACK
Content-Length: 0

<------------->
--- (8 headers 0 lines) ---

<--- SIP read from UDP:XXX.XXX.XXX.XXX:32731 --->
INVITE sip:106@YY.YY.YYY.YY:5060 SIP/2.0
Via: SIP/2.0/UDP 165.0.2.248:52724;branch=z9hG4bK-524287-1---e18d08450544c360;rport
Max-Forwards: 70
Contact: <sip:test@XXX.XXX.XXX.XXX:32731;rinstance=23120e854527371f>
To: <sip:106@YY.YY.YYY.YY:5060>
From: "Adam"<sip:test@YY.YY.YYY.YY:5060>;tag=ffe7ae03
Call-ID: 84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM
CSeq: 2 INVITE
Allow: SUBSCRIBE, NOTIFY, INVITE, ACK, CANCEL, BYE, REFER, INFO, OPTIONS, MESSAGE
Content-Type: application/sdp
Supported: replaces
User-Agent: X-Lite release 4.9.8 stamp 84253
Authorization: Digest username="test",realm="asterisk",nonce="1852df8b",uri="sip:106@YY.YY.YYY.YY:5060",response="bcdb67c30a63c2534d79148488b97d11",algorithm=MD5
Content-Length: 332

v=0
o=- 13141937637581563 1 IN IP4 165.0.2.248
s=X-Lite release 4.9.8 stamp 84253
c=IN IP4 165.0.2.248
t=0 0
m=audio 16778 RTP/AVP 9 8 120 0 84 101
a=rtpmap:120 opus/48000/2
a=fmtp:120 useinbandfec=1; usedtx=1; maxaveragebitrate=64000
a=rtpmap:84 speex/16000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=sendrecv
<------------->
--- (14 headers 12 lines) ---
Sending to XXX.XXX.XXX.XXX:32731 (NAT)
Using INVITE request as basis request - 84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM
Found peer 'test' for 'test' from XXX.XXX.XXX.XXX:32731
  == Using SIP RTP CoS mark 5
Found RTP audio format 9
Found RTP audio format 8
Found RTP audio format 120
Found RTP audio format 0
Found RTP audio format 84
Found RTP audio format 101
Found audio description format opus for ID 120
Found audio description format speex for ID 84
Found audio description format telephone-event for ID 101
Capabilities: us - (ulaw), peer - audio=(ulaw|alaw|g722|speex16|opus)/video=(nothing)/text=(nothing), combined - (ulaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 165.0.2.248:16778
Looking for 106 in from-internal (domain YY.YY.YYY.YY)
sip_route_dump: route/path hop: <sip:test@XXX.XXX.XXX.XXX:32731;rinstance=23120e854527371f>

<--- Transmitting (NAT) to XXX.XXX.XXX.XXX:32731 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 165.0.2.248:52724;branch=z9hG4bK-524287-1---e18d08450544c360;received=XXX.XXX.XXX.XXX;rport=32731
From: "Adam"<sip:test@YY.YY.YYY.YY:5060>;tag=ffe7ae03
To: <sip:106@YY.YY.YYY.YY:5060>
Call-ID: 84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM
CSeq: 2 INVITE
Server: Asterisk PBX 14.5.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:106@YY.YY.YYY.YY:5060>
Content-Length: 0


<------------>
    -- Executing [106@from-internal:1] Hangup("SIP/test-00000006", "") in new stack
  == Spawn extension (from-internal, 106, 1) exited non-zero on 'SIP/test-00000006'
Scheduling destruction of SIP dialog '84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM' in 6400 ms (Method: INVITE)

<--- Reliably Transmitting (NAT) to XXX.XXX.XXX.XXX:32731 --->
SIP/2.0 603 Declined
Via: SIP/2.0/UDP 165.0.2.248:52724;branch=z9hG4bK-524287-1---e18d08450544c360;received=XXX.XXX.XXX.XXX;rport=32731
From: "Adam"<sip:test@YY.YY.YYY.YY:5060>;tag=ffe7ae03
To: <sip:106@YY.YY.YYY.YY:5060>;tag=as121b0602
Call-ID: 84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM
CSeq: 2 INVITE
Server: Asterisk PBX 14.5.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<------------>
Retransmitting #1 (NAT) to XXX.XXX.XXX.XXX:32731:
SIP/2.0 603 Declined
Via: SIP/2.0/UDP 165.0.2.248:52724;branch=z9hG4bK-524287-1---e18d08450544c360;received=XXX.XXX.XXX.XXX;rport=32731
From: "Adam"<sip:test@YY.YY.YYY.YY:5060>;tag=ffe7ae03
To: <sip:106@YY.YY.YYY.YY:5060>;tag=as121b0602
Call-ID: 84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM
CSeq: 2 INVITE
Server: Asterisk PBX 14.5.0
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


---

<--- SIP read from UDP:XXX.XXX.XXX.XXX:32731 --->
ACK sip:106@YY.YY.YYY.YY:5060 SIP/2.0
Via: SIP/2.0/UDP 165.0.2.248:52724;branch=z9hG4bK-524287-1---e18d08450544c360;rport
Max-Forwards: 70
To: <sip:106@YY.YY.YYY.YY:5060>;tag=as121b0602
From: "Adam"<sip:test@YY.YY.YYY.YY:5060>;tag=ffe7ae03
Call-ID: 84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM
CSeq: 2 ACK
Content-Length: 0

<------------->
--- (8 headers 0 lines) ---

<--- SIP read from UDP:XXX.XXX.XXX.XXX:32731 --->
ACK sip:106@YY.YY.YYY.YY:5060 SIP/2.0
Via: SIP/2.0/UDP 165.0.2.248:52724;branch=z9hG4bK-524287-1---e18d08450544c360;rport
Max-Forwards: 70
To: <sip:106@YY.YY.YYY.YY:5060>;tag=as121b0602
From: "Adam"<sip:test@YY.YY.YYY.YY:5060>;tag=ffe7ae03
Call-ID: 84253MGFjOGY5ZjRkMWQ3MmZkNmRiNGYxYTUzZjZiYmZkMmM
CSeq: 2 ACK
Content-Length: 0

<------------->
--- (8 headers 0 lines) ---

I’m wondering why these ports in the 30000 range are being used when I set rtp.conf to be 15000-19000? The only ports open on the system are those and 5060. I’m probably doing something wrong, I just don’t know what. Any help is appreciated.

Edit: I forgot to include our sip.conf. Here it is:

[general]
context=nowhere
allowguest=no
alwaysauthreject=yes
transport=udp
bindport=5060
bindaddr=0.0.0.0
externip=YY.YY.YYY.YY
localnet=10.0.0.8/255.255.255.0
;qualify=yes
nat=force_rport
[friends_internal](!)
type=friend
host=dynamic
context=from-internal
disallow=all
allow=ulaw
[test](friends_internal)
secret=password ; put a strong, unique password here instead

Please re-paste the log but this time mark it as pre-formatted text, using </>,

Sorry about that. Fixed

The Asterisk configuration does not control the ports used on the peer in any way.

Because you declined the call, Asterisk hasn’t needed to send any RTP port numbers, so the configured RTP port range is irrelevant to this call.

What could the issue be caused by then if not the RTP ports? Is it most likely something on Asterisks side or on the peer’s side?

Allowing direct meida in a NAT situation?

Just for some clarification, in our scenario our asterisk server has a public IP but our phone is behind a nat. What settings should we be using in sip.conf to allow communication between the two? Right now asterisk is sending RTP packets but not receiving any. I’m not sure what line to add to allow for direct media but directmedia=yes doesn’t seem to do anything.

Thanks for the help

You need directmedia=no. I don’t think even directmedia=nonat will work in your configuration.

You may need other options depending on how NAT-aware the phones are, and whether any NAT support has been enabled in the phones.

Right now I am just using an x-lite soft phone. In sip.conf I have nat=force_rport,comedia and directmedia=no. I still can’t get past the INVITE request. On my other running server I always get an ACK message after INVITE but I’m not getting one on the problem server. For x-lite I have Send Sip keep-alive messages enabled, Use rport, enabled, and range of RTP set to 15000-19000. I’m really confused as to what’s going on.

Thanks for the response.

The only INVITE you have presented here you have deliberately set up to fail.

I understand that in this example it was set up to fail now. I did another test to this extension.

exten => 100,1,Answer()
same => n,Playback(hello-world)
same => n,Hangup()

I’m not hearing any audio because the peer isn’t getting any RTP packets. I enabled rtp debug and asterisk is sending packets to the peer. I also used wireshark to get a better representation of whats happening and I’ve attached that. I’ve also attached what the working local asterisk server looks like when communicating to the same peer. For both the left is the peer and the right is the asterisk server. As you can see the problem server just ends in a loop that goes until a timeout occurs. Any thoughts?

Thanks for the help.

Asterisk is not sending an ACK, which would typically mean that it doesn’t think the OK belongs to the dialogue that it started with the INVITE. To understand why, one would need the logs from Asterisk showing its handling, of the OK, and to check the Call-ID and tags in the OK against the INVITE. I’m assuming your firewall is actually allowing the OK to reach Asterisk.

Hi,

I am also facing same problem for hello-world unbale to hear the voice.

I am running asterixnow server in vm ware ip address is 192…168.81.254
and my laptop windows 8 ip address is 192.168.1.9 connected to wifi.

how to solve the audio issue

Remove the firewall rule or fix the NAT rule that is stopping the RTP being delivered.

If this is a voice announcement, and you don’t hear anything even when you speak, make sure that internal timing is enabled and you have a suitable timing source.

I am sometimes hearing the voice and some times getting error saying

res_rtp_asterisk.c ast_rtcp_write_report :RTCP RR transmission error to 122.166.208.148 rtcp halted network is unreachable

and this error does not comes up and i can hear the voice saying hello-world

Fix the network unreachable error. That is outside of Asterisk.

please can you elaborate how to fix it and what is exactly causing the error?

Network unreachable means that you tried to send to an IP address, and either your machine or one of the other routers between you and the destination did not know the next router in the chain to use.

If it weren’t intermittent, it could also be that the destination had sent an inappropriate IP address in the SDP in the SIP INVITE Dialog.

You need to find someone, local to you, that understands IP networks and examine each of the steps in the chain to find which is breaking. There is no easy answer other than the one I gave you.

1 Like

Hi Davaid,

I am able to solve the RTCP RR Transmission error it was due to my virtual machine was unable to connect to internet i have updated my Virtual Machine Workstation

Today only once i am able to hear hello-world but not all the times i crossed check sip debug and RTP debug there are no errors

Can u tell me what would be the problem?

Solved It ,

we need to configure in pjsip.conf about
qualify=yes
nat=force_rport,comedia
externip=1.2.3.4 <- your Public IP ADDRESS or
localnet=-x.y.z.w <-Local IP Address