[svn-commits] russell: branch russell/chan_refcount r108140 - in /team/russell/chan_refcoun...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Mar 12 15:09:46 CDT 2008
Author: russell
Date: Wed Mar 12 15:09:46 2008
New Revision: 108140
URL: http://svn.digium.com/view/asterisk?view=rev&rev=108140
Log:
resolve, reset
Added:
team/russell/chan_refcount/configs/dbsep.conf.sample
- copied unchanged from r108137, trunk/configs/dbsep.conf.sample
team/russell/chan_refcount/contrib/scripts/dbsep.cgi
- copied unchanged from r108137, trunk/contrib/scripts/dbsep.cgi
team/russell/chan_refcount/funcs/func_config.c
- copied unchanged from r108137, trunk/funcs/func_config.c
Modified:
team/russell/chan_refcount/ (props changed)
team/russell/chan_refcount/CHANGES
team/russell/chan_refcount/Makefile
team/russell/chan_refcount/Makefile.rules
team/russell/chan_refcount/apps/app_chanspy.c
team/russell/chan_refcount/apps/app_dial.c
team/russell/chan_refcount/apps/app_dumpchan.c
team/russell/chan_refcount/apps/app_followme.c
team/russell/chan_refcount/apps/app_meetme.c
team/russell/chan_refcount/apps/app_mixmonitor.c
team/russell/chan_refcount/apps/app_page.c
team/russell/chan_refcount/apps/app_queue.c
team/russell/chan_refcount/apps/app_rpt.c
team/russell/chan_refcount/apps/app_sms.c
team/russell/chan_refcount/apps/app_speech_utils.c
team/russell/chan_refcount/apps/app_voicemail.c
team/russell/chan_refcount/apps/app_zapras.c
team/russell/chan_refcount/cdr/cdr_odbc.c
team/russell/chan_refcount/cdr/cdr_pgsql.c
team/russell/chan_refcount/channels/Makefile
team/russell/chan_refcount/channels/chan_alsa.c
team/russell/chan_refcount/channels/chan_console.c
team/russell/chan_refcount/channels/chan_gtalk.c
team/russell/chan_refcount/channels/chan_h323.c
team/russell/chan_refcount/channels/chan_iax2.c
team/russell/chan_refcount/channels/chan_jingle.c
team/russell/chan_refcount/channels/chan_mgcp.c
team/russell/chan_refcount/channels/chan_misdn.c
team/russell/chan_refcount/channels/chan_oss.c
team/russell/chan_refcount/channels/chan_phone.c
team/russell/chan_refcount/channels/chan_sip.c
team/russell/chan_refcount/channels/chan_skinny.c
team/russell/chan_refcount/channels/chan_unistim.c
team/russell/chan_refcount/channels/chan_vpb.cc
team/russell/chan_refcount/channels/chan_zap.c
team/russell/chan_refcount/channels/misdn/isdn_lib.c
team/russell/chan_refcount/codecs/Makefile
team/russell/chan_refcount/codecs/codec_g722.c
team/russell/chan_refcount/configure
team/russell/chan_refcount/configure.ac
team/russell/chan_refcount/contrib/scripts/iax-friends.sql
team/russell/chan_refcount/contrib/scripts/sip-friends.sql
team/russell/chan_refcount/doc/manager_1_1.txt
team/russell/chan_refcount/doc/smdi.txt
team/russell/chan_refcount/doc/tex/realtime.tex
team/russell/chan_refcount/doc/voicemail_odbc_postgresql.txt
team/russell/chan_refcount/formats/format_pcm.c
team/russell/chan_refcount/funcs/func_enum.c
team/russell/chan_refcount/funcs/func_odbc.c
team/russell/chan_refcount/funcs/func_strings.c
team/russell/chan_refcount/include/asterisk/audiohook.h
team/russell/chan_refcount/include/asterisk/autoconfig.h.in
team/russell/chan_refcount/include/asterisk/cdr.h
team/russell/chan_refcount/include/asterisk/config.h
team/russell/chan_refcount/include/asterisk/frame.h
team/russell/chan_refcount/include/asterisk/pbx.h
team/russell/chan_refcount/include/asterisk/pval.h
team/russell/chan_refcount/include/asterisk/sched.h
team/russell/chan_refcount/main/Makefile
team/russell/chan_refcount/main/asterisk.c
team/russell/chan_refcount/main/audiohook.c
team/russell/chan_refcount/main/cdr.c
team/russell/chan_refcount/main/channel.c
team/russell/chan_refcount/main/config.c
team/russell/chan_refcount/main/dial.c
team/russell/chan_refcount/main/editline/Makefile.in
team/russell/chan_refcount/main/editline/readline.c
team/russell/chan_refcount/main/features.c
team/russell/chan_refcount/main/file.c
team/russell/chan_refcount/main/frame.c
team/russell/chan_refcount/main/loader.c
team/russell/chan_refcount/main/manager.c
team/russell/chan_refcount/main/pbx.c
team/russell/chan_refcount/main/rtp.c
team/russell/chan_refcount/main/udptl.c
team/russell/chan_refcount/makeopts.in
team/russell/chan_refcount/pbx/pbx_ael.c
team/russell/chan_refcount/pbx/pbx_config.c
team/russell/chan_refcount/res/Makefile
team/russell/chan_refcount/res/ael/ael.flex
team/russell/chan_refcount/res/ael/ael.tab.c
team/russell/chan_refcount/res/ael/ael.tab.h
team/russell/chan_refcount/res/ael/ael.y
team/russell/chan_refcount/res/ael/ael_lex.c
team/russell/chan_refcount/res/ael/pval.c
team/russell/chan_refcount/res/res_agi.c
team/russell/chan_refcount/res/res_config_curl.c
team/russell/chan_refcount/res/res_config_ldap.c
team/russell/chan_refcount/res/res_config_odbc.c
team/russell/chan_refcount/res/res_config_pgsql.c
team/russell/chan_refcount/res/res_config_sqlite.c
team/russell/chan_refcount/sounds/Makefile
team/russell/chan_refcount/sounds/sounds.xml
team/russell/chan_refcount/utils/Makefile
team/russell/chan_refcount/utils/ael_main.c
team/russell/chan_refcount/utils/conf2ael.c
team/russell/chan_refcount/utils/extconf.c
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
automerge = *
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
--- svn:externals (original)
+++ svn:externals Wed Mar 12 15:09:46 2008
@@ -1,1 +1,1 @@
-menuselect https://origsvn.digium.com/svn/menuselect/branches/1.0
+menuselect https://origsvn.digium.com/svn/menuselect/trunk
Propchange: team/russell/chan_refcount/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Mar 12 15:09:46 2008
@@ -1,1 +1,1 @@
-/trunk:1-104106,104108-106163
+/trunk:1-104106,104108-108138
Modified: team/russell/chan_refcount/CHANGES
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/CHANGES?view=diff&rev=108140&r1=108139&r2=108140
==============================================================================
--- team/russell/chan_refcount/CHANGES (original)
+++ team/russell/chan_refcount/CHANGES Wed Mar 12 15:09:46 2008
@@ -2,7 +2,10 @@
--- Functionality changes from Asterisk 1.6.0 to Asterisk 1.6.1 -------------
------------------------------------------------------------------------------
-
+Dialplan Functions
+------------------
+ * Added a new dialplan function, AST_CONFIG(), which allows you to access
+ variables from an Asterisk configuration file.
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 1.4.X to Asterisk 1.6.0 -------------
@@ -57,6 +60,8 @@
* Originate now requires the Originate privilege and, if you want to call out
to a subshell, it requires the System privilege, as well. This was done to
enhance manager security.
+ * New command: Atxfer. See doc/manager_1_1.txt for more details or
+ manager show command Atxfer from the CLI
Dialplan functions
------------------
Modified: team/russell/chan_refcount/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/Makefile?view=diff&rev=108140&r1=108139&r2=108140
==============================================================================
--- team/russell/chan_refcount/Makefile (original)
+++ team/russell/chan_refcount/Makefile Wed Mar 12 15:09:46 2008
@@ -811,22 +811,38 @@
menuconfig: menuselect
+cmenuconfig: cmenuselect
+
gmenuconfig: gmenuselect
+
+nmenuconfig: nmenuselect
menuselect: menuselect/menuselect menuselect-tree
- at menuselect/menuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+cmenuselect: menuselect/cmenuselect menuselect-tree
+ - at menuselect/cmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+
gmenuselect: menuselect/gmenuselect menuselect-tree
- at menuselect/gmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+nmenuselect: menuselect/nmenuselect menuselect-tree
+ - at menuselect/nmenuselect $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS) menuselect.makeopts && (echo "menuselect changes saved!"; rm -f channels/h323/Makefile.ast main/asterisk) || echo "menuselect changes NOT saved!"
+
# options for make in menuselect/
MAKE_MENUSELECT=CC="$(HOST_CC)" CXX="$(CXX)" LD="" AR="" RANLIB="" CFLAGS="" $(MAKE) -C menuselect CONFIGURE_SILENT="--silent"
menuselect/menuselect: menuselect/makeopts
$(MAKE_MENUSELECT)
+menuselect/cmenuselect: menuselect/makeopts
+ $(MAKE_MENUSELECT) cmenuselect
+
menuselect/gmenuselect: menuselect/makeopts
$(MAKE_MENUSELECT) gmenuselect
+
+menuselect/nmenuselect: menuselect/makeopts
+ $(MAKE_MENUSELECT) nmenuselect
menuselect/makeopts:
$(MAKE_MENUSELECT) makeopts
Modified: team/russell/chan_refcount/Makefile.rules
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/Makefile.rules?view=diff&rev=108140&r1=108139&r2=108140
==============================================================================
--- team/russell/chan_refcount/Makefile.rules (original)
+++ team/russell/chan_refcount/Makefile.rules Wed Mar 12 15:09:46 2008
@@ -61,7 +61,7 @@
%.oo: %.cc
$(ECHO_PREFIX) echo " [CXX] $< -> $@"
- $(CMD_PREFIX) $(CXX) -o $@ -c $< $(PTHREAD_CFLAGS) $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations,$(ASTCFLAGS)) $(MAKE_DEPS)
+ $(CMD_PREFIX) $(CXX) -o $@ -c $< $(PTHREAD_CFLAGS) $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(AST_DECLARATION_AFTER_STATEMENT),$(ASTCFLAGS)) $(MAKE_DEPS)
%.c: %.y
$(ECHO_PREFIX) echo " [BISON] $< -> $@"
Modified: team/russell/chan_refcount/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_chanspy.c?view=diff&rev=108140&r1=108139&r2=108140
==============================================================================
--- team/russell/chan_refcount/apps/app_chanspy.c (original)
+++ team/russell/chan_refcount/apps/app_chanspy.c Wed Mar 12 15:09:46 2008
@@ -2,7 +2,7 @@
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2005 Anthony Minessale II (anthmct at yahoo.com)
- * Copyright (C) 2005 - 2006, Digium, Inc.
+ * Copyright (C) 2005 - 2008, Digium, Inc.
*
* A license has been granted to Digium (via disclaimer) for the use of
* this code.
@@ -23,6 +23,8 @@
* \brief ChanSpy: Listen in on any channel.
*
* \author Anthony Minessale II <anthmct at yahoo.com>
+ * \author Joshua Colp <jcolp at digium.com>
+ * \author Russell Bryant <russell at digium.com>
*
* \ingroup applications
*/
@@ -547,7 +549,7 @@
continue;
strcpy(peer_name, "spy-");
- strncat(peer_name, peer->name, AST_NAME_STRLEN);
+ strncat(peer_name, peer->name, AST_NAME_STRLEN - 4 - 1);
ptr = strchr(peer_name, '/');
*ptr++ = '\0';
Modified: team/russell/chan_refcount/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_dial.c?view=diff&rev=108140&r1=108139&r2=108140
==============================================================================
--- team/russell/chan_refcount/apps/app_dial.c (original)
+++ team/russell/chan_refcount/apps/app_dial.c Wed Mar 12 15:09:46 2008
@@ -717,6 +717,10 @@
ast_verb(3, "%s requested a video update, passing it to %s\n", c->name, in->name);
ast_indicate(in, AST_CONTROL_VIDUPDATE);
break;
+ case AST_CONTROL_SRCUPDATE:
+ ast_verb(3, "%s requested a source update, passing it to %s\n", c->name, in->name);
+ ast_indicate(in, AST_CONTROL_SRCUPDATE);
+ break;
case AST_CONTROL_PROCEEDING:
ast_verb(3, "%s is proceeding passing it to %s\n", c->name, in->name);
if (single && CAN_EARLY_BRIDGE(peerflags))
@@ -747,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);
@@ -820,7 +826,8 @@
if (single && (f->frametype == AST_FRAME_CONTROL) &&
((f->subclass == AST_CONTROL_HOLD) ||
(f->subclass == AST_CONTROL_UNHOLD) ||
- (f->subclass == AST_CONTROL_VIDUPDATE))) {
+ (f->subclass == AST_CONTROL_VIDUPDATE) ||
+ (f->subclass == AST_CONTROL_SRCUPDATE))) {
ast_verb(3, "%s requested special control %d, passing it to %s\n", in->name, f->subclass, outgoing->chan->name);
ast_indicate_data(outgoing->chan, f->subclass, f->data, f->datalen);
}
@@ -830,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
@@ -2091,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/russell/chan_refcount/apps/app_dumpchan.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_dumpchan.c?view=diff&rev=108140&r1=108139&r2=108140
==============================================================================
--- team/russell/chan_refcount/apps/app_dumpchan.c (original)
+++ team/russell/chan_refcount/apps/app_dumpchan.c Wed Mar 12 15:09:46 2008
@@ -141,8 +141,8 @@
pbx_builtin_serialize_variables(chan, &vars);
serialize_showchan(chan, info, sizeof(info));
- if (level > 0)
- ast_verb(level, "\nDumping Info For Channel: %s:\n%s\nInfo:\n%s\nVariables:\n%s%s\n", chan->name, line, info, vars->str, line);
+ if (option_verbose >= level)
+ ast_verbose("\nDumping Info For Channel: %s:\n%s\nInfo:\n%s\nVariables:\n%s%s\n", chan->name, line, info, vars->str, line);
return 0;
}
Modified: team/russell/chan_refcount/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_followme.c?view=diff&rev=108140&r1=108139&r2=108140
==============================================================================
--- team/russell/chan_refcount/apps/app_followme.c (original)
+++ team/russell/chan_refcount/apps/app_followme.c Wed Mar 12 15:09:46 2008
@@ -656,6 +656,9 @@
case AST_CONTROL_VIDUPDATE:
ast_verb(3, "%s requested a video update, passing it to %s\n", winner->name, caller->name);
break;
+ case AST_CONTROL_SRCUPDATE:
+ ast_verb(3, "%s requested a source update, passing it to %s\n", winner->name, caller->name);
+ break;
case AST_CONTROL_PROCEEDING:
ast_verb(3, "%s is proceeding passing it to %s\n", winner->name,caller->name);
break;
Modified: team/russell/chan_refcount/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_meetme.c?view=diff&rev=108140&r1=108139&r2=108140
==============================================================================
--- team/russell/chan_refcount/apps/app_meetme.c (original)
+++ team/russell/chan_refcount/apps/app_meetme.c Wed Mar 12 15:09:46 2008
@@ -1876,7 +1876,7 @@
}
}
- if (confflags & CONFFLAG_WAITMARKED)
+ if (confflags & CONFFLAG_WAITMARKED && !conf->markedusers)
ztc.confmode = ZT_CONF_CONF;
else if (confflags & CONFFLAG_MONITOR)
ztc.confmode = ZT_CONF_CONFMON | ZT_CONF_LISTENER;
@@ -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/russell/chan_refcount/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_mixmonitor.c?view=diff&rev=108140&r1=108139&r2=108140
==============================================================================
--- team/russell/chan_refcount/apps/app_mixmonitor.c (original)
+++ team/russell/chan_refcount/apps/app_mixmonitor.c Wed Mar 12 15:09:46 2008
@@ -258,7 +258,7 @@
return;
}
- ast_set_flag(&mixmonitor->audiohook, AST_AUDIOHOOK_TRIGGER_WRITE);
+ ast_set_flag(&mixmonitor->audiohook, AST_AUDIOHOOK_TRIGGER_SYNC);
if (readvol)
mixmonitor->audiohook.options.read_volume = readvol;
Modified: team/russell/chan_refcount/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_page.c?view=diff&rev=108140&r1=108139&r2=108140
==============================================================================
--- team/russell/chan_refcount/apps/app_page.c (original)
+++ team/russell/chan_refcount/apps/app_page.c Wed Mar 12 15:09:46 2008
@@ -124,9 +124,14 @@
}
/* Ensure device is not in use if skip option is enabled */
- if (ast_test_flag(&flags, PAGE_SKIP) && (state = ast_device_state(tech)) != AST_DEVICE_NOT_INUSE) {
- ast_log(LOG_WARNING, "Destination '%s' has device state '%s'.\n", tech, devstate2str(state));
- continue;
+ if (ast_test_flag(&flags, PAGE_SKIP)) {
+ state = ast_device_state(tech);
+ if (state == AST_DEVICE_UNKNOWN) {
+ ast_log(LOG_WARNING, "Destination '%s' has device state '%s'. Paging anyway.\n", tech, devstate2str(state));
+ } else if (state != AST_DEVICE_NOT_INUSE) {
+ ast_log(LOG_WARNING, "Destination '%s' has device state '%s'.\n", tech, devstate2str(state));
+ continue;
+ }
}
*resource++ = '\0';
Modified: team/russell/chan_refcount/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/chan_refcount/apps/app_queue.c?view=diff&rev=108140&r1=108139&r2=108140
==============================================================================
--- team/russell/chan_refcount/apps/app_queue.c (original)
+++ team/russell/chan_refcount/apps/app_queue.c Wed Mar 12 15:09:46 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.
+*/
static int get_member_penalty(char *queuename, char *interface)
{
int foundqueue = 0, penalty;
@@ -3927,7 +4019,7 @@
return RESULT_FAILURE;
}
-/* Reload dynamic queue members persisted into the astdb */
+/*! \brief Reload dynamic queue members persisted into the astdb */
static void reload_queue_members(void)
{
char *cur_ptr;
@@ -4024,6 +4116,7 @@
}
}
+/*! \brief PauseQueueMember application */
static int pqm_exec(struct ast_channel *chan, void *data)
{
char *parse;
@@ -4035,7 +4128,7 @@
);
if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "PauseQueueMember requires an argument ([queuename]|interface[|options][|reason])\n");
[... 8703 lines stripped ...]
More information about the svn-commits
mailing list