Good morning,
I need to record the call via a channel so I only capture the customer’s voice. I’m trying to do so through this service, but I’m getting this error:
[May 14 12:45:37] ERROR[6120][C-0000000a]: res_stasis_recording.c:306 record_file: Cannot record channel while in bridge
LOGS:
May 14 12:45:40 VICIDIAL-PRU2 python[4269]: Channel 1747244718.33 has started broadcasting.
May 14 12:45:40 VICIDIAL-PRU2 python[4269]: Recording channel 1747244718.33 - Status: 201 - Text: {
May 14 12:45:40 VICIDIAL-PRU2 python[4269]: “name”: “recording-1747244718.33”,
May 14 12:45:40 VICIDIAL-PRU2 python[4269]: “format”: “wav”,
May 14 12:45:40 VICIDIAL-PRU2 python[4269]: “state”: “queued”,
May 14 12:45:40 VICIDIAL-PRU2 python[4269]: “target_uri”: “channel:1747244718.33”
May 14 12:45:40 VICIDIAL-PRU2 python[4269]: }
May 14 12:45:40 VICIDIAL-PRU2 python[4269]: ARI event received: RecordingFailed
May 14 12:45:40 VICIDIAL-PRU2 python[4269]: ARI event received: ChannelTalkingFinished
COD:
def record_audio(channel_id):
url = f"{ARI_BASE_URL}/channels/{channel_id}/record"
params = {
“name”: f"grabacion-{channel_id}“,
“format”: “wav”,
“maxDurationSeconds”: 30,
“maxSilenceSeconds”: 4,
“beep”: False,
“mix”: True
}
try:
res = requests.post(url, params=params, auth=(ARI_USER, ARI_PASS))
res.raise_for_status()
log(f" record Channel {channel_id} - status: {res.status_code} - text: {res.text}” )
except Exception as e:
log(f" Error record Channel {channel_id}: {e}")