[Solved] No audio in outgoing calls until the call is placed on-hold and off-hold

Hi everyone,

I am doing some bespoke development work with Asterisk and I’m stuck on this issue.

When you make an outgoing call there is no audio until it is placed on-hold and off-hold.

For incoming calls, the audio seems to work fine (from another SIP Provider to a UK number with Zadarma).

I have tested using Groundwire on iPhone and X-Lite on PC with the same result. The call flow is a phone in LAN, to VULTR server in WAN, to Zadarma SIP Provider, to a UK number with another SIP Provider (Yay).

I set up an extension on the Asterisk server which just plays music and that audio always seems to work fine. It’s only when calling out over Zadarma that I see this issue so I don’t know where the issue is but I think it is further upstream.

I tried adding some settings for NAT (even though the server has its own IPv4 and isn’t using NAT). I also tried adding some settings to the endpoint such as directmedia=no in attempt to fix the issue.

I am using the default rtp.conf sample file.

Here is my pjsip.conf file with passwords removed and SIP user ID changed:

; --- --- --- Start of File "pjsip.conf"

; --- --- --- Start of Transports

; --- Start of Transport "transport-udp"

[transport-udp]
type=transport
protocol=udp
bind=45.76.185.48
; Configuring res_pjsip to work through nat: https://wiki.asterisk.org/wiki/display/AST/Configuring+res_pjsip+to+work+through+NAT
local_net=127.0.0.1/32
external_media_address=45.76.185.48
external_signaling_address=45.76.185.48

; --- End of Transport "transport-udp"

; --- --- --- End of Transports

; --- --- --- Start of Trunks

; --- Start of Trunk "zadarma"

[54321]
type=registration
transport=transport-udp
outbound_auth=54321
server_uri=sip:sip.zadarma.com
client_uri=sip:54321@sip.zadarma.com
retry_interval=60
expiration=120
contact_user=54321

[54321]
type=auth
auth_type=userpass
password=
username=54321

[54321]
type=aor
contact=sip:sip.zadarma.com:5060

[54321]
type=endpoint
transport=transport-udp
context=LocalSets
allow=!all,ulaw
outbound_auth=54321
aors=54321
from_user=54321
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
 
[54321]
type=identify
endpoint=54321
match=sip.zadarma.com
match=185.45.152.0/24
match=185.45.155.0/24
match=37.139.38.0/24
match=195.122.19.0/27

; --- End of Trunk "zadarma"

; --- --- --- End of Trunks

; --- --- --- Start of Templates

; --- Start of Template "endpoint"

[endpoint](!)
type=endpoint
transport=transport-udp
context=internal
allow=!all,ulaw
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
 
[auth-userpass](!)
type=auth
auth_type=userpass

[aor-single-reg](!)
type=aor
max_contacts=10

; --- End of Template "endpoint"

; --- --- --- End of Templates

; --- --- --- Start of Endpoints

; --- Start of Endpoint "1001"

[1001](endpoint)
auth=1001
aors=1001

[1001](auth-userpass)
password=
username=1001

[1001](aor-single-reg)

; --- End of Endpoint "1001"

; --- Start of Endpoint "1002"

[1002](endpoint)
auth=1002
aors=1002

[1002](auth-userpass)
password=
username=1002

[1002](aor-single-reg)

; --- End of Endpoint "1002"

; --- --- --- End of Endpoints

; --- --- --- End of File "pjsip.conf"

What version of Asterisk are you using? I remember something like this in the issue tracker but I believe it was resolved.

1 Like

How about capturing a call and check if any ports are changed when placing the call on hold and continue the call.

I would start there.

1 Like

Here’s the output of core show version:

Asterisk certified/13.18-cert3 built by root @ virtual-receptionist on a x86_64 running Linux on 2018-02-26 17:24:24 UTC

Then I’d do as @meightee stated and also provide the “pjsip set logger on” output and “rtp set debug on” to show the actual traffic (both SIP and media).

Here we go (I’ve replaced the SIP User ID with 54321, the caller’s IP with 1.2.3.4 and telephone numbers with 442081234567 and 442031234567):

Gist: https://gist.github.com/anonymous/ecd3b6b8026604aedef88d4602112815

Raw: https://gist.githubusercontent.com/anonymous/ecd3b6b8026604aedef88d4602112815/raw/83562064da3aea85ab082f5ca252e3c5a8316b31/Asterisk%20console%20output

There is no media being received on either side before the call is put on hold. Is Asterisk really not behind some kind of 1 to 1 NAT or other router?

You might try enabling rtp_keepalive which will cause Asterisk to send RTP keepalive packets instead of relying on the other side.

1 Like

Added rtp_keepalive=1 to the Zadarma endpoint and the audio works!

1 Like