Stop audio played by ChanSpy


is there a way to stop Audio from being played to a channel by ChanSpy? I have a following dialplan and use CLI to trigger the playback. Now I would like to have a way to stop playback at any time.

exten => _[a-z,0-9].,1,Answer()
same => n,Verbose(Playing ChanSpy to ${EXTEN})
same => n,ChanSpy(${SPYCHANNEL},qBv(-4))
same => n,Hangup

exten => [a-z,0-9,].,1,Answer()
same => n,Verbose( tf/${EXTEN} playback by chanspy for A: ${CALLER} and B: ${CALLEE})
same => n,Playback(audio/${EXTEN})

asterisk -x “originate Local/00000002@chanspy extension testaudio@chanspy-playback”

Hangup the spying channel.

Or channel redirect it to Wait(). or similar.

This isn’t the primary intended use of ChanSpy, so more explanation would have been useful.

This line is invalid. It is important to copy and paste the actual code, not try to rekey it.


thank you for the reply and the idea to hang up or wait the ChanSpy channel.
The use case is to play an announcement during the call and stop it if the other party would make a comment that it got the message or need some detailed explanation before the announcement will end.

This leads to another question that I was not able to reduce the volume of the announcement by using the v(-4) parameter to hear the other party.

Regarding your Answer() line comment - It is the actual code that I’m using and it works.
I was actually not sure if the Answer line was needed as I copied the code from one of the internet examples.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.