Re: [Asterisk-java-users] Manager Events blocked
Brought to you by:
srt
From: Martin S. <ma...@be...> - 2007-10-18 14:12:29
|
Hello Gabriel, =20 Stefan's answer reproduced below might help you. It sounds like you are mixing the Live API (AsteriskServer) and the manager API (ManagerEventListener). You may also want to double check you are using OriginateAction.setAsync(true). =20 > -----Original Message----- > From: ast...@li...=20 > [mailto:ast...@li...] On=20 > Behalf Of Stefan Reuter > Sent: Wednesday, September 05, 2007 4:34 PM > To: ast...@li... > Subject: Re: [Asterisk-java-users] Execute Action after=20 > connect or reconnect >=20 > Hi, >=20 > you seem to be mixing the live API and the manager API. While this is > generally possible I think it would be better to just stick with the > live API. You are adding a callback to the ConnectEvent, so maybe the > best solution would be to provide a way to register a few=20 > more callbacks > like for connect and disconnect in the live API. >=20 > The problem in this case is that a ManagerAction is send from=20 > the event > dispatching thread which is not allowed. Generally the live=20 > API handles > this problem by using a ManagerEventListenerProxy but by registering > your own listener with the underlying connection you prevent this from > working correctly. > So what you have to do is to decouple receiving the event and sending > the action on your own. One solution is starting a new Thread as > proposed by Martin. Another solution is to use=20 > ManagerEventListenerProxy > for your own listener, too. > This might look like this: >=20 > Instead of >=20 > managerConnection.addEventListener( > new ConnectEventListener(asteriskserver)); >=20 > use >=20 > managerConnection.addEventListener(new ManagerEventListenerProxy( > new ConnectEventListener(asteriskserver))); >=20 > =3DStefan =20 Martin Smith, Systems Developer ma...@be... Bureau of Economic and Business Research University of Florida (352) 392-0171 Ext. 221=20 =20 ________________________________ From: ast...@li... [mailto:ast...@li...] On Behalf Of Gabriel Allasia Sent: Wednesday, October 17, 2007 9:42 PM To: ast...@li... Subject: [Asterisk-java-users] Manager Events blocked =09 =09 Hi, When we use AsteriskServer.originateToExtensionAsync to generate async calls to an extension and context, we have problems to listen events in a class that implements ManagerEventListener. It seems like the events are blocked until the call is finished. However if we use other extensions and contexts, everything goes ok. =20 Any suggestions? Thanks in advance, Gabriel. =09 |