Java Solution for control active channels

I need to develop agi services by java to monitor active channels and dependent billing policy ( Such as Charge credit) and play specific voice on active channels.any solution for that? this is my code below

import org.asteriskjava.fastagi.AgiChannel;
import org.asteriskjava.fastagi.AgiException;
import org.asteriskjava.fastagi.AgiRequest;
import org.asteriskjava.fastagi.BaseAgiScript;

public class ExampleCallIn extends BaseAgiScript {

public void service(AgiRequest request, AgiChannel channel) throws AgiException {

try {
    //TODO get active channels
    // Answer the channel...
    // if ( isLowCharge ) {  channel.answer(); };
    // ...say hello...

// exec(“Playback”, “welcome”);
} catch (org.asteriskjava.fastagi.AgiHangupException e) {
System.out.println(“the user hanged up!!”);



/// in extension.cfg

include => ext-local
exten => 5551212,1,Agi(agi://
exten => 1300,1,Agi(agi://
exten => 2001,1,Agi(agi://
exten => 2003,1,Agi(agi://
exten => _XXXX,1,Agi(agi:// ;
Best Regards.