[asterisk-commits] murf: branch murf/bug11210 r107585 - in /team/murf/bug11210: ./ apps/ cdr/ ch...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 11 12:54:25 CDT 2008
Author: murf
Date: Tue Mar 11 12:54:24 2008
New Revision: 107585
URL: http://svn.digium.com/view/asterisk?view=rev&rev=107585
Log:
Merged revisions 106757,106789,106843,106892,106896,106946,107017,107019,107068,107100,107103,107157,107159,107162,107177,107231,107292,107373,107406,107409,107462,107465-107466,107475,107525,107530,107551 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r106757 | murf | 2008-03-07 11:57:57 -0700 (Fri, 07 Mar 2008) | 126 lines
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
................
r106789 | file | 2008-03-07 12:33:09 -0700 (Fri, 07 Mar 2008) | 12 lines
Merged revisions 106788 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r106788 | file | 2008-03-07 15:32:00 -0400 (Fri, 07 Mar 2008) | 4 lines
Ignore source update control frame.
(closes issue #12168)
Reported by: plack
........
................
r106843 | qwell | 2008-03-07 15:15:20 -0700 (Fri, 07 Mar 2008) | 13 lines
Merged revisions 106842 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r106842 | qwell | 2008-03-07 16:14:45 -0600 (Fri, 07 Mar 2008) | 5 lines
Fix hardcoded grep in editline, were GNU grep is required.
(closes issue #12124)
Reported by: dmartin
........
................
r106892 | mattf | 2008-03-07 15:36:49 -0700 (Fri, 07 Mar 2008) | 1 line
Make sure we don't start a call when we have already done so in response to a COT message
................
r106896 | russell | 2008-03-07 15:52:46 -0700 (Fri, 07 Mar 2008) | 10 lines
Merged revisions 106895 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r106895 | russell | 2008-03-07 16:51:23 -0600 (Fri, 07 Mar 2008) | 2 lines
Only start the SLA thread if SLA has actually been configured.
........
................
r106946 | kpfleming | 2008-03-08 09:03:48 -0700 (Sat, 08 Mar 2008) | 10 lines
Merged revisions 106945 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r106945 | kpfleming | 2008-03-08 09:59:42 -0600 (Sat, 08 Mar 2008) | 2 lines
don't generate D-Channel "up" and "down" messages unless the channel state is actually changing; also, generate the "up" message when an implicit "up" occurs due to reception of a normal event when we thought the channel was "down"
........
................
r107017 | file | 2008-03-10 08:36:16 -0600 (Mon, 10 Mar 2008) | 15 lines
Merged revisions 107016 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r107016 | file | 2008-03-10 11:33:02 -0300 (Mon, 10 Mar 2008) | 7 lines
Move where unanswered CDRs are dropped to the CDR core, not everything uses app_dial.
(closes issue #11516)
Reported by: ys
Patches:
branch_1.4_cdr.diff uploaded by ys (license 281)
Tested by: anest, jcapp, dartvader
........
................
r107019 | murf | 2008-03-10 08:55:21 -0600 (Mon, 10 Mar 2008) | 1 line
way back in July, in r.75706, a fix was made ot the strftime usages, which was good, but in this case, the check for a nil time was accidentally removed, and now it is restored, to keep timevals like '1969-12-31 17:00:00' from showing up in the cdrs. No idea what databases will do with this. No bugs filed as yet, but it felt like a bug.
................
r107068 | mmichelson | 2008-03-10 09:45:13 -0600 (Mon, 10 Mar 2008) | 10 lines
app_queue has now been doxygenified thanks to snuffy! The ony thing I changed
was the way that locks are referenced, since the old 1.2 names were still used
in the comments.
(closes issue #11997)
Reported by: snuffy
Patches:
bug_11997_queue_doxy.diff uploaded by snuffy (license 35)
................
r107100 | russell | 2008-03-10 10:59:13 -0600 (Mon, 10 Mar 2008) | 11 lines
Merged revisions 107099 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r107099 | russell | 2008-03-10 11:58:57 -0500 (Mon, 10 Mar 2008) | 3 lines
Fix a race condition where the generator can go away
(closes issue #12175, reported by edantie, patched by me)
........
................
r107103 | russell | 2008-03-10 11:13:34 -0600 (Mon, 10 Mar 2008) | 10 lines
Merged revisions 107102 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r107102 | russell | 2008-03-10 12:13:17 -0500 (Mon, 10 Mar 2008) | 2 lines
Resolve a compiler warning.
........
................
r107157 | file | 2008-03-10 14:00:21 -0600 (Mon, 10 Mar 2008) | 4 lines
If we receive a 488 on a T38 request reinvite back to audio. As well reinvite across a bridge back to audio if one side doesn't negotiate to T38.
(closes issue #8677)
Reported by: alex-911
................
r107159 | russell | 2008-03-10 14:05:12 -0600 (Mon, 10 Mar 2008) | 17 lines
Merged revisions 107158 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r107158 | russell | 2008-03-10 15:04:27 -0500 (Mon, 10 Mar 2008) | 9 lines
Fix some bugs related to originating calls. If the code failed to start a PBX
on the channel (such as if you set a call limit based on the system's load
average), then there were cases where a channel that has already been free'd
using ast_hangup() got accessed. This caused weird memory corruption and
crashes to occur.
(fixes issue BE-386)
(much debugging credit goes to twilson, final patch written by me)
........
................
r107162 | russell | 2008-03-10 14:17:37 -0600 (Mon, 10 Mar 2008) | 16 lines
Merged revisions 107161 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r107161 | russell | 2008-03-10 15:17:11 -0500 (Mon, 10 Mar 2008) | 8 lines
Fix another bug specifically related to asynchronous call origination. Once the
PBX is started on the channel using ast_pbx_start(), then the ownership of the
channel has been passed on to another thread. We can no longer access it in this
code. If the channel gets hung up very quickly, it is possible that we could
access a channel that has been free'd.
(inspired by BE-386)
........
................
r107177 | qwell | 2008-03-10 14:28:33 -0600 (Mon, 10 Mar 2008) | 13 lines
Merged revisions 107173 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r107173 | qwell | 2008-03-10 15:27:08 -0500 (Mon, 10 Mar 2008) | 5 lines
Make sure to reenable echo can after a "failed" (canceled, etc) three-way call.
(closes issue #11335)
Reported by: rebuild
........
................
r107231 | tilghman | 2008-03-10 15:48:20 -0600 (Mon, 10 Mar 2008) | 6 lines
(closes issue #6019)
Reported by: ssokol
Patches:
20080304__bug6019.diff.txt uploaded by Corydon76 (license 14)
Tested by: putnopvut
................
r107292 | twilson | 2008-03-10 19:09:46 -0600 (Mon, 10 Mar 2008) | 10 lines
Merged revisions 107290 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r107290 | twilson | 2008-03-10 19:59:18 -0500 (Mon, 10 Mar 2008) | 2 lines
If we fail to alloc a channel, we should re-lock the pvt structure before returning.
........
................
r107373 | kpfleming | 2008-03-11 05:36:51 -0600 (Tue, 11 Mar 2008) | 19 lines
Merged revisions 107352 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r107352 | kpfleming | 2008-03-11 06:04:29 -0500 (Tue, 11 Mar 2008) | 11 lines
fix up various compiler warnings found with gcc-4.3:
- the output of flex includes a static function called 'input' that is not used, so for the moment we'll stop having the compiler tell us about unused variables in the flex source files (a better fix would be to improve our flex post-processing to remove the unused function)
- main/stdtime/localtime.c makes assumptions about signed integer overflow, and gcc-4.3's improved optimizer tries to take advantage of handling potential overflow conditions at compile time; for now, suppress these optimizations until we can fiure out if the code needs improvement
- main/udptl.c has some references to uninitialized variables; in one case there was no bug, but in the other it was certainly possibly for unexpected behavior to occur
- main/editline/readline.c had an unused variable
........
................
r107406 | kpfleming | 2008-03-11 07:58:37 -0600 (Tue, 11 Mar 2008) | 10 lines
Merged revisions 107405 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r107405 | kpfleming | 2008-03-11 08:57:08 -0500 (Tue, 11 Mar 2008) | 2 lines
fix small bug in IMAP toolkit testing
........
................
r107409 | kpfleming | 2008-03-11 08:09:49 -0600 (Tue, 11 Mar 2008) | 13 lines
Merged revisions 107408 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r107408 | kpfleming | 2008-03-11 09:07:59 -0500 (Tue, 11 Mar 2008) | 5 lines
check for compiler support for -fno-strict-overflow before using it (tested with Debian's gcc 4.3, 4.1 and 3.4)
(closes issue #12179)
Reported by: Netview
........
................
r107462 | kpfleming | 2008-03-11 08:37:03 -0600 (Tue, 11 Mar 2008) | 10 lines
Merged revisions 107461 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r107461 | kpfleming | 2008-03-11 09:33:45 -0500 (Tue, 11 Mar 2008) | 2 lines
stop checking for mktime() in the configure script... we don't use it, and the test is buggy under gcc 4.3
........
................
r107465 | file | 2008-03-11 09:05:17 -0600 (Tue, 11 Mar 2008) | 4 lines
Clarify comment about masquerading and playback of the parking slot.
(closes issue #12180)
Reported by: davidw
................
r107466 | kpfleming | 2008-03-11 09:13:38 -0600 (Tue, 11 Mar 2008) | 10 lines
Merged revisions 107464 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r107464 | kpfleming | 2008-03-11 09:53:03 -0500 (Tue, 11 Mar 2008) | 2 lines
fix various other problems found by gcc 4.3
........
................
r107475 | kpfleming | 2008-03-11 09:19:05 -0600 (Tue, 11 Mar 2008) | 2 lines
block fix that is already here
................
r107525 | kpfleming | 2008-03-11 09:39:37 -0600 (Tue, 11 Mar 2008) | 2 lines
fix another potential bug found by gcc 4.3
................
r107530 | mmichelson | 2008-03-11 09:59:32 -0600 (Tue, 11 Mar 2008) | 7 lines
Remove some redundant logic from wait_for_answer. This also let's us get rid of one of
those XXX comments from the code.
The redundancy occurs because the 'single' flag implies that the 'r' and 'm' flags are
not set, so there's no need to explicitly check them again.
................
r107551 | tilghman | 2008-03-11 10:28:03 -0600 (Tue, 11 Mar 2008) | 2 lines
Whitespace changes only
................
Modified:
team/murf/bug11210/ (props changed)
team/murf/bug11210/apps/app_dial.c
team/murf/bug11210/apps/app_meetme.c
team/murf/bug11210/apps/app_queue.c
team/murf/bug11210/apps/app_rpt.c
team/murf/bug11210/apps/app_sms.c
team/murf/bug11210/cdr/cdr_pgsql.c
team/murf/bug11210/channels/chan_iax2.c
team/murf/bug11210/channels/chan_sip.c
team/murf/bug11210/channels/chan_skinny.c
team/murf/bug11210/channels/chan_vpb.cc
team/murf/bug11210/channels/chan_zap.c
team/murf/bug11210/channels/misdn/isdn_lib.c
team/murf/bug11210/codecs/Makefile
team/murf/bug11210/configure
team/murf/bug11210/configure.ac
team/murf/bug11210/include/asterisk/autoconfig.h.in
team/murf/bug11210/include/asterisk/cdr.h
team/murf/bug11210/include/asterisk/pbx.h
team/murf/bug11210/include/asterisk/pval.h
team/murf/bug11210/main/Makefile
team/murf/bug11210/main/cdr.c
team/murf/bug11210/main/channel.c
team/murf/bug11210/main/editline/Makefile.in
team/murf/bug11210/main/editline/readline.c
team/murf/bug11210/main/features.c
team/murf/bug11210/main/pbx.c
team/murf/bug11210/main/udptl.c
team/murf/bug11210/makeopts.in
team/murf/bug11210/pbx/pbx_ael.c
team/murf/bug11210/pbx/pbx_config.c
team/murf/bug11210/res/Makefile
team/murf/bug11210/res/ael/ael.flex
team/murf/bug11210/res/ael/ael.tab.c
team/murf/bug11210/res/ael/ael.tab.h
team/murf/bug11210/res/ael/ael.y
team/murf/bug11210/res/ael/ael_lex.c
team/murf/bug11210/res/ael/pval.c
team/murf/bug11210/utils/Makefile
team/murf/bug11210/utils/ael_main.c
team/murf/bug11210/utils/conf2ael.c
team/murf/bug11210/utils/extconf.c
Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
automerge = yes
Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/murf/bug11210/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Mar 11 12:54:24 2008
@@ -1,1 +1,1 @@
-/trunk:1-106728
+/trunk:1-107581
Modified: team/murf/bug11210/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/apps/app_dial.c?view=diff&rev=107585&r1=107584&r2=107585
==============================================================================
--- team/murf/bug11210/apps/app_dial.c (original)
+++ team/murf/bug11210/apps/app_dial.c Tue Mar 11 12:54:24 2008
@@ -751,19 +751,21 @@
ast_debug(1, "Dunno what to do with control type %d\n", f->subclass);
}
} else if (single) {
- /* XXX are we sure the logic is correct ? or we should just switch on f->frametype ? */
- if (f->frametype == AST_FRAME_VOICE && !ast_test_flag64(outgoing, OPT_RINGBACK|OPT_MUSICBACK)) {
- if (ast_write(in, f))
- ast_log(LOG_WARNING, "Unable to forward voice frame\n");
- } else if (f->frametype == AST_FRAME_IMAGE && !ast_test_flag64(outgoing, OPT_RINGBACK|OPT_MUSICBACK)) {
- if (ast_write(in, f))
- ast_log(LOG_WARNING, "Unable to forward image\n");
- } else if (f->frametype == AST_FRAME_TEXT && !ast_test_flag64(outgoing, OPT_RINGBACK|OPT_MUSICBACK)) {
- if (ast_write(in, f))
- ast_log(LOG_WARNING, "Unable to send text\n");
- } else if (f->frametype == AST_FRAME_HTML && !ast_test_flag64(outgoing, DIAL_NOFORWARDHTML)) {
- if (ast_channel_sendhtml(in, f->subclass, f->data, f->datalen) == -1)
- ast_log(LOG_WARNING, "Unable to send URL\n");
+ switch (f->frametype) {
+ case AST_FRAME_VOICE:
+ case AST_FRAME_IMAGE:
+ case AST_FRAME_TEXT:
+ if (ast_write(in, f)) {
+ ast_log(LOG_WARNING, "Unable to write frame\n");
+ }
+ break;
+ case AST_FRAME_HTML:
+ if (!ast_test_flag64(outgoing, DIAL_NOFORWARDHTML) && ast_channel_sendhtml(in, f->subclass, f->data, f->datalen) == -1) {
+ ast_log(LOG_WARNING, "Unable to send URL\n");
+ }
+ break;
+ default:
+ break;
}
}
ast_frfree(f);
@@ -835,23 +837,6 @@
ast_verb(3, "Nobody picked up in %d ms\n", orig);
if (!*to || ast_check_hangup(in))
ast_cdr_noanswer(in->cdr);
- }
- if (peer && !ast_cdr_log_unanswered()) {
- /* suppress the CDR's that didn't win */
- struct chanlist *o;
- for (o = outgoing; o; o = o->next) {
- struct ast_channel *c = o->chan;
- if (c && c != peer && c->cdr)
- ast_set_flag(c->cdr, AST_CDR_FLAG_POST_DISABLED);
- }
- } else if (!peer && !ast_cdr_log_unanswered()) {
- /* suppress the CDR's that didn't win */
- struct chanlist *o;
- for (o = outgoing; o; o = o->next) {
- struct ast_channel *c = o->chan;
- if (c && c->cdr)
- ast_set_flag(c->cdr, AST_CDR_FLAG_POST_DISABLED);
- }
}
#ifdef HAVE_EPOLL
@@ -2096,9 +2081,7 @@
int res;
struct ast_context *con;
- con = ast_context_find("app_dial_gosub_virtual_context");
- if (!con)
- con = ast_context_create(NULL, "app_dial_gosub_virtual_context", "app_dial");
+ con = ast_context_find_or_create(NULL, NULL, "app_dial_gosub_virtual_context", "app_dial");
if (!con)
ast_log(LOG_ERROR, "Dial virtual context 'app_dial_gosub_virtual_context' does not exist and unable to create\n");
else
Modified: team/murf/bug11210/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/apps/app_meetme.c?view=diff&rev=107585&r1=107584&r2=107585
==============================================================================
--- team/murf/bug11210/apps/app_meetme.c (original)
+++ team/murf/bug11210/apps/app_meetme.c Tue Mar 11 12:54:24 2008
@@ -5280,7 +5280,7 @@
if (!ast_strlen_zero(trunk->autocontext)) {
struct ast_context *context;
- context = ast_context_find_or_create(NULL, trunk->autocontext, sla_registrar);
+ context = ast_context_find_or_create(NULL, NULL, trunk->autocontext, sla_registrar);
if (!context) {
ast_log(LOG_ERROR, "Failed to automatically find or create "
"context '%s' for SLA!\n", trunk->autocontext);
@@ -5417,7 +5417,7 @@
if (!ast_strlen_zero(station->autocontext)) {
struct ast_context *context;
struct sla_trunk_ref *trunk_ref;
- context = ast_context_find_or_create(NULL, station->autocontext, sla_registrar);
+ context = ast_context_find_or_create(NULL, NULL, station->autocontext, sla_registrar);
if (!context) {
ast_log(LOG_ERROR, "Failed to automatically find or create "
"context '%s' for SLA!\n", station->autocontext);
@@ -5510,7 +5510,7 @@
ast_config_destroy(cfg);
- if (!reload)
+ if (!reload && (!AST_LIST_EMPTY(&sla_stations) || !AST_LIST_EMPTY(&sla_stations)))
ast_pthread_create(&sla.thread, NULL, sla_thread, NULL);
return res;
Modified: team/murf/bug11210/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/apps/app_queue.c?view=diff&rev=107585&r1=107584&r2=107585
==============================================================================
--- team/murf/bug11210/apps/app_queue.c (original)
+++ team/murf/bug11210/apps/app_queue.c Tue Mar 11 12:54:24 2008
@@ -93,7 +93,8 @@
#include "asterisk/strings.h"
#include "asterisk/global_datastores.h"
-/* Please read before modifying this file.
+/*!
+ * \par Please read before modifying this file.
* There are three locks which are regularly used
* throughout this file, the queue list lock, the lock
* for each individual queue, and the interface list lock.
@@ -132,17 +133,17 @@
#define DEFAULT_RETRY 5
#define DEFAULT_TIMEOUT 15
-#define RECHECK 1 /* Recheck every second to see we we're at the top yet */
-#define MAX_PERIODIC_ANNOUNCEMENTS 10 /* The maximum periodic announcements we can have */
-#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15 /* The minimum number of seconds between position announcements
- The default value of 15 provides backwards compatibility */
+#define RECHECK 1 /*!< Recheck every second to see we we're at the top yet */
+#define MAX_PERIODIC_ANNOUNCEMENTS 10 /*!< The maximum periodic announcements we can have */
+#define DEFAULT_MIN_ANNOUNCE_FREQUENCY 15 /*!< The minimum number of seconds between position announcements
+ The default value of 15 provides backwards compatibility */
#define MAX_QUEUE_BUCKETS 53
-#define RES_OKAY 0 /* Action completed */
-#define RES_EXISTS (-1) /* Entry already exists */
-#define RES_OUTOFMEMORY (-2) /* Out of memory */
-#define RES_NOSUCHQUEUE (-3) /* No such queue */
-#define RES_NOT_DYNAMIC (-4) /* Member is not dynamic */
+#define RES_OKAY 0 /*!< Action completed */
+#define RES_EXISTS (-1) /*!< Entry already exists */
+#define RES_OUTOFMEMORY (-2) /*!< Out of memory */
+#define RES_NOSUCHQUEUE (-3) /*!< No such queue */
+#define RES_NOT_DYNAMIC (-4) /*!< Member is not dynamic */
static char *app = "Queue";
@@ -313,15 +314,16 @@
};
/*! \brief We define a custom "local user" structure because we
- use it not only for keeping track of what is in use but
- also for keeping track of who we're dialing.
-
- There are two "links" defined in this structure, q_next and call_next.
- q_next links ALL defined callattempt structures into a linked list. call_next is
- a link which allows for a subset of the callattempts to be traversed. This subset
- is used in wait_for_answer so that irrelevant callattempts are not traversed. This
- also is helpful so that queue logs are always accurate in the case where a call to
- a member times out, especially if using the ringall strategy. */
+ * use it not only for keeping track of what is in use but
+ * also for keeping track of who we're dialing.
+ *
+ * There are two "links" defined in this structure, q_next and call_next.
+ * q_next links ALL defined callattempt structures into a linked list. call_next is
+ * a link which allows for a subset of the callattempts to be traversed. This subset
+ * is used in wait_for_answer so that irrelevant callattempts are not traversed. This
+ * also is helpful so that queue logs are always accurate in the case where a call to
+ * a member times out, especially if using the ringall strategy.
+*/
struct callattempt {
struct callattempt *q_next;
@@ -343,7 +345,7 @@
char announce[80]; /*!< Announcement to play for member when call is answered */
char context[AST_MAX_CONTEXT]; /*!< Context when user exits queue */
char digits[AST_MAX_EXTENSION]; /*!< Digits entered while in queue */
- int valid_digits; /*!< Digits entered correspond to valid extension. Exited */
+ int valid_digits; /*!< Digits entered correspond to valid extension. Exited */
int pos; /*!< Where we are in the queue */
int prio; /*!< Our priority */
int last_pos_said; /*!< Last position we told the user */
@@ -355,8 +357,8 @@
int pending; /*!< Non-zero if we are attempting to call a member */
int max_penalty; /*!< Limit the members that can take this call to this penalty or lower */
int min_penalty; /*!< Limit the members that can take this call to this penalty or higher */
- int linpos; /*!< If using linear strategy, what position are we at? */
- int linwrapped; /*!< Is the linpos wrapped? */
+ int linpos; /*!< If using linear strategy, what position are we at? */
+ int linwrapped; /*!< Is the linpos wrapped? */
time_t start; /*!< When we started holding */
time_t expire; /*!< When this entry should expire (time out of queue) */
struct ast_channel *chan; /*!< Our channel */
@@ -572,6 +574,7 @@
return q;
}
+/*! \brief Set variables of queue */
static void set_queue_variables(struct queue_ent *qe)
{
char interfacevar[256]="";
@@ -665,7 +668,12 @@
int state;
char dev[0];
};
-/*! \brief set a member's status based on device state of that member's state_interface*/
+
+/*! \brief set a member's status based on device state of that member's state_interface.
+ *
+ * Lock interface list find sc, iterate through each queues queue_member list for member to
+ * update state inside queues
+*/
static void *handle_statechange(struct statechange *sc)
{
struct call_queue *q;
@@ -750,9 +758,7 @@
return NULL;
}
-/*!
- * \brief Data used by the device state thread
- */
+/*! \brief Data used by the device state thread */
static struct {
/*! Set to 1 to stop the thread */
unsigned int stop:1;
@@ -802,6 +808,7 @@
return NULL;
}
+
/*! \brief Producer of the statechange queue */
static int statechange_queue(const char *dev, enum ast_device_state state)
{
@@ -820,6 +827,7 @@
return 0;
}
+
static void device_state_cb(const struct ast_event *event, void *unused)
{
enum ast_device_state state;
@@ -890,6 +898,10 @@
return strcasecmp(mem1->interface, mem2->interface) ? 0 : CMP_MATCH;
}
+/*!
+ * \brief Initialize Queue default values.
+ * \note the queue's lock must be held before executing this function
+*/
static void init_queue(struct call_queue *q)
{
int i;
@@ -1048,7 +1060,15 @@
AST_LIST_UNLOCK(&interfaces);
}
-/*Note: call this with the rule_lists locked */
+/*!
+ * \brief Change queue penalty by adding rule.
+ *
+ * Check rule for errors with time or fomatting, see if rule is relative to rest
+ * of queue, iterate list of rules to find correct insertion point, insert and return.
+ * \retval -1 on failure
+ * \retval 0 on success
+ * \note Call this with the rule_lists locked
+*/
static int insert_penaltychange (const char *list_name, const char *content, const int linenum)
{
char *timestr, *maxstr, *minstr, *contentdup;
@@ -1121,12 +1141,13 @@
}
/*! \brief Configure a queue parameter.
-\par
- For error reporting, line number is passed for .conf static configuration.
- For Realtime queues, linenum is -1.
- The failunknown flag is set for config files (and static realtime) to show
- errors for unknown parameters. It is cleared for dynamic realtime to allow
- extra fields in the tables. */
+ *
+ * The failunknown flag is set for config files (and static realtime) to show
+ * errors for unknown parameters. It is cleared for dynamic realtime to allow
+ * extra fields in the tables.
+ * \note For error reporting, line number is passed for .conf static configuration,
+ * for Realtime queues, linenum is -1.
+*/
static void queue_set_param(struct call_queue *q, const char *param, const char *val, int linenum, int failunknown)
{
if (!strcasecmp(param, "musicclass") ||
@@ -1293,6 +1314,12 @@
}
}
+/*!
+ * \brief Find rt member record to update otherwise create one.
+ *
+ * Search for member in queue, if found update penalty/paused state,
+ * if no memeber exists create one flag it as a RT member and add to queue member list.
+*/
static void rt_handle_member_record(struct call_queue *q, char *interface, const char *membername, const char *penalty_str, const char *paused_str, const char* state_interface)
{
struct member *m, tmpmem;
@@ -1340,6 +1367,7 @@
}
}
+/*! \brief Iterate through queue's member list and delete them */
static void free_members(struct call_queue *q, int all)
{
/* Free non-dynamic members */
@@ -1356,6 +1384,7 @@
}
}
+/*! \brief Free queue's member list then its string fields */
static void destroy_queue(void *obj)
{
struct call_queue *q = obj;
@@ -1386,9 +1415,16 @@
return q;
}
-/*!\brief Reload a single queue via realtime.
- \return Return the queue, or NULL if it doesn't exist.
- \note Should be called with the global qlock locked. */
+/*!
+ * \brief Reload a single queue via realtime.
+ *
+ * Check for statically defined queue first, check if deleted RT queue,
+ * check for new RT queue, if queue vars are not defined init them with defaults.
+ * reload RT queue vars, set RT queue members dead and reload them, return finished queue.
+ * \retval the queue,
+ * \retval NULL if it doesn't exist.
+ * \note Should be called with the "queues" container locked.
+*/
static struct call_queue *find_queue_by_name_rt(const char *queuename, struct ast_variable *queue_vars, struct ast_config *member_config)
{
struct ast_variable *v;
@@ -1529,7 +1565,7 @@
q = ao2_find(queues, &tmpq, OBJ_POINTER);
if (!q || q->realtime) {
- /*! \note Load from realtime before taking the global qlock, to avoid blocking all
+ /*! \note Load from realtime before taking the "queues" container lock, to avoid blocking all
queue operations while waiting for the DB.
This will be two separate database transactions, so we might
@@ -1707,6 +1743,11 @@
return res;
}
+/*!
+ * \brief Check for valid exit from queue via goto
+ * \retval 0 if failure
+ * \retval 1 if successful
+*/
static int valid_exit(struct queue_ent *qe, char digit)
{
int digitlen = strlen(qe->digits);
@@ -1866,7 +1907,11 @@
ao2_unlock(qe->parent);
}
-
+/*! \brief Caller leaving queue.
+ *
+ * Search the queue to find the leaving client, if found remove from queue
+ * create manager event, move others up the queue.
+*/
static void leave_queue(struct queue_ent *qe)
{
struct call_queue *q;
@@ -1921,7 +1966,7 @@
queue_unref(q);
}
-/* Hang up a list of outgoing calls */
+/*! \brief Hang up a list of outgoing calls */
static void hangupcalls(struct callattempt *outgoing, struct ast_channel *exception)
{
struct callattempt *oo;
@@ -1987,8 +2032,11 @@
return update_status(q, member, status);
}
-/* traverse all defined queues which have calls waiting and contain this member
- return 0 if no other queue has precedence (higher weight) or 1 if found */
+/*!
+ * \brief traverse all defined queues which have calls waiting and contain this member
+ * \retval 0 if no other queue has precedence (higher weight)
+ * \retval 1 if found
+*/
static int compare_weight(struct call_queue *rq, struct member *member)
{
struct call_queue *q;
@@ -1996,7 +2044,7 @@
int found = 0;
struct ao2_iterator queue_iter;
- /* &qlock and &rq->lock already set by try_calling()
+ /* q's lock and rq's lock already set by try_calling()
* to solve deadlock */
queue_iter = ao2_iterator_init(queues, 0);
while ((q = ao2_iterator_next(&queue_iter))) {
@@ -2033,6 +2081,7 @@
o->chan = NULL;
}
+/*! \brief convert "\n" to "\nVariable: " ready for manager to use */
static char *vars2manager(struct ast_channel *chan, char *vars, size_t len)
{
struct ast_str *buf = ast_str_alloca(len + 1);
@@ -2070,10 +2119,19 @@
return vars;
}
-/*! \brief Part 2 of ring_one
+/*!
+ * \brief Part 2 of ring_one
*
- * Does error checking before attempting to request a channel and call a member. This
- * function is only called from ring_one
+ * Does error checking before attempting to request a channel and call a member.
+ * This function is only called from ring_one().
+ * Failure can occur if:
+ * - Agent on call
+ * - Agent is paused
+ * - Wrapup time not expired
+ * - Priority by another queue
+ *
+ * \retval 1 on success to reach a free agent
+ * \retval 0 on failure to get agent.
*/
static int ring_entry(struct queue_ent *qe, struct callattempt *tmp, int *busies)
{
@@ -2223,13 +2281,15 @@
return best;
}
-/*! \brief Place a call to a queue member
+/*!
+ * \brief Place a call to a queue member.
*
* Once metrics have been calculated for each member, this function is used
* to place a call to the appropriate member (or members). The low-level
* channel-handling and error detection is handled in ring_entry
*
- * Returns 1 if a member was called successfully, 0 otherwise
+ * \retval 1 if a member was called successfully
+ * \retval 0 otherwise
*/
static int ring_one(struct queue_ent *qe, struct callattempt *outgoing, int *busies)
{
@@ -2260,6 +2320,7 @@
return ret;
}
+/*! \brief Search for best metric and add to Round Robbin queue */
static int store_next_rr(struct queue_ent *qe, struct callattempt *outgoing)
{
struct callattempt *best = find_best(outgoing);
@@ -2283,6 +2344,7 @@
return 0;
}
+/*! \brief Search for best metric and add to Linear queue */
static int store_next_lin(struct queue_ent *qe, struct callattempt *outgoing)
{
struct callattempt *best = find_best(outgoing);
@@ -2306,6 +2368,7 @@
return 0;
}
+/*! \brief Playback announcement to queued members if peroid has elapsed */
static int say_periodic_announcement(struct queue_ent *qe, int ringing)
{
int res = 0;
@@ -2356,6 +2419,7 @@
return res;
}
+/*! \brief Record that a caller gave up on waiting in queue */
static void record_abandoned(struct queue_ent *qe)
{
ao2_lock(qe->parent);
@@ -2644,7 +2708,9 @@
return peer;
}
-/*! \brief Check if we should start attempting to call queue members
+
+/*!
+ * \brief Check if we should start attempting to call queue members.
*
* The behavior of this function is dependent first on whether autofill is enabled
* and second on whether the ring strategy is ringall. If autofill is not enabled,
@@ -2722,6 +2788,13 @@
return res;
}
+
+/*!
+ * \brief update rules for queues
+ *
+ * Calculate min/max penalties making sure if relative they stay within bounds.
+ * Update queues penalty and set dialplan vars, goto next list entry.
+*/
static void update_qe_rule(struct queue_ent *qe)
{
int max_penalty = qe->pr->max_relative ? qe->max_penalty + qe->pr->max_value : qe->pr->max_value;
@@ -2822,6 +2895,10 @@
return res;
}
+/*!
+ * \brief update the queue status
+ * \retval Always 0
+*/
static int update_queue(struct call_queue *q, struct member *member, int callcompletedinsl)
{
struct member *mem;
@@ -2861,6 +2938,8 @@
* A numeric metric is given to each member depending on the ring strategy used
* by the queue. Members with lower metrics will be called before members with
* higher metrics
+ * \retval -1 if penalties are exceeded
+ * \retval 0 otherwise
*/
static int calc_metric(struct call_queue *q, struct member *mem, int pos, struct queue_ent *qe, struct callattempt *tmp)
{
@@ -2925,6 +3004,7 @@
TRANSFER
};
+/*! \brief Send out AMI message with member call completion status information */
static void send_agent_complete(const struct queue_ent *qe, const char *queuename,
const struct ast_channel *peer, const struct member *member, time_t callstart,
char *vars, size_t vars_len, enum agent_complete_reason rsn)
@@ -2960,6 +3040,7 @@
(long)(callstart - qe->start), (long)(time(NULL) - callstart), reason,
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, vars_len) : "");
}
+
/*! \brief A large function which calls members, updates statistics, and bridges the caller and a member
*
* Here is the process of this function
@@ -3648,10 +3729,9 @@
}
-/* Dump all members in a specific queue to the database
+/*! \brief Dump all members in a specific queue to the database
*
* <pm_family>/<queuename> = <interface>;<penalty>;<paused>[|...]
- *
*/
static void dump_queue_members(struct call_queue *pm_queue)
{
@@ -3693,6 +3773,12 @@
ast_db_del(pm_family, pm_queue->name);
}
+/*! \brief Remove member from queue
+ * \retval RES_NOT_DYNAMIC when they aren't a RT member
+ * \retval RES_NOSUCHQUEUE queue does not exist
+ * \retval RES_OKAY removed member from queue
+ * \retval RES_EXISTS queue exists but no members
+*/
static int remove_from_queue(const char *queuename, const char *interface)
{
struct call_queue *q, tmpq = {
@@ -3735,14 +3821,20 @@
return res;
}
-
+/*! \brief Add member to queue
+ * \retval RES_NOT_DYNAMIC when they aren't a RT member
+ * \retval RES_NOSUCHQUEUE queue does not exist
+ * \retval RES_OKAY added member from queue
+ * \retval RES_EXISTS queue exists but no members
+ * \retval RES_OUT_OF_MEMORY queue exists but not enough memory to create member
+*/
static int add_to_queue(const char *queuename, const char *interface, const char *membername, int penalty, int paused, int dump, const char *state_interface)
{
struct call_queue *q;
struct member *new_member, *old_member;
int res = RES_NOSUCHQUEUE;
- /* \note Ensure the appropriate realtime queue is loaded. Note that this
+ /*! \note Ensure the appropriate realtime queue is loaded. Note that this
* short-circuits if the queue is already in memory. */
if (!(q = load_realtime_queue(queuename)))
return res;
@@ -3895,8 +3987,8 @@
}
/* \brief Gets members penalty.
- *
- * \return Return the members penalty or RESULT_FAILURE on error. */
+ * \return Return the members penalty or RESULT_FAILURE on error.
+*/
[... 6299 lines stripped ...]
More information about the asterisk-commits
mailing list