Re: [Asterisk-java-users] MusicOnHoldEvent
Brought to you by:
srt
From: Yves A. <yv...@gm...> - 2013-02-05 22:19:46
|
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 list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |