Question: I wanted to access some variables of a channel for example ${CDR(duration)} and ${CDR(billsec)} on hangup event because these variables could not be accessed until the call has been terminated however I always got error Channel Not Found. I guess I was too late as the channel had already been destroyed. Tried on other events too such as OnChannelLeftBridgeEvent, OnStasisEndEvent but with no lucks. In which event I can access to these kind of variables before the channel has been destroyed or its impossible?
ARI is asynchronous, when a channel is hung up there is absolutely no guarantee that when you do anything it will still exist. There is the ability to configure channel variables to go out every time channel information goes out by configuring it in ari.conf, but I haven’t used that for CDR stuff so I don’t know if it would work or how well.
I too would like to see all channel variables via the ARI upon channel hangup but prior to destruction. But I can’t find any ari.conf option to include all variables on every channel information message.
I’m using Asterisk 20, and since this thread is 5 years old, maybe the solution has changed. Anyone else figured out how to do this?