John,
I did a couple of things to make sure I was making the most of events... You
might find it useful to try the following...
1. Use a program like Ethereal to sniff packets being recieved by your
server running Manager. This way you see exactly what you're getting. You
can filter to only show packets from the asterisk machine, and then you can
do a test of the situation that you want to capture and see if asterisk is
telling you what you need.
2. Look into 'user defined events'
http://www.voip-info.org/wiki/view/Asterisk+cmd+UserEvent
3. grep on the entire asterisk directory for the currently generated events,
I'm sure what your looking for would be in in channel.c if it exists, or
trust the list at http://www.voip-info.org/wiki/view/asterisk+manager+events
4. if you look at the source for asterisk, you'll see that it's not hard to
add events right in the source code and recompile if it's mission critical.
5. as well, Stefan did a great job of laying out Asterisk-java, so you could
download the source and add a class for your handler if you create one.
Hope this helps.
Jason
-----Original Message-----
From: ast...@li...
[mailto:ast...@li...]On Behalf Of John
Farnell
Sent: Monday, February 13, 2006 1:38 AM
To: ast...@li...
Subject: [Asterisk-java-users] Call waiting/Busy/Dialing
Hi,
I am calling setAction(action, handler) on an instance of
net.sf.asterisk.manager.DefaultManagerConnection. The 'action' variable is
an instance of net.sf.asterisk.manager.action.OriginateAction created as
follows :-
OriginateAction actionReturn = new OriginateAction();
actionReturn.setChannel(Zap/g0/+ strTelephoneNumber);
actionReturn.setExten("200");
actionReturn.setContext("from-internal");
actionReturn.setPriority(new Integer(1));
actionReturn.setTimeout(new Long(30000));
actionReturn.setAsync(new Boolean(true));
I have checked the extensions.config and the from-internal context as per
the default install. My goal is to trap events (states?) of
dialling/busy/callwaiting/phone number disconnected and ringing in the
handleEvent method of my handler class. I am easily able to trap dialling
and ringing states via 2 NewStateEvent that are supplied to the handler.
However I am not sure which events to interrogate to determine whether a
call is any of callwaiting/linebusy/ or line disconnected. Is it possible to
use the Manager API to find this information? and if so how can it be done?
Will I need to set up a different context on the Asterisk server to achieve
this?
Any assistance would be greatly appreciated.
John Farnell.
|