How is work ari snoopchannel

Hello everybody
I am new to Asterisk and I would like some advice on using a snoopchannel I don’t know how use it and when and where.
I created a stasis (my-app) in my extensions.conf then in my javascript with ari-client I used the example Basic Mixing Bridges documentation but I can not determine where the placed to then make my record on this snoopchannel.
is it correct to use stasis (my-app) in my bridge and my snoopchannel or maybe use 2 differents stasis.

my extensions.conf
exten => 200,1,NoOp()
same => n,Stasis(bridge-dial)
same => n,Hangup()

A Snoop channel is just like any other channel, the only difference is the audio from it is a copy of the audio from another channel and the audio to it is mixed into the audio of another channel. If you want to record a snoop channel (aka recreate MixMonitor) then you would send it to the record route.

1 Like

@jcolp thank you for your help but I’m lost
would like to add a snoop but i read that i need to create a channel when i create a channel in javascript i get an error message “message: Channel in invalid state”
I do not know how to start exactly. can I have more information?

I don’t speak Javascript so I don’t know. When you snoop on a channel it will create a new one automatically and return the information about it to you, and send it where you tell it.

@jcolp when i create snoop i must first create a channel because it needs the channelId in addition to app and spy.

I create a bridge in which I add 2 channels.
So, should I add my snoop on one of the channels? when I do this my call gets another call? I have to do something wrong, but I do not think so.

maybe I have to use the context below:
I saw in a schema that a person creates 2 bridge one for the communication between the endpoints (phone1 and phone2) and another bridge which just gets the endpoints (phone1 and phone2) in which I put a snoop.
Should my bridge and my snoop have the same stasis app name (my-app)?

maybe do you a schema to show me ?


A Snoop channel spies (like ChanSpy) on another channel so you provide the channel id of what you want to spy on. What you did with it after that depends on what you’re hoping to accomplish. I don’t have one to show you, and the stasis app is just an entrypoint to your logic. It can be the same. It all depends on how you code it.

@jcolp for one channel I want record the sound of my caller and other i want play sound in my callee.

So my scheme that I think to do :
caller A ==> callee B
create bridge with A and B add to bridge
After that I create a new channel from A with endpoint SIP/A with app:bridge-dial. I take the channelId from this channel to create snoopChannel. I begin to record this snoopchannel.
In my existing channel B i play my media with the channelid from B.

is it okay what I think?

thank for you time and you patient

Generally, yes, but I’m not clear on all of the channels involved and what is going on.

thanks @jcolp for everything I find my error. It’s working now