No audio with Skype SIP and Asterisk when playing sounds

I just installed Asterisk 16.2 and have set it up to connect to Skype Connect SIP for outbound calling. I am able to REGISTER and connect OK to the Skype SIP server, but I am unable to hear any audio on my phone when placing a call. I have configured a local extension and can connect to it from a softphone OK and get audio, and when I subsequently Dial out, the connection is OK if I do voice to voice but not if I do a Playback. It appears RTP packets are being sent as I see network traffic when the sound is supposed to be playing, but I hear nothing.

My sip.conf

[general]
register => username:password@sip.skype.com/username
context=default
bindport=5060
srclookup=yes
localnet=127.0.0.1/255.255.0.0
externip=myIP
rtpkeepalive=2
nat=yes
nat=force_rport,comedia
directmedia=yes

[skype]
type=peer
host=sip.skype.com
defaultuser=username
fromuser=username
fromdomain=sip.skype.com
disallow=all
allow=gsm,ulaw,alaw,codec2, g723,g726
username=username
secret=password
dtmfmode=RFC2833
context=incoming
insecure=invite

[6001]
type=friend
context=from-internal
host=dynamic
secret=unsecurepassword
disallow=all
allow=ulaw

My extensions.conf

[call-file-test]
exten => 10,1,Answer()
exten => 10,n,Wait(1)
exten => 10,n,Playback(hello-world)
exten => 10,n,Wait(1)
exten => 10,n,Hangup()

[from-internal]
exten = 100, 1, Answer()
same = n, Wait(1)
same = n, Playback(hello)
same = n, Wait(1)
same = n, Playback(goodbye)
same = n, Dial(SIP/skype/+1numbertodial)
;same = n, Hangup()

test.call

Channel: SIP/skype/+PhoneNumber
Application: Playback
Data: hello-world

rtp set debug log

*CLI> rtp set debug on    -- Attempting call on SIP/skype/PhoneNumber for 10@call-file-test:1 (Retry 1)
  == Using SIP RTP CoS mark 5
    -- Called skype/PhoneNumber
    -- SIP/skype-00000001 is ringing
       > 0x7f9ab0006d50 -- Strict RTP learning after remote address set to: 63.209.144.201:27882
    -- SIP/skype-00000001 is making progress
    -- SIP/skype-00000001 answered
    -- Executing [10@call-file-test:1] Answer("SIP/skype-00000001", "") in new stack
    -- Executing [10@call-file-test:2] Wait("SIP/skype-00000001", "1") in new stack
    -- Executing [10@call-file-test:3] Playback("SIP/skype-00000001", "hello-world") in new stack
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018933, ts 000160, len 000160)
    -- <SIP/skype-00000001> Playing 'hello-world.gsm' (language 'en')
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018934, ts 000320, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018935, ts 000480, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018936, ts 000640, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018937, ts 000800, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018938, ts 000960, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018939, ts 001120, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018940, ts 001280, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018941, ts 001440, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018942, ts 001600, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018943, ts 001760, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018944, ts 001920, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018945, ts 002080, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018946, ts 002240, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018947, ts 002400, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018948, ts 002560, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018949, ts 002720, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018950, ts 002880, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018951, ts 003040, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018952, ts 003200, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018953, ts 003360, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018954, ts 003520, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018955, ts 003680, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018956, ts 003840, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018957, ts 004000, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018958, ts 004160, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018959, ts 004320, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018960, ts 004480, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018961, ts 004640, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018962, ts 004800, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018963, ts 004960, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018964, ts 005120, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018965, ts 005280, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018966, ts 005440, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018967, ts 005600, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018968, ts 005760, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018969, ts 005920, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018970, ts 006080, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018971, ts 006240, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 018972, ts 006400, len 000160)
....
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 019000, ts 010880, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 019001, ts 011040, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 019002, ts 011200, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 019003, ts 011360, len 000160)
    -- Executing [10@call-file-test:4] Wait("SIP/skype-00000001", "1") in new stack
    -- Executing [10@call-file-test:5] Hangup("SIP/skype-00000001", "") in new stack
  == Spawn extension (call-file-test, 10, 5) exited non-zero on 'SIP/skype-00000001'
[Mar 27 16:08:25] NOTICE[118095][C-00000002]: pbx_spool.c:463 attempt_thread: Call completed to SIP/skype/PhoneNumber
       > Saved useragent "Z 5.2.28 rv2.8.115" for peer 6001

Your actual problem appears to be outside of asterisk, as, as you say, the RTP is being sent.

However, this line make no sense at all and suggests you don’t understand the purpose of the parameter:

localnet=127.0.0.1/255.255.0.0

Yeah, I probably don’t, but comments like this don’t help me understand. I will read up on this parameter as well as externip, but I believe I can remove them both for my setup as well as the nat=yes parameter.

Regardless of my ignorance with this parameter, if the RTP packets are being sent (as they clearly seem to be), then I am of the opinion that it must be a problem with the Skype Connect SIP.

Thank you.

Or a firewall could be blocking the media stream.

OK, so this is an issue with my network. It seems my wifi provider may be blocking incoming RTP. When I change my wifi to use a cellular hotspot, everything works fine and I get:

Sent RTP packet to      63.209.144.201:27882 (type 00, seq 019000, ts 010880, len 000160)
Got  RTP packet from      63.209.144.201:27882 (type 00, seq 019001, ts 010880, len 000160)
Sent RTP packet to      63.209.144.201:27882 (type 00, seq 019001, ts 011040, len 000160)
Got  RTP packet from      63.209.144.201:27882 (type 00, seq 019001, ts 011040, len 000160)
 

But now I’m not sure why RTP is being blocked from these ports. My rtp.conf is supposed to be using ports 10000-20000, but I’m not sure why it’s using 27882 in this case. Any thoughts?

Asterisk can only control the ports that it uses to receive media on, and to send from. The remote side has its own IP address and port which can be whatever it wants.