Snoop channel and play audio

Hello, I’d like to understand more how SnoopChannel works. Created simple dialplan

[test-context]
exten => _X.,1,NoOp(start to handle call)
 same => n,Answer()
 same => n,Playback(hello-world)
 same => n,Wait(600)
 same => n,Hangup()

When I’ve dialed I’ve started to play using Swagger

  1. I’ve created snoop channel
    8088/ari/channels/1734355532.60/snoop?spy=both&whisper=both&app=hello
    and that’s created
  2. I’ve tried to play audio to snoop channel and expected file played on main channel
    8088/ari/channels/1734354200.55/play?media=sound:hello-world&skipms=3000

console

-- Executing [25@test-context:1] NoOp("PJSIP/3005-0000001b", " start to handle call") in new stack


    -- Executing [25@test-context:2] Answer("PJSIP/3005-0000001b", "") in new stack
       > 0x7f9a7005edd0 -- Strict RTP learning after remote address set to: 192.168.56.1:4030
    -- Executing [25@test-context:3] Playback("PJSIP/3005-0000001b", "hello-world") in new stack
    -- <PJSIP/3005-0000001b> Playing 'hello-world.gsm' (language 'en')
       > 0x7f9a7005edd0 -- Strict RTP learning after remote address set to: 192.168.56.1:4030
       > 0x7f9a7005edd0 -- Strict RTP qualifying stream type: audio
       > 0x7f9a7005edd0 -- Strict RTP switching source address to 178.212.193.185:4030
    -- Executing [25@test-context:4] Wait("PJSIP/3005-0000001b", "600") in new stack
       > 0x7f9a7005edd0 -- Strict RTP learning complete - Locking on source address 178.212.193.185:4030
    -- <Snoop/1734360665.73-00000007> Playing 'hello-world.gsm' (language 'en')

but I can’t hear the audio playing. should there be a channel from which it was created SnoopChannel in Stasis? what can be cause why no audio? RTP and Nat is ok(Playback(hello-world) played)

Media is only injected when audio is actually flowing. Calling Wait has no media flowing to PJSIP/3005 so nothing is injected. This is a limitation in the underlying architecture used by Snoop channels and also ChanSpy.

2 Likes