Re: [Asterisk-java-users] DefaultAsteriskManager and queues
Brought to you by:
srt
From: Stefan R. <sr...@re...> - 2005-07-13 06:19:13
|
Hi Jan, > I noticed that DefaultAsteriskManager does handle queues too, or at least= it=20 > has the stubs for it in 0.1. However, as the flag queuesInitialized is al= ways=20 > true DefaultAsteriskManager requests Channel and Queue state at startup. To do this it sends a StatusAction and a QueueStatusAction. Until that initial state is received it queues any state changing events to apply them as delta to the initial state later on. The StatusAction results in a StatusEvents being sent for every active channel. Asterisk indicates that all StatusEvents have been sent by sending a StatusCompleteEvent. So when DefaultAsteriskManager receives a StatusCompleteEvent it knows that the initial channel state has been completely received (now channelsInitialized =3D=3D true). Unfortunatly the QueueStatusAction does not result in a QueueStatusComplete event being sent, so it never knows whether queue state is completely received. Therefore the hack to set it to true at startup. This will work most of the time, but might cause trouble when receiving queue changing events while still evaluating the results of the QueueStatusAction. > then the queues never get handled by DefaultAsteriskManager.handleEvent=20 > and the events are instead sent to event handlers directly.=20 They are handled and with the limititation above it works fine. > Of course I can=20 > do the handling manually, but as the code already seems to be in place in= =20 > DefaultAsteriskManager I'd like to use that code and not build my own=20 > framework on top of it. So call me lazy. :) Another option is to just fix DefaultAsteriskManager where it might be broken and submit a patch. So you get free maintainance for that part in the future :) > Of course, if DefaultAsteriskManager one day starts to handle the=20 > events then my own code is left cold in the water. No, your code will always work. At least if you registered your event handler independently with the underlying ManagerConnection. In this case you always receive every event regardless of what DefaultAsteriskManager does with that event. So have a look at it and decide whether it works for you. I will check if there is a QueueStatusComplete event in Asterisk CVS-HEAD and maybe submit a patch to Digium if there isn't. Cheers, Stefan |