Asterisk 13 - Cant play a voicemail while recording on that channel

In my development, I am trying to record everything during a call.
1- Record the agent speaking to a customer inside a bridge
2- Let’s say the customer has an answering machine, in this case i will play a voicemail for him
3- When I play the voicemail, the customer must be removed from the bridge before that, so the agent can make other calls.

This is my scenario.
So the recording is working fine on step (1). I can record everything in the bridge. After that, the customer is removed from the bridge and I start recording only his channel. But when I try to play the voicemail on his channel,

  • POST /ari/channels/1513884679.215/record?name=recording_ch_outbound_10115.ulaw&format=ulaw&maxDurationSeconds=0&ifExists=append

The response I get in the websocket is that this request was queued

“name”: “recording_ch_outbound_10115.ulaw”,
“format”: “ulaw”,
“state”: “queued”,
“target_uri”: “channel:1513884679.215”

And it is not being played. The customer can’t hear that voicemail.
As soon as the customer hangs up, I can see a log error on asterisk

[Dec 21 14:34:20] WARNING[11002][C-0000004c]: res_stasis_playback.c:250 playback_final_update: 1513884679.215: Playback failed for sound:/var/lib/asterisk/sounds/sc_voicemail/VM_24_831

So it seems to me I can’t record a channel + play voicemail on it.
I couldn’t find anywhere in the documentation that says so, and for me its probably something i am missing there. Do you know what might be wrong?

Info:
I am working with Asterisk 13, and I am developing a server on c++ to communicate with Asterisk using ARI only. My dialplan basically only runs the Stasis() function.

You can’t do two things at once on a channel in ARI. If it’s recording then you can’t play at the same time.

What exists is a Snoop channel. It essentially forks the audio stream (in the direction you specify) and gives you a channel that delivers it. You can send that snoop channel elsewhere (for example record). This allows you to implement something like Chanspy or Mixmonitor, for example.

Thanks Joshua,
I implemented the snoop on that customer channel and I get a new channelId, I am trying to send the play voicemail on that new snoop channel and I kept the recording on the customer original channel.

Still didn’t work, but I am taking a look at what might be wrong.

I am playing the voicemail to the snoop channel id but i can’t hear anything

Customer channel Id = 1513967138.391
Snoop channel Id = 1513967099.388

This is the Asterisk LOG:

– <Snoop/1513967099.388-0000000b> Playing ‘/var/lib/asterisk/sounds/sc_voicemail/VM_24_831.slin’ (language ‘en’)
– Channel PJSIP/clickproxytrunk-00000083 joined ‘simple_bridge’ stasis-bridge <24>
– Executing [s@default:2] Answer(“Snoop/1513967099.388-0000000b”, “”) in new stack
– Executing [s@default:3] Set(“Snoop/1513967099.388-0000000b”, “TIMEOUT(digit)=5”) in new stack
– Digit timeout set to 5.000
– Executing [s@default:4] Set(“Snoop/1513967099.388-0000000b”, “TIMEOUT(response)=10”) in new stack
– Response timeout set to 10.000
– Executing [s@default:5] BackGround(“Snoop/1513967099.388-0000000b”, “demo-congrats”) in new stack
– <Snoop/1513967099.388-0000000b> Playing ‘demo-congrats.gsm’ (language ‘en’)
– Executing [s@default:6] BackGround(“Snoop/1513967099.388-0000000b”, “demo-instruct”) in new stack
– <Snoop/1513967099.388-0000000b> Playing ‘demo-instruct.gsm’ (language ‘en’)

It seems to be entering a different dial plan. Do you know why is it playing those GSM files?
And why I can’t hear the voicemail on the customer channel?

If you directed it into the dialplan somehow then it would likely do that… also injecting media requires a constant stream to the device itself which record does not provide. If you reverse the direction (play to the channel, record in snoop) then it’d work better.

1 Like