Re: [Asterisk-java-devel] How to create a new Event.class
Brought to you by:
srt
From: <Jac...@L-...> - 2014-02-12 17:51:19
|
I guess the NewChannelEvent is difference depending on what channel type you are using. Most of my phones are SCCP (Skinny) and they create a new channel event as soon as one is taken off-hook, where SIP phone will not do this because they don't create the new channel until it actually starts dialing the other end-point. Correct I usually do an instanceof to determine the event type. Example: Public void onManagerEvent(ManagerEvent managerEvent){ If (managerEvent instanceof BridgeEvent){ BridgeEvent event = (BridgeEvent)managerEvent; // use event to get the info needed } } Jacob From: Jose Baez [mailto:pe...@gm...] Sent: Wednesday, February 12, 2014 10:17 AM To: ast...@li... Subject: Re: [Asterisk-java-devel] How to create a new Event.class Thanks Jacob, but Asterisk doesn't send NewChannel event when someone picks up the phone. Just when phone starts ringing in creates a NewChannel event. ;) I'll use Bridge event for the time being... Anyway, about creating a new .class, one user has told me that I can parse any managerEvent.toString(). No need to create a new class. :)) On 12 February 2014 15:49, <Jac...@l-...> wrote: 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. ------------------------------------------------------------------------ ------ Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.cl ktrk _______________________________________________ Asterisk-java-devel mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel |