Asterisk ARI - Access channel variables when hangup


#1

I’m using Asterisk ARI v.16 and AsterNET.ARI

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?


#2

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.