On Mon, Apr 28, 2008 at 8:34 PM, Vieri <rentorbuy at yahoo.com>
wrote:> How can I get a list of the callers within a specific
> queue at any given moment?
>
> I need to get the caller IDs of all active calls in a
> queue then send them out via a udp socket to a
> listening application on the network (the only data I
> need to send are two fields: current timestamp and
> caller id of active queue calls).
>
> I have almost all the elements to do this except the
> best method to retrieve "all active caller ids from a
> given queue". I was wondering if someone already did
> this.
>
> I tried writing a script on the server which connects
> to the Manager API and receives queue events. I'm
> basically using the AgentCalled event but it seems
> clumsy to efficiently detect when the call has ended
> (connect or abandon) and thus update the remote UDP
> listening app.
>
> I also tried another way by guessing which calls are
> active via tailing and grepping
> /var/log/asterisk/queue_log.
>
> Finally, a third script method tried parsing the
> output of "show queue XXXX" right after "Callers:".
> Maybe this is all I really need for my purposes
> (although less efficient and less "real-time" than the
> queue events method because I would need to
> periodically poll the whole queue statistics) but I
> only get the originating channel and the wait time. I
> would require correlating the data to the caller's ID.
>
> Has anyone already done something similar?
> A simple example/script/suggestion would be greatly
> appreciated.
I'm not sure that this is what exactly You need, but I have a patch
for app_queue
that will store and update queue callers (as well as update lots of
fields for queue members) in realtime mysql table. This allows to do
many requests for current queue state simultenously, and moves load
from asterisk to mysql (which can be on separate machine). So,
generally to get active callers with all their callerid/channel info
You will have to do just "SELECT * FROM queue_callers".
It's not very finalized, so I haven't yet posted that to Digium for
inclusion in next asterisk versions, but I intend to do that in
future. It's been working stable on our production for several months.
If You're interested, please reply, and I'll try to separate that
patch out from other our patches.
Currently I have it updated for 1.4.19, but also have some version for 1.4.14
Regards,
Atis
--
Atis Lezdins,
VoIP Project Manager / Developer,
atis at iq-labs.net
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835