How to determine the free channel from Asterisk-Java impleme

Hi Friends,
I have an IVR set up using Asterisk and Asterisk-Java Fast AGI Implementation.
The user can navigate through the menu by selecting various numbers.
I have to give an option as “To speak to our customer care executive… press 9”.
What I want is, How can I determine from the AGI Implementation which number is free and how do I forward the call to that number.
In brief, how do I know which agent currently can answer the call, and how do I forward the call to him.
Another important thing is, I have to forward the details of the customer calling (like his account number etc… which are captured in IVR) to this agent who will answe the call.
Also I would like to know what happens when I return the control to the dial plan from the java program without hangup() the channel. Can I determine in the dial plan whether the channel is hungup() by the java program or not?

Please anybody who has implemented the above requirement, or who has worked with call center applications using Asterisk Java Fast Agi help me out.

Thanks in advance
Anvar.

Has anybody devised a solution for the above problem friends…?
Please help…
Thankyou

Try this: http://www.voip-info.org/wiki/index.php?page=Asterisk+cmd+ChanIsAvail i dont use Java (using C#) but think that it is it what you want.

Greetings

Hi yarns,
Thankyou for the idea…
I shall investigate how to implement this in asterisk-java fastAGI.
Thankyou.[/list]