Re: [Asterisk-java-users] EVENT LISTENER PROBLEM
Brought to you by:
srt
From: Daniele R. <dan...@gm...> - 2009-07-21 18:18:16
|
Hi Martin, the code is quite structurated but I try to paste the relevant points: *CREATE THE ACTION (in a thread. This action then is send to the Manager thread that send the action to Asterisk) action.setContext(sContext); action.setExten(sExten); action.setPriority(new Integer(iPriority)); action.setTimeout(new Long(iTimeout)); action.setActionId(""+telefonata.getId()); action.setAsync(true); *MANAGER (is a thread that send the action to Asterisk and waint ultil the HangupEvent is throw or untile timeout) ManagerConnectionFactory factory = new ManagerConnectionFactory(asteriskHost, asteriskManagerPort, asteriskManagerUser, asteriskManagerPsw); this.managerConnection = factory.createManagerConnection(); log.debug("Creata connessione al server Asterisk " + managerConnection.getState()); managerConnection.addEventListener(this.managerEventListener); managerConnection.sendAction(getAsteriskAction(), 300000000); try { Thread.sleep(180000); } catch (InterruptedException ex) { } } log.debug("Sto effettuato la disconnessione dal Manager di Asterisk sull'host " + managerConnection.getHostname()); managerConnection.logoff(); *EVENT LISTENER (the listener to asterisk Event) @Override public void onManagerEvent(ManagerEvent event) { log.debug("Evento "+((AbstractChannelEvent)event).getUniqueId()+" - " + event); The listener is very long and intercept all the events to asterisk. *DIALPLAN The action that run from Java code is somethig as this: Dial(trunk/telephoneNumber), extension s, priority 1, context [context] exten => s,1,Answer() ;I play a message exten => s,2,Background(custom/message/intro) exten => s,3,Hangup() In few words, this is an automatic call system that calls many users and play them a simple vocal message. My problem is that in the events that asterisk send to me (througt Asterisk Java) there isn't something that tell to me which call the refers. Infact all calls go to [context] and all make same things. Thanks Best regards 2009/7/21 Martin B. Smith <ma...@mb...>: > Hi Daniel, > > That snippet doesn't help much; you don't even provide the declaration > of the action variable or how you send it. Any number of things could be > going on here, and we don't really have enough information to diagnose > the problem. > > Furthermore, depending on how your dialplan is setup, your ability to > determine which events correspond to which calls could be impaired. > > We'd really need a complete example of how you create and send the > action, and how you handle the response; we'd also need to see any > relevant dialplan contexts that the call may go into. > > Good luck, > > Martin > > > > Daniele Renda wrote: >> Hi, >> I'm using Asterisk Java with my Asterisk 1.6 and all works fine. I've only a >> small problem with ManagerEventListener. I'm using the listener to >> catch the event about a call that I've scheduled from Java. I create a >> automatic call in this mode: >> >> >> action.setContext(sContext); >> action.setExten(sExten); >> action.setPriority(new Integer(iPriority)); >> action.setTimeout(new Long(iTimeout)); >> action.setActionId(""+telefonata.getId()); >> action.setAsync(true); >> >> All works fine if I make only ONE call at same time, but if I try to make >> two or more calls I am not be able to detect wich events are of the >> first call and which are of the second call. >> The unique id of the events are not linked to the action that I've >> submitted and the actionId that I can set is not included in the >> response event. So how I can detect exactly the events of each call >> separatly? >> >> >> Thanks very much for your help! >> Best regards > > > ------------------------------------------------------------------------------ > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > -- Daniele Renda |