How to monitor call realtime using AGI?

Firstly, I’m completely new in Asterisk/Freepbx and this forum. So please direct me if do mistake in posting.

I’m developing a custom AGI script for limiting call. I was successful to restrict/permit user for outbound call. Now I need to monitor call, realtime. In every 30 sec probably. I need to check every 30 sec if the user has enough credit. Is there any AGI event for that?

I’m currently monitoring outgoing call using this dialplan

Is there any event which simultaneously passing call data or status?

Thanks in advanced.

There is no mechanism from the dialplan to have something periodically invoked. You’d have to listen on AMI to know when stuff is happening and control it.

Even though you use AMI, there is no such event on AMI. If you are trying to build a prepaid calling system using PHP, there are other mechanism to achieve this goal

I’ve achieved in a complex way. I hear DIALSTATUS to update/decide billing matters of an user. And set auto hangup time before originating a call.
However thanks for your comments.