Re: [Asterisk-java-devel] How to create a new Event.class
Brought to you by:
srt
From: <Jac...@L-...> - 2014-02-12 16:05:13
|
If you are wanting to know when a phone is taken off-hook would it not be better to monitor the NewChannelEvent or if you implement the AsteriskServierListener you will have the method onNewAstereiskChannel called each time a new channel created (phone is taken off-hook) I personally implemented the AsteriskServerListener and every time onNewAstereiskChannel is called I add a property change listener to the AsteriskChannel object so that I receive all changes to the channel as well. Jacob From: Jose Baez [mailto:pe...@gm...] Sent: Wednesday, February 12, 2014 8:26 AM To: ast...@li... Subject: Re: [Asterisk-java-devel] How to create a new Event.class OK, I have sniffed AMI directly and there is not any Pickup Event sent (and I have every events permitted in manager.conf) I could checked BridgeEvent but there are many Link/Unlink messages when people presses DTMF.... Do you think is OK to check first Bridge Link event as if it were a Pickup event? On 12 February 2014 14:01, Jose Baez <pe...@gm...> wrote: Hello! I needed a new ManagerEvent not developed in Asterisk-Java (PickupEvent). I am not a developer, so I made a new class (PickupEvent.java) based on other Asterisk-Java source code (with proper setters/getters). My code for handling ManagerEvent is (1.0.0-CI ) @Override public void onManagerEvent(ManagerEvent event) { if (event.getClass() == NewExtenEvent.class) { handleEvent((NewExtenEvent) event); } else if (event.??? == PickupEvent.class) { handleEvent((PickupEvent) event); } } Can I create this new class in my project without putting it in library (which I don't know) ? I already made the class and: event.getClass() == PickupEvent.class ...never gets called What else do I need? Thanks. |