Listen, Whisper, Barge through REST API

I am trying to listen, whisper and barge on a call. I am using ari.channels().snoopChannel(extName,TargetName, null, null, null); but could not understand the parameters. Also if anybody can send me the documentation of ARI for Java or some standard examples.

A snoop channel itself is a pipe into the media of the channel you are spying on. As it is a channel it means you can use anything in ARI you would normally use on it. A snoop channel which is put into a bridge with another channel is equivalent to ChanSpy. A snoop channel which is recorded is equivalent to MixMonitor.

I am not familiar with the snoopChannel in ARI for Java, but from a high level perspective the spy and whisper fields specify the direction of media to snoop. ‘none’ being none, ‘both’ being incoming audio and outgoing audio, ‘out’ being outgoing audio, and ‘in’ being incoming audio. The app and appArgs option specify what ARI application the resulting Snoop channel is sent to. The snoopId is an identifier for the resulting Snoop channel so when it enters the ARI application you can know what it is for based on that.

Thanks for the email. I could not understand the parameters app and appArgs. Will it be “chanspy” if yes, then what is appArg ?. Where can I find list of apps ?

ARI applications are applications that are written by a developer. None are included with Asterisk. You can find out more about what ARI is and how it fits in on the wiki[1].


Thanks for the mail. I understood that app is for custom application, but can I use chanspy also right ?

You can not use dialplan applications through ARI. The app and appArg is for an ARI application. ARI provides the building blocks to BUILD something like ChanSpy, that’s what Snoop channels are for.

Thanks again for the quick response. So what is default value of app and appArgs ?

There are no default values. There are no default ARI applications.

What happens if I put null, null. Will it crash ? If yes give me a way out to listen/whisper/barge on a channel

It won’t crash, but it also won’t work. A Snoop channel that has no application to go to is useless.

I am writing a CustomSnooping app for Listen, Whisper, Barge. Can u provide me thread about how to write ari application, how deploy it

There’s nothing specific to that. There’s some general overview examples on the wiki[1] but otherwise it is up to the developer to use the provided API how they need and deploy it how they want.


I am trying to write Listen/Whisper/Barge on a particular channel thru ARI. But my understanding is to achieve that I have to write custom Chanspy application and cannot use dialplan application Chanspy. I had a temporary solution writing a custom dialplan and including that in extension.conf. In that dialplan I wrote *221+extension# will give the ability to listen and *222 to whisper *224 to barge.

Now I am planning to use in my application to use these
ari.channels().continueIndialplan(“custom dialplan”) and
functions to achieve what Chanspy does. Shall it work ?

I don’t understand why you would use ARI then. If you want to use Chanspy, then why not use Chanspy directly? Why use ARI?

Actually User will click Listen button and will listen and then Whisper button and Barge button from CRM application. I trying to simulate the same thing that a softphone does.

That still doesn’t mean ARI has to be used. AMI could be used for such things as well. If you aren’t building a custom telephony application then ARI isn’t usually the right tool

My application is in PHP, it calls a java webservice which in turn call ari web service. Another thing is AGI and AMI functions are exposed to outside world in which manner. In my case, my left hand talks to CRM application and right hand talks to ARI. Please suggest

I don’t have a clear idea of what you are trying to achieve and how everything fits together, I can only provide general information. You can send a channel back into the dialplan like you’ve stated, but after that your options for interacting with it using ARI are limited if needed.

Please let me know that how AMI and AGI functions can be used from a Java program. Or I have to write C/C++ program to access AMI and AGI.

AMI is connected to using a TCP connection. AGI executes an application or connects to one using a TCP connection. I have no experience using Java with them, but there may be information elsewhere.