Re: [Asterisk-java-users] Asynchrnous calls
Brought to you by:
srt
From: Gaëtan M. <gm...@ea...> - 2008-04-23 13:55:30
|
Hi, Another solution is to use sendAction(ManagerAction action, SendActionCallback callback) and pass null as callback, as you're not interested in the result. The code specifically handle the null case with a nice comment :) // if the callbackHandler is null the user is obviously not interested // in the response, thats fine. if (callback != null) { synchronized (this.responseListeners) { this.responseListeners.put(internalActionId, callback); } } Kind regards Gaetan On 23/04/2008, at 15:49, Martin Smith wrote: > James, > > Try using just eventConnection.sendAction(originateAction....) like > the tutorial at http://asterisk-java.org/development/tutorial.html. > > I don't think I've ever even noticed that originate *was* an event > generating action. Either way, the "send event generating action" > code is commented with: > /* > * Implements synchronous sending of event generating actions. > */ > > I'd say use the regular sendAction unless you're expecting a bunch > of events back that you want to wait for, like listing all existing > channels or sip peers or something else that generates events as a > cheap way to return synchronously-available data. > > Let us know how that works out for you :) > > Martin Smith, Systems Developer > ma...@be... > Bureau of Economic and Business Research > University of Florida > (352) 392-0171 Ext. 221 > > > From: ast...@li... [mailto:ast...@li... > ] On Behalf Of James Heggs > Sent: Tuesday, April 22, 2008 4:10 PM > To: Asterisk Java > Subject: [Asterisk-java-users] Asynchrnous calls > > Hi there > > I am currently working with Asterisk Java and trying to make a > dynamic web interface. Within the system from a widget on a web page > I call a servlet that begins to make the call this is all working ok > but what I need the servlet to do is begin to make the call then > return back to the client side immediately. So basically need to > make the call to the Asterisk Server to make the call asynchrnously. > > > Does that make sense? So far I have tried an originate action with > the following details: > > originateAction.setChannel("whatever"); > //originateAction.setChannel("foo/44444"); > originateAction.setContext("context"); > originateAction.setCallerId("\"Test Company\" <SOMENUMBER>"); > originateAction.setExten("9"+exten); > originateAction.setAccount("account"); > originateAction.setPriority(new Integer(1)); > originateAction.setTimeout(15000L); > originateAction.setAsync(true); > > final ResponseEvents responseEvents; > final Iterator<ResponseEvent> responseEventIterator; > AsteriskChannel channel = null; > > responseEvents = > eventConnection > .sendEventGeneratingAction > (originateAction,originateAction.getTimeout() + 2000); > > But this doesn't return to the client UNTIL the call is answered is > there something else I need to do other than setting the action to > async - if people need to see more of the code please let me know > > Regards > > Eggsy > > Messenger's gone Mobile! Get it now! > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save > $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone_______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |