Custom ChanSpy to spy/whisper/barge

Hello,

We really like the code that @lgaetz came up with here: https://gist.github.com/lgaetz/78c4e114952e79596c1ed4123559d3d3

This code works great! It starts the call as a spy, but then you can toggle between (4) spy (listen to the call without being heard), (5) whisper (speak and be heard only to extension member), (6) barge (speak and be heard by both parties).

However, this acts as a prefix only. You need to first dial 556+extensionNumber. Would it be possible to have it prompt the caller to select the extension he wants to listen to? If so, if no active channels are present on that extension, can the system say that and prompt to either select another extension or to end the call by hanging up?

Any help with this will be greatly appreciated :slight_smile:

By default

https://wiki.asterisk.org/wiki/display/AST/Application_ChanSpy

“*” will move to the next available channel, enumerating any open channels to spy on is far more complicated.

You would need an additional block of dialplan added to what’s already in place also in the from-internal-context

exten => 556,1,Noop(Entering user defined context from-internal-custom in extensions_custom.conf)
exten => 556,n,Read(spyee,please-enter-the&extension&number&followed_pound)
exten => 556,n,GoTo(from-internal-custom,556${spyee},1)

It’s crude, but works and will gives you a starting place.

2 Likes

Thank you so much @lgaetz :slight_smile: You rock!

1 Like

Gist updated with this change.

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