How to implement whisper (supervisor-to-agent only) in ARI without breaking main bridge?

Im working with Asterisk ARI (using ari4java), and I have a bridge where three parties are involved:

  • Agent
  • Customer
  • Supervisor (Manager)

Currently, I have all three in a single mixing bridge, and I’ve successfully implemented barge-in (where the supervisor can listen but is muted using channel.mute().setDirection("In")).

Now, I want to implement whispering, where the supervisor should be able to talk to the agent, but not be heard by the customer.

The challenge is:

  • If I create a second bridge and add only the supervisor and agent, the original bridge seems to break or stop working as expected.
  • My understanding was that a channel (like the agent) could only be part of one bridge at a time.

Question:

  • Can a channel (e.g., the agent) be in multiple mixing bridges at the same time in ARI?
  • If yes, what’s the correct way to implement whispering where:
    • The agent is in both bridges.
    • The customer is only in the main bridge.
    • The supervisor is only in the whisper bridge.
    • The supervisor can talk to the agent, but the customer doesn’t hear the supervisor?

Any best practices or caveats I should be aware of while handling this with ARI would be greatly appreciated!

No you can’t have a channel in multiple bridges at once. You use a Snoop channel[1] to whisper to a channel. Make a snoop channel, put it in its own bridge with a supervisor.

[1] Channels - Asterisk Documentation

Hi again, thanks so much for your earlier help!
I’ve implemented whispering using ARI with the following code:
Channel snoop = ari.channels().snoopChannel(targetAgentChannel, “_whisper-” + channelId)
.setApp(asteriskApp)
.setAppArgs(channelId)
.setSpy(“both”)
.setWhisper(“in”)
.execute();

Goal:

  • Supervisor should hear both agent and customer.
  • Supervisor should be able to talk only to the agent (customer shouldn’t hear the supervisor).

What’s happening:

  • Supervisor can hear both agent and customer
  • Agent cannot hear the supervisor
  • Customer does not hear supervisor (as expected)

Logs show:

  • supervisor channel successfully removed from bridge main bridge where he was with agent,customer.
  • onStasisStart is triggered for the new snoop channel.
    String supervisorChannelId = callerArgs.get(0);
    bridge = createWhisperBridgeAndAddChannelI(supervisorChannelId);
    addChannelToBridge(bridge,channelId,null);
    public static String createWhisperBridgeAndAddChannelI(String channel) throws RestException {
    Bridge bridge = ari.bridges().create().setType(“mixing”).execute();
    ari.channels().unmute(channel).setDirection(“out”).execute();
    addChannelToBardgingBridge(bridge.getId(),channel);
    return bridge.getId();
    }
  • Snoop channel is added to the new whisper bridge.
  • Everything appears fine, but voice from supervisor isn’t reaching agent.

What I suspect:

Is there something wrong in how I handle the setWhisper("in")?
Do I need to set media flow or RTP somehow explicitly to allow the whisper audio?

Would be grateful for any insights!

I’m implementing a whisper feature using ARI, and I’ve run into a problem I can’t quite figure out.
When I initiate whisper mode using a snoop channel, I am able to hear the agent, but the agent cannot hear me — even though the whisper direction is set to "in".
No errors are thrown, and the bridge creation and channel addition seem fine.

Code:

DTMF triggers whisper mode:

Channel snoop = ari.channels().snoopChannel(targetAgentChannel, “_whisper-” + channelId)
.setApp(“app-name”)
.setAppArgs(channelId)
.setSpy(“both”)
.setWhisper(“in”)
.execute();
Then in onStasisStart for the snoop channel:
public static String createWhisperBridgeAndAddChannelI(String channel) throws RestException {
Bridge bridge = ari.bridges().create().setType(“mixing”).execute();
ari.channels().unmute(channel).setDirection(“out”).execute(); // also tried “in” and muting
addChannelToBridge(bridge.getId(), channel); // Whisper channel added here
return bridge.getId();
} (here channel is snoop channel args,channelId) I later add snoop channel to this bridge

logs

202504231042049,asterisk,onSuccess,{“args”:[“1745385117.4631889”],“asterisk_id”:“00:50:56:01:16:64”,“application”:“app-4”,“channel”:{“connected”:{“number”:“”,“name”:“”},“caller”:{“number”:“”,“name”:“”},“name”:“Snoop/1745385112.4631888-00000005”,“dialplan”:{“app_name”:“Stasis”,“context”:“default”,“app_data”:“app-4,1745385117.4631889”,“priority”:1,“exten”:“s”},“language”:“en”,“creationtime”:“Wed Apr 23 10:42:21 IST 2025”,“id”:“1745385141.4631892”,“state”:“Up”,“accountcode”:“”},“type”:“StasisStart”,“timestamp”:“Wed Apr 23 10:42:21 IST 2025”},bargingCode,9604,bridgeId,b1d4e3c4-33ab-4dee-8a72-026e0d1cbeb6,agent removed from the bridge and created a snoop channel,
onStasisStart,details,{“args”:[“1745385117.4631889”],“asterisk_id”:“00:50:56:01:16:64”,“application”:“app-4”,“channel”:{“connected”:{“number”:“”,“name”:“”},“caller”:{“number”:“”,“name”:“”},“name”:“Snoop/1745385112.4631888-00000005”,“dialplan”:{“app_name”:“Stasis”,“context”:“default”,“app_data”:“app-4,1745385117.4631889”,“priority”:1,“exten”:“s”},“language”:“en”,“creationtime”:“Wed Apr 23 10:42:21 IST 2025”,“id”:“1745385141.4631892”,“state”:“Up”,“accountcode”:“”},“type”:“StasisStart”,“timestamp”:“Wed Apr 23 10:42:21 IST 2025”},
snoop channel is now up: Snoop/1745385112.4631888-00000005,id: 1745385141.4631892

#######when I left the whisper bridge
=========== chanel left bridge : bridge =============== {“asterisk_id”:“00:50:56:01:16:64”,“application”:“app-4”,“channel”:{“connected”:{“number”:“”,“name”:“”},“caller”:{“number”:“781100996”,“name”:“”},“name”:“PJSIP/softswitch-00228f7f”,“dialplan”:{“app_name”:“Stasis”,“context”:“axon”,“app_data”:“app-4”,“priority”:9,“exten”:“0117109638”},“language”:“en”,“creationtime”:“Wed Apr 23 10:41:57 IST 2025”,“id”:“1745385117.4631889”,“state”:“Up”,“accountcode”:“”},“bridge”:{“creator”:“Stasis”,“channels”:[“1745385141.4631892”],“bridge_type”:“mixing”,“bridge_class”:“stasis”,“name”:“”,“video_mode”:“talker”,“creationtime”:“Wed Apr 23 10:42:21 IST 2025”,“technology”:“simple_bridge”,“id”:“a1ddafb0-8037-41fb-8a7b-b837444e4f8e”},“type”:“ChannelLeftBridge”,“timestamp”:“Wed Apr 23 10:43:00 IST 2025”}

  • Is there any specific channel direction/unmute/mute setting needed for the snoop channel in whisper mode?
  • Is whisper: "in" enough, or does the audio path need additional configuration?
  • Is there a known limitation or behavior in whisper bridges I might be missing?

You would want to whisper to the out direction.

Thanks for the clarification. I did try setting .setWhisper("out") as suggested, since my goal is to whisper to the agent (i.e., have the agent hear me but not the customer). However, even with that setting, the agent still isn’t able to hear my voice. The snoop channel is successfully created and added to a mixing bridge, and I’ve unmuted it in the “out” direction as well (.setDirection("out")), but still no audio is reaching the agent.

Just for additional context — in the earlier part of the call, the agent, customer, and supervisor are all in the same bridge. The supervisor is muted like this:

###############
ari.channels().mute(supervisorChannelId).setDirection(“in”).execute();

So their voice can’t be heard by others.

When the supervisor presses 1, I initiate the whisper flow — snooping the agent’s channel, creating a new mixing bridge, and adding the snoop channel to that. I’ve also tested leaving the agent in the original bridge and just unmuting the supervisor, and in that case, their voice is heard by both agent and customer — which defeats the purpose of whispering.

So I avoided bridging the agent and snoop channel directly to prevent this, but now the agent hears nothing at all.

Any idea what else could be wrong? Am I missing a media path configuration, or is there a limitation in the way whispering works when the target is still bridged elsewhere?

Are you putting the supervisor channel in the bridge with the Snoop channel?

As well, there is no limitation with the channel you are snooping on being bridged elsewhere or having to unmute the Snoop channel.

The Snoop channel will whisper what it is bridged to, or what is played to it. If you want a verification, then don’t put the Snoop channel in a bridge and instead call playback on it to play an audio file. If that gets whispered in then your Snoop channel side is fine.

yes at first I clearly not Initially, yes — I added both the supervisor and the snoop channel to a separate whisper bridge. But later, I tested a version where I just created the snoop channel (with .setWhisper("out")) and did not add it to any bridge — just kept the original setup where agent, supervisor, and customer were all still in the same bridge.Honestly, I’m still not totally sure how the snoop channel works in terms of media — I followed the ARI docs assuming it would handle injecting audio toward the agent without needing to bridge anything else manually.

Also tested just unmuting the supervisor directly while all three were still in the same bridge, and in that case, the supervisor’s voice was heard by both the agent and the customer — which defeats the whisper intent.

Would really appreciate any clarity on how the snoop channel is supposed to route audio in whisper mode, and whether additional bridging is required.

I’m not sure what additional information I can provide because there isn’t that much.

A Snoop channel whispers audio into the channel it is snooping on, no matter where that channel is. It does this transparently to that channel.

A Snoop channel is a normal channel and can be bridged to other things, or playback called on it, or if spying then record.

You have to connect it to SOMETHING that is providing the audio to inject.

Creating a Snoop channel and connecting it to nothing won’t do anything.

Keeping the supervisor channel in the same bridge as the agent and caller won’t work if you want to whisper to a single channel. It just won’t. Trying that will just result in it failing every time when you unmute them.

Thanks for the clarification! That makes perfect sense now.

So, to summarize:

  • The Snoop channel needs to be connected to something that provides audio — it won’t work if it’s just created but not bridged or connected to an audio source.
  • I now understand that I can’t keep the supervisor channel in the same bridge as the agent and caller if I want to whisper specifically to the agent. It makes sense that this would cause issues when trying to unmute the supervisor.
  • My next step will be to create a separate bridge, adding the supervisor and snoop channels to it, so the whisper can work correctly.

Just to clarify, if I mute a channel in one bridge, remove it, and then add it to another bridge, does the mute state persist in the new bridge, or would I need to mute the channel again after adding it to the new bridge?

Calling mute on a channel does it on the channel, no matter where it is. It persists for as long as you have the channel muted.

If you mute the supervisor, move it to a bridge with a Snoop channel, and don’t unmute then no audio would be whispered.

Thanks a lot, it’s working now!
The issue was that I wasn’t unmuting the whispering channel in the right direction.
After fixing that, I removed the old whisper channel, created a new snoop channel, and added both the whisper and snoop channels to a bridge.
Now the agent can hear the supervisor, but the customer can’t. Appreciate your help!

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