VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
rentorbuy at yahoo.com Guest
|
Posted: Mon Apr 28, 2008 12:34 pm Post subject: [asterisk-users] realtime queue callers |
|
|
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.
Thanks,
Vieri
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ |
|
Back to top |
|
|
atis at iq-labs.net Guest
|
Posted: Tue Apr 29, 2008 4:57 am Post subject: [asterisk-users] realtime queue callers |
|
|
On Mon, Apr 28, 2008 at 8:34 PM, Vieri <rentorbuy at yahoo.com> wrote:
Quote: | 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 |
|
Back to top |
|
|
rentorbuy at yahoo.com Guest
|
Posted: Tue Apr 29, 2008 5:22 am Post subject: [asterisk-users] realtime queue callers |
|
|
--- Atis Lezdins <atis at iq-labs.net> wrote:
Quote: | On Mon, Apr 28, 2008 at 8:34 PM, Vieri
<rentorbuy at yahoo.com> wrote:
Quote: | How can I get a list of the callers within a
| specific
Quote: | queue at any given moment?
I need to get the caller IDs of all active calls
| in a
Quote: | queue then send them out via a udp socket to a
listening application on the network (the only
| data I
Quote: | need to send are two fields: current timestamp
| and
Quote: | caller id of active queue calls).
I have almost all the elements to do this except
| the
Quote: | best method to retrieve "all active caller ids
| from a
Quote: | given queue". I was wondering if someone already
| did
Quote: | this.
I tried writing a script on the server which
| connects
Quote: | to the Manager API and receives queue events. I'm
basically using the AgentCalled event but it
| seems
Quote: | clumsy to efficiently detect when the call has
| ended
Quote: | (connect or abandon) and thus update the remote
| UDP
Quote: | listening app.
I also tried another way by guessing which calls
| are
Quote: | 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:".
Quote: | Maybe this is all I really need for my purposes
(although less efficient and less "real-time"
| than the
Quote: | queue events method because I would need to
periodically poll the whole queue statistics) but
| I
Quote: | only get the originating channel and the wait
| time. I
Quote: | would require correlating the data to the
| caller's ID.
Quote: |
Has anyone already done something similar?
A simple example/script/suggestion would be
| greatly
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
|
Thanks Atis.
That patch sounds really neat. Hope it gets into *
soon.
Just a doubt: suppose the mysql daemon dies for some
reason. Will the patched app_queue still handle calls
and not hang?
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ |
|
Back to top |
|
|
atis at iq-labs.net Guest
|
Posted: Tue Apr 29, 2008 5:31 am Post subject: [asterisk-users] realtime queue callers |
|
|
On Tue, Apr 29, 2008 at 1:22 PM, Vieri <rentorbuy at yahoo.com> wrote:
Quote: |
--- Atis Lezdins <atis at iq-labs.net> wrote:
Quote: | On Mon, Apr 28, 2008 at 8:34 PM, Vieri
<rentorbuy at yahoo.com> wrote:
Quote: | How can I get a list of the callers within a
| specific
Quote: | queue at any given moment?
I need to get the caller IDs of all active calls
| in a
Quote: | queue then send them out via a udp socket to a
listening application on the network (the only
| data I
Quote: | need to send are two fields: current timestamp
| and
Quote: | caller id of active queue calls).
I have almost all the elements to do this except
| the
Quote: | best method to retrieve "all active caller ids
| from a
Quote: | given queue". I was wondering if someone already
| did
Quote: | this.
I tried writing a script on the server which
| connects
Quote: | to the Manager API and receives queue events. I'm
basically using the AgentCalled event but it
| seems
Quote: | clumsy to efficiently detect when the call has
| ended
Quote: | (connect or abandon) and thus update the remote
| UDP
Quote: | listening app.
I also tried another way by guessing which calls
| are
Quote: | 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:".
Quote: | Maybe this is all I really need for my purposes
(although less efficient and less "real-time"
| than the
Quote: | queue events method because I would need to
periodically poll the whole queue statistics) but
| I
Quote: | only get the originating channel and the wait
| time. I
Quote: | would require correlating the data to the
| caller's ID.
Quote: |
Has anyone already done something similar?
A simple example/script/suggestion would be
| greatly
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
|
Thanks Atis.
That patch sounds really neat. Hope it gets into *
soon.
Just a doubt: suppose the mysql daemon dies for some
reason. Will the patched app_queue still handle calls
and not hang?
|
It should, as asterisk throws INSERTs, UPDATEs and DELETEs for
changing data (queue callers and queue member status), plus it loads
existing queue members trough SELECT (as it's now with realtime queue
members, just some extra fields). So, I suppose if MySQL dies in
middle of operation, SELECT should fail and Asterisk should just
continue with what it has in memory. Btw, You should be able to also
use static or dynamic queue members (not realtime) in combination with
realtime queue calls.
Btw, I never experienced that MySQL dies, it's more often that Asterisk dies.
So, are You interested in applying this patch yourself?
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 |
|
Back to top |
|
|
rentorbuy at yahoo.com Guest
|
Posted: Tue Apr 29, 2008 1:47 pm Post subject: [asterisk-users] realtime queue callers |
|
|
--- Atis Lezdins <atis at iq-labs.net> wrote:
Quote: | So, I suppose if
MySQL dies in
middle of operation, SELECT should fail and Asterisk
should just
continue with what it has in memory. Btw, You should
be able to also
use static or dynamic queue members (not realtime)
in combination with
realtime queue calls.
|
That's what I would like to do: use dynamic queue
members but rely on mysql for monitoring active queue
calls.
Quote: | Btw, I never experienced that MySQL dies, it's more
often that Asterisk dies.
|
I agree. But I did have a strange case at one point.
Would like to reduce point of failures anyway, as much
as possible.
Quote: | So, are You interested in applying this patch
yourself?
|
I just wrote a simple AMI script which parses the
output of "show queues" and sends relevant data to my
custom application via sockets. The only problem is
that I need to periodically run the script (cron) so
it's rather "inefficient". Maybe I could trigger the
script on particular Manager events (such as "run the
script which parses 'show queues' only when I receive
Agent* events).
I don't want you to make the effort of finding that
patch (as it seems you don't have it at hand now) if I
may not "need it". However, I think that your patch
should hit SVN and I wouldn't mind testing it.
Thanks,
Vieri
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ |
|
Back to top |
|
|
atis at iq-labs.net Guest
|
Posted: Wed Apr 30, 2008 6:35 am Post subject: [asterisk-users] realtime queue callers |
|
|
On Tue, Apr 29, 2008 at 9:47 PM, Vieri <rentorbuy at yahoo.com> wrote:
Quote: | That's what I would like to do: use dynamic queue
members but rely on mysql for monitoring active queue
calls.
Quote: | Btw, I never experienced that MySQL dies, it's more
often that Asterisk dies.
|
I agree. But I did have a strange case at one point.
Would like to reduce point of failures anyway, as much
as possible.
|
Ok, so in this case failed INSERT or DELETE should affect Asterisk in no way.
Quote: | Quote: | So, are You interested in applying this patch
yourself?
|
I just wrote a simple AMI script which parses the
output of "show queues" and sends relevant data to my
custom application via sockets. The only problem is
that I need to periodically run the script (cron) so
it's rather "inefficient". Maybe I could trigger the
script on particular Manager events (such as "run the
script which parses 'show queues' only when I receive
Agent* events).
|
Well, the problem with "show queues" is that it sometimes might lock,
and if you have many clients needing the same information,
you have to write some kind of proxy, and cache everything, so that
there's only one request to Asterisk in specific period.
For MySQL you can use all that without worry, plus you get actual data
(that was why I wrote all this realtime status stuff).
Quote: | I don't want you to make the effort of finding that
patch (as it seems you don't have it at hand now) if I
may not "need it". However, I think that your patch
should hit SVN and I wouldn't mind testing it.
|
Ok, after a thought, this part is quite simple - just few lines, so
I'll post it right away. I'll leave more complex realtime
agent/channel updates for later.
So, the issue is http://bugs.digium.com/view.php?id=12556, feel free
to comment about usage.
I also posted backport to 1.4.19 at
http://ftp.iq-labs.net/realtime_queue_callers-1.4/ but for this You
will need to also apply backport for realtime store/destroy - also
available at http://ftp.iq-labs.net/realtime_store_destroy-1.4/
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 |
|
Back to top |
|
|
rentorbuy at yahoo.com Guest
|
Posted: Thu May 01, 2008 4:53 am Post subject: [asterisk-users] realtime queue callers |
|
|
--- Atis Lezdins <atis at iq-labs.net> wrote:
Thank you for your contribution.
I've posted a comment at
http://bugs.digium.com/view.php?id=12556 and I invite
other users with this particular feature request to
post there too.
If you solved the problem with another technique then
please let us know.
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|