ari.on(‘ChannelStateChange’, async function (event, outgoingChannel) {
const eventName = “ChannelStateChange”;
const { state } = event.channel;
if (state == “Ringing”) {
const currentTime = moment().format(‘YYYY-MM-DD-ddd h:mm:ss’);
const payload = { variable: “CDR(ring_time)”, value: currentTime }
await outgoingChannel.setChannelVar(payload).catch(err => log(“Error : unable to store ringing state on channel :”, outgoingChannel.id, err.message));
}
});
I’m facing an issue while setting CDR(“ring_time”) before answers
it throwing me an error “Channel is not in stasis application”.
Kindly help thanks.