Re: [Asterisk-java-users] MusicOnHoldEvent
Brought to you by:
srt
From: MT <moh...@gm...> - 2013-02-07 14:06:07
|
thanks yves for reply, but as I said the org.asteriskjava.manager.event.MusicOnHoldEvent is read by onManagerEvent and I can see MusicOnHoldEvent when I telnet to 5038. I think the problem is this method : handleEvent(MusicOnHoldEvent event) is not exist in AbstractManagerEventListener. I found this solution: public void onManagerEvent(ManagerEvent event) { if (event instanceof MusicOnHoldEvent) { handleEvent((MusicOnHoldEvent) event); } else { super.onManagerEvent(event); } } thank you yves On Wed, Feb 6, 2013 at 1:48 AM, Yves A. <yv...@gm...> wrote: > Hello mohsen, > > for some events to occur, you have to configure asterisk to fire them... > take a look in your manager.conf and sip.conf for appropriate settings. > e.g. if sip.conf contains the line > > callevents=yes > > regards, > yves > > Am 05.02.2013 14:30, schrieb MT: > > Hi everyone, > > I can't get MusicOnHoldEvent in handleEvent method but I can see org.asteriskjava.manager.event.MusicOnHoldEvent > when I use onManagerEvent method. > I can get another events > like: HangupEvent,NewStateEvent,PeerStatusEvent,QueueMemberPausedEvent,... > but can't get MusicOnHoldEvent,HoldedCallEvent,HoldEvent > > this is my code: > > public class Monitor extends AbstractManagerEventListener { > > private ManagerConnection managerConnection; > > public Monitor() throws IOException { > > ManagerConnectionFactory factory = new > ManagerConnectionFactory('manager_host', 'manager_user', 'manager_pass'); > > this.managerConnection = factory.createManagerConnection(); > } > > public void run() throws IOException, AuthenticationFailedException, > TimeoutException, InterruptedException { > managerConnection.addEventListener(this); > > managerConnection.login(); > > Thread.sleep(new Long(1000000000)); > } > > public static void main(String[] args) throws Exception { > Monitor helloEvents; > > helloEvents = new Monitor(); > helloEvents.run(); > } > > // when I uncomment following method I can see > org.asteriskjava.manager.event.MusicOnHoldEvent > // public void onManagerEvent(ManagerEvent event) { > // System.out.println("new Manager Event: "+event); > // } > > protected void handleEvent(HangupEvent event) { > System.out.println("Hangup Event"); > } > > protected void handleEvent(NewStateEvent event) { > System.out.println("New State Event"); > } > > // ... also another events works fine like I said above but music on > hold event does not work > > protected void handleEvent(MusicOnHoldEvent event) { > System.out.println("Music On Hold Event"); > } > } > > > I don't know what to do, please help me :( > > mohsen > > > > > ------------------------------------------------------------------------------ > Free Next-Gen Firewall Hardware Offer > Buy your Sophos next-gen firewall before the end March 2013 > and get the hardware for free! Learn more.http://p.sf.net/sfu/sophos-d2d-feb > > > > _______________________________________________ > Asterisk-java-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > > > > ------------------------------------------------------------------------------ > Free Next-Gen Firewall Hardware Offer > Buy your Sophos next-gen firewall before the end March 2013 > and get the hardware for free! Learn more. > http://p.sf.net/sfu/sophos-d2d-feb > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > |