Record a Dialed channel in ARI using create/dial

I am initiating a call in ARI application in the following steps:

  1. create a channel using ari.channels.create()
  2. Dial the channel using ari.channels.Dial()

Now when I try to start a recording on the originated channel it fails with the following message on asterisk console:

ERROR[3878] res_stasis_recording.c: Cannot record channel while in bridge

I can also see in the asterisk console that the originated channel was placed into the bridge while being added to the Stasis App. Is this the default behavior?
How can I do a recording on this channel now?

I tried to listen to ChannelEnteredBridge event on the created channel in order to get the bridge id so that I can call record on the bridge instead but I never get this event.

Created and dialed channels go into a bridge to manage them, they can’t be recorded like that. What is your end goal?

Thanks @jcolp. I want to take a voice input from the created channel which I will then pass to google speech recognition. Say I want the callee to say a command which needs to be processed.

I was considering the option to do bridge recording, but for that I need the bridge id, I thought of listening for the ChannelEnteredBridge event. i have registered a listener using channel.on(“ChannelEnteredBridge”, myHandler), right after calling ari.channels.create() and before calling ari.channels.dial().
This again is not getting called, i suspect the bridge either gets created even before I register the handler.

It’s an internal bridge. The easiest option is not to use create and dial, but the normal originate. That will behave as you want.

Ok, that is the only option then, I earlier switched from originate to create/dial as in case of originate I was not able to listen to progress and ringing events on the dialed channels.

The current create/dial functionality isn’t really written with that in mind. You could potentially add it to a bridge you create instead if you really want it. I haven’t tried that though for this.

Ok, I will try that. It should work if I create a bridge and add this channel to it and then do recording on that bridge.

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