[asterisk-commits] branch russell/autoconf_and_menuselect - r8086 in
/team/russell/autoconf_and_...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun Jan 15 18:17:45 MST 2006
Author: russell
Date: Sun Jan 15 19:17:33 2006
New Revision: 8086
URL: http://svn.digium.com/view/asterisk?rev=8086&view=rev
Log:
Merged revisions 8019-8024,8030,8034,8037-8038,8042,8044-8045,8048-8051,8056-8060,8063-8066,8068-8073,8075-8076,8078-8080 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r8019 | russell | 2006-01-12 13:35:03 -0500 (Thu, 12 Jan 2006) | 2 lines
fix breakage from new feature committed in r7995
........
r8020 | bweschke | 2006-01-12 14:01:35 -0500 (Thu, 12 Jan 2006) | 3 lines
Remove an unneccessary unlock and do away with the error msg about not being able to unlock the lock. #6201
........
r8021 | mogorman | 2006-01-12 14:07:18 -0500 (Thu, 12 Jan 2006) | 4 lines
Added option for limiting a user from logging in
as multiple agents at same time. bug 6046 thanks
ppyy
........
r8022 | mogorman | 2006-01-12 14:09:36 -0500 (Thu, 12 Jan 2006) | 2 lines
Minor revisions from bug 6090
........
r8023 | mogorman | 2006-01-12 14:15:20 -0500 (Thu, 12 Jan 2006) | 2 lines
Oops... need to keep my trunk folder clean...
........
r8024 | mogorman | 2006-01-12 14:28:47 -0500 (Thu, 12 Jan 2006) | 3 lines
More cosmetic changes. thanks qwell and everyone
else.
........
r8030 | mogorman | 2006-01-12 14:45:38 -0500 (Thu, 12 Jan 2006) | 3 lines
some error checking added into g and a option
if there is no parens.
........
r8034 | mogorman | 2006-01-12 15:04:52 -0500 (Thu, 12 Jan 2006) | 3 lines
I will never touch VM again...
thanks qwell for spotting mistakes.
........
r8037 | tilghman | 2006-01-12 16:12:25 -0500 (Thu, 12 Jan 2006) | 2 lines
Fix typos that caused voicemail not to compile.
........
r8038 | tilghman | 2006-01-12 16:18:46 -0500 (Thu, 12 Jan 2006) | 2 lines
Bug 6223 - Remove unnecessary header that caused FreeBSD not to compile
........
r8042 | mogorman | 2006-01-12 21:34:10 -0500 (Thu, 12 Jan 2006) | 3 lines
forgot to take out createlink sample along with
other part.
........
r8044 | bweschke | 2006-01-12 22:25:23 -0500 (Thu, 12 Jan 2006) | 3 lines
More memory wrapper and cleanup work. #6226 w/one very minor compile fix mod in app_rpt.c
........
r8045 | bweschke | 2006-01-12 22:34:31 -0500 (Thu, 12 Jan 2006) | 3 lines
More memory wrapper cleanup. #6224
........
r8048 | russell | 2006-01-13 01:11:41 -0500 (Fri, 13 Jan 2006) | 2 lines
fix spelling errors (issue #6227)
........
r8049 | mogorman | 2006-01-13 01:43:27 -0500 (Fri, 13 Jan 2006) | 2 lines
added some minor changes from bug 6046 thanks ppyy
........
r8050 | mogorman | 2006-01-13 01:49:23 -0500 (Fri, 13 Jan 2006) | 2 lines
adding more output for shutdown. as per 6102
........
r8051 | tilghman | 2006-01-13 02:14:42 -0500 (Fri, 13 Jan 2006) | 2 lines
Somebody complained the that length of the dah wasn't quite up to spec...
........
r8056 | bweschke | 2006-01-13 11:01:40 -0500 (Fri, 13 Jan 2006) | 3 lines
Range should be inclusive, not exclusive, of the end of the range.
........
r8057 | mogorman | 2006-01-13 12:02:15 -0500 (Fri, 13 Jan 2006) | 5 lines
allow app_directed_pickup to try to pickup
multiple channels at the same time. however it
does not work in cases where dial was called
with multiple devices. bug 5694.
........
r8058 | bweschke | 2006-01-13 12:28:22 -0500 (Fri, 13 Jan 2006) | 3 lines
Address the condition where X-ClientCode could be NULL or an empty string - from a -dev posting.
........
r8059 | bweschke | 2006-01-13 12:35:12 -0500 (Fri, 13 Jan 2006) | 3 lines
Another patch against this code (the right one now) to deal with cyclic ranges. #6230
........
r8060 | mogorman | 2006-01-13 12:39:56 -0500 (Fri, 13 Jan 2006) | 3 lines
added two new features to meetme, autofill and
autopause. thanks twisted from 5577
........
r8063 | bweschke | 2006-01-13 13:23:30 -0500 (Fri, 13 Jan 2006) | 3 lines
Implement the autologoffunavail option in chan_agent (#6038 with some minor mods)
........
r8064 | mogorman | 2006-01-13 13:30:49 -0500 (Fri, 13 Jan 2006) | 3 lines
Made chan_agent code parsing more robust and
implemented new macro code. from 6228.
........
r8065 | russell | 2006-01-13 13:38:55 -0500 (Fri, 13 Jan 2006) | 9 lines
Various cleanups from comments in an email from Luigi Rizzo. Thank you!
- Use a cleaner syntax for declaring the allocation macros
- Fix return value for ast_strdup/ast_strndup
- remove safe_strdup from app_macro, since ast_strup does the same thing
- fix a place in app_queue where ast_calloc+strncpy was used instead of
ast_strdup. If you are helping out with these conversions, please watch out
for other places where this is done.
- add a note to the coding guidelines about the fix to app_queue
........
r8066 | mogorman | 2006-01-13 14:09:05 -0500 (Fri, 13 Jan 2006) | 2 lines
Added forward context option from 5497
........
r8068 | mogorman | 2006-01-13 17:05:46 -0500 (Fri, 13 Jan 2006) | 4 lines
make voicemail files group writable and uses a
nicer function for creating dirs as described in
5929
........
r8069 | mogorman | 2006-01-13 17:59:19 -0500 (Fri, 13 Jan 2006) | 3 lines
Added QUEUE_MEMBER_COUNT and QUEUE_MEMBER_LIST
from bug 5451
........
r8070 | mogorman | 2006-01-13 19:32:30 -0500 (Fri, 13 Jan 2006) | 4 lines
added feature for pausing and unpausing the
monitor app from manager and in the call through
features.conf bug 5395 for the patch
........
r8071 | bweschke | 2006-01-13 22:25:38 -0500 (Fri, 13 Jan 2006) | 3 lines
Code cleanup spawned from an earlier commit today r8063. Standardize manager event responses and queue_log behavior on callbacklogoff.
........
r8072 | mattf | 2006-01-14 11:18:03 -0500 (Sat, 14 Jan 2006) | 2 lines
Add mission options to agents.conf sample file (#6234)
........
r8073 | mattf | 2006-01-14 13:53:10 -0500 (Sat, 14 Jan 2006) | 2 lines
Small documentation update for new AST_FRAME_MODEM type
........
r8075 | tilghman | 2006-01-14 14:08:03 -0500 (Sat, 14 Jan 2006) | 3 lines
Merged revisions 8074 via svnmerge from
/branches/1.2
........
r8076 | tilghman | 2006-01-14 14:30:37 -0500 (Sat, 14 Jan 2006) | 2 lines
Bug 6238 - Janitor - update to app_args macros
........
r8078 | tilghman | 2006-01-15 00:50:19 -0500 (Sun, 15 Jan 2006) | 2 lines
Prepare for removal of DBGet/DBPut manager commands, by allowing Getvar to get functions (Setvar can already set functions)
........
r8079 | tilghman | 2006-01-15 13:02:46 -0500 (Sun, 15 Jan 2006) | 2 lines
Allow application arguments to be quoted, allowing '|' characters inside arguments
........
r8080 | tilghman | 2006-01-15 13:08:04 -0500 (Sun, 15 Jan 2006) | 2 lines
Clarify description of ARRAY function
........
Modified:
team/russell/autoconf_and_menuselect/ (props changed)
team/russell/autoconf_and_menuselect/app.c
team/russell/autoconf_and_menuselect/apps/app_dial.c
team/russell/autoconf_and_menuselect/apps/app_directed_pickup.c
team/russell/autoconf_and_menuselect/apps/app_festival.c
team/russell/autoconf_and_menuselect/apps/app_macro.c
team/russell/autoconf_and_menuselect/apps/app_meetme.c
team/russell/autoconf_and_menuselect/apps/app_milliwatt.c
team/russell/autoconf_and_menuselect/apps/app_mixmonitor.c
team/russell/autoconf_and_menuselect/apps/app_morsecode.c
team/russell/autoconf_and_menuselect/apps/app_page.c
team/russell/autoconf_and_menuselect/apps/app_parkandannounce.c
team/russell/autoconf_and_menuselect/apps/app_queue.c
team/russell/autoconf_and_menuselect/apps/app_rpt.c
team/russell/autoconf_and_menuselect/apps/app_voicemail.c
team/russell/autoconf_and_menuselect/asterisk.c
team/russell/autoconf_and_menuselect/channel.c
team/russell/autoconf_and_menuselect/channels/chan_agent.c
team/russell/autoconf_and_menuselect/channels/chan_local.c
team/russell/autoconf_and_menuselect/channels/chan_sip.c
team/russell/autoconf_and_menuselect/configs/agents.conf.sample
team/russell/autoconf_and_menuselect/configs/features.conf.sample
team/russell/autoconf_and_menuselect/configs/queues.conf.sample
team/russell/autoconf_and_menuselect/doc/CODING-GUIDELINES
team/russell/autoconf_and_menuselect/doc/README.variables
team/russell/autoconf_and_menuselect/doc/manager.txt
team/russell/autoconf_and_menuselect/doc/queuelog.txt
team/russell/autoconf_and_menuselect/funcs/func_strings.c
team/russell/autoconf_and_menuselect/include/asterisk/app.h
team/russell/autoconf_and_menuselect/include/asterisk/frame.h
team/russell/autoconf_and_menuselect/include/asterisk/monitor.h
team/russell/autoconf_and_menuselect/include/asterisk/utils.h
team/russell/autoconf_and_menuselect/manager.c
team/russell/autoconf_and_menuselect/pbx.c
team/russell/autoconf_and_menuselect/res/res_monitor.c
team/russell/autoconf_and_menuselect/udptl.c
Propchange: team/russell/autoconf_and_menuselect/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sun Jan 15 19:17:33 2006
@@ -1,1 +1,1 @@
-/trunk:1-8018
+/trunk:1-8085
Modified: team/russell/autoconf_and_menuselect/app.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/app.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/app.c (original)
+++ team/russell/autoconf_and_menuselect/app.c Sun Jan 15 19:17:33 2006
@@ -1109,7 +1109,7 @@
{
int argc;
char *scan;
- int paren = 0;
+ int paren = 0, quote = 0;
if (!buf || !array || !arraylen)
return 0;
@@ -1126,7 +1126,15 @@
else if (*scan == ')') {
if (paren)
paren--;
- } else if ((*scan == delim) && !paren) {
+ } else if (*scan == '"') {
+ quote = quote ? 0 : 1;
+ /* Remove quote character from argument */
+ memmove(scan, scan + 1, strlen(scan));
+ scan--;
+ } else if (*scan == '\\') {
+ /* Literal character, don't parse */
+ memmove(scan, scan + 1, strlen(scan));
+ } else if ((*scan == delim) && !paren && !quote) {
*scan++ = '\0';
break;
}
Modified: team/russell/autoconf_and_menuselect/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_dial.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_dial.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_dial.c Sun Jan 15 19:17:33 2006
@@ -449,13 +449,15 @@
char tmpchan[256];
char *stuff;
char *tech;
+ char *forward_context;
ast_copy_string(tmpchan, o->chan->call_forward, sizeof(tmpchan));
if ((stuff = strchr(tmpchan, '/'))) {
*stuff = '\0';
stuff++;
tech = tmpchan;
} else {
- snprintf(tmpchan, sizeof(tmpchan), "%s@%s", o->chan->call_forward, o->chan->context);
+ forward_context = pbx_builtin_getvar_helper(o->chan, "FORWARD_CONTEXT");
+ snprintf(tmpchan, sizeof(tmpchan), "%s@%s", o->chan->call_forward, forward_context ? forward_context : o->chan->context);
stuff = tmpchan;
tech = "Local";
}
Modified: team/russell/autoconf_and_menuselect/apps/app_directed_pickup.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_directed_pickup.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_directed_pickup.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_directed_pickup.c Sun Jan 15 19:17:33 2006
@@ -46,7 +46,7 @@
static const char *app = "Pickup";
static const char *synopsis = "Directed Call Pickup";
static const char *descrip =
-" Pickup(extension[@context]): This application can pickup any ringing channel\n"
+" Pickup(extension[@context][&extension2 at context...]): This application can pickup any ringing channel\n"
"that is calling the specified extension. If no context is specified, the current\n"
"context will be used.\n";
@@ -59,7 +59,7 @@
int res = 0;
struct localuser *u = NULL;
struct ast_channel *origin = NULL, *target = NULL;
- char *tmp = NULL, *exten = NULL, *context = NULL;
+ char *tmp = NULL, *exten = NULL, *context = NULL, *rest=data;
char workspace[256] = "";
if (ast_strlen_zero(data)) {
@@ -69,64 +69,65 @@
LOCAL_USER_ADD(u);
- /* Get the extension and context if present */
- exten = data;
- context = strchr(data, '@');
- if (context) {
- *context = '\0';
- context++;
- }
+ while (!target && (exten = rest) ) {
+ res = 0;
+ rest = strchr(exten, '&');
+ if (rest)
+ *rest++ = 0;
- /* Find a channel to pickup */
- origin = ast_get_channel_by_exten_locked(exten, context);
- if (origin && origin->cdr) {
- ast_cdr_getvar(origin->cdr, "dstchannel", &tmp, workspace,
- sizeof(workspace), 0);
- if (tmp) {
- /* We have a possible channel... now we need to find it! */
- target = ast_get_channel_by_name_locked(tmp);
+ /* Get the extension and context if present */
+ context = strchr(exten, '@');
+ if (context)
+ *context++ = '\0';
+
+ /* Find a channel to pickup */
+ origin = ast_get_channel_by_exten_locked(exten, context);
+ if (origin) {
+ ast_cdr_getvar(origin->cdr, "dstchannel", &tmp, workspace,
+ sizeof(workspace), 0);
+ if (tmp) {
+ /* We have a possible channel... now we need to find it! */
+ target = ast_get_channel_by_name_locked(tmp);
+ } else {
+ ast_log(LOG_NOTICE, "No target channel found for %s.\n", exten);
+ res = -1;
+ }
+ ast_mutex_unlock(&origin->lock);
+
} else {
- ast_log(LOG_DEBUG, "No target channel found.\n");
+ ast_log(LOG_DEBUG, "No originating channel found.\n");
+ }
+
+ if (res)
+ continue;
+
+ if (target && (!target->pbx) && ((target->_state == AST_STATE_RINGING) || (target->_state == AST_STATE_RING) ) ) {
+ ast_log(LOG_DEBUG, "Call pickup on chan '%s' by '%s'\n", target->name,
+ chan->name);
+ res = ast_answer(chan);
+ if (res) {
+ ast_log(LOG_WARNING, "Unable to answer '%s'\n", chan->name);
+ res = -1;
+ break;
+ }
+ res = ast_queue_control(chan, AST_CONTROL_ANSWER);
+ if (res) {
+ ast_log(LOG_WARNING, "Unable to queue answer on '%s'\n",
+ chan->name);
+ res = -1;
+ break;
+ }
+ res = ast_channel_masquerade(target, chan);
+ if (res) {
+ ast_log(LOG_WARNING, "Unable to masquerade '%s' into '%s'\n", chan->name, target->name);
+ res = -1;
+ break;
+ }
+ } else {
+ ast_log(LOG_NOTICE, "No call pickup possible for %s...\n", exten);
res = -1;
}
- ast_mutex_unlock(&origin->lock);
- } else {
- if (origin)
- ast_mutex_unlock(&origin->lock);
- ast_log(LOG_DEBUG, "No originating channel found.\n");
}
-
- if (res)
- goto out;
-
- if (target && (!target->pbx) && ((target->_state == AST_STATE_RINGING) || (target->_state == AST_STATE_RING))) {
- ast_log(LOG_DEBUG, "Call pickup on chan '%s' by '%s'\n", target->name,
- chan->name);
- res = ast_answer(chan);
- if (res) {
- ast_log(LOG_WARNING, "Unable to answer '%s'\n", chan->name);
- res = -1;
- goto out;
- }
- res = ast_queue_control(chan, AST_CONTROL_ANSWER);
- if (res) {
- ast_log(LOG_WARNING, "Unable to queue answer on '%s'\n",
- chan->name);
- res = -1;
- goto out;
- }
- res = ast_channel_masquerade(target, chan);
- if (res) {
- ast_log(LOG_WARNING, "Unable to masquerade '%s' into '%s'\n", chan->name, target->name);
- res = -1;
- goto out;
- }
- } else {
- ast_log(LOG_DEBUG, "No call pickup possible...\n");
- res = -1;
- }
- /* Done */
- out:
if (target)
ast_mutex_unlock(&target->lock);
Modified: team/russell/autoconf_and_menuselect/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_festival.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_festival.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_festival.c Sun Jan 15 19:17:33 2006
@@ -86,7 +86,10 @@
char c;
bufflen = 1024;
- buff = (char *)malloc(bufflen);
+ if (!(buff = ast_malloc(bufflen)))
+ {
+ /* TODO: Handle memory allocation failure */
+ }
*size=0;
for (k=0; file_stuff_key[k] != '\0';)
@@ -96,7 +99,10 @@
if ((*size)+k+1 >= bufflen)
{ /* +1 so you can add a NULL if you want */
bufflen += bufflen/4;
- buff = (char *)realloc(buff,bufflen);
+ if (!(buff = ast_realloc(buff, bufflen)))
+ {
+ /* TODO: Handle memory allocation failure */
+ }
}
if (file_stuff_key[k] == c)
k++;
Modified: team/russell/autoconf_and_menuselect/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_macro.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_macro.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_macro.c Sun Jan 15 19:17:33 2006
@@ -88,11 +88,6 @@
STANDARD_LOCAL_USER;
LOCAL_USER_DECL;
-
-static char *safe_strdup(const char *s)
-{
- return s ? strdup(s) : NULL;
-}
static int macro_exec(struct ast_channel *chan, void *data)
{
@@ -169,17 +164,17 @@
}
argc = 1;
/* Save old macro variables */
- save_macro_exten = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_EXTEN"));
+ save_macro_exten = ast_strdup(pbx_builtin_getvar_helper(chan, "MACRO_EXTEN"));
pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", oldexten);
- save_macro_context = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"));
+ save_macro_context = ast_strdup(pbx_builtin_getvar_helper(chan, "MACRO_CONTEXT"));
pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", oldcontext);
- save_macro_priority = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_PRIORITY"));
+ save_macro_priority = ast_strdup(pbx_builtin_getvar_helper(chan, "MACRO_PRIORITY"));
snprintf(pc, sizeof(pc), "%d", oldpriority);
pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", pc);
- save_macro_offset = safe_strdup(pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"));
+ save_macro_offset = ast_strdup(pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"));
pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", NULL);
/* Setup environment for new run */
Modified: team/russell/autoconf_and_menuselect/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_meetme.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_meetme.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_meetme.c Sun Jan 15 19:17:33 2006
@@ -474,8 +474,7 @@
if (!cnf && (make || dynamic)) {
/* Make a new one */
- cnf = calloc(1, sizeof(*cnf));
- if (cnf) {
+ if ((cnf = ast_calloc(1, sizeof(*cnf)))) {
ast_mutex_init(&cnf->playlock);
ast_mutex_init(&cnf->listenlock);
ast_copy_string(cnf->confno, confno, sizeof(cnf->confno));
@@ -535,8 +534,7 @@
ast_verbose(VERBOSE_PREFIX_3 "Created MeetMe conference %d for conference '%s'\n", cnf->zapconf, cnf->confno);
cnf->next = confs;
confs = cnf;
- } else
- ast_log(LOG_WARNING, "Out of memory\n");
+ }
}
cnfout:
ast_mutex_unlock(&conflock);
@@ -851,7 +849,7 @@
static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int confflags)
{
- struct ast_conf_user *user = calloc(1, sizeof(*user));
+ struct ast_conf_user *user = NULL;
struct ast_conf_user *usr = NULL;
int fd;
struct zt_confinfo ztc, ztc_empty;
@@ -887,9 +885,8 @@
ZT_BUFFERINFO bi;
char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
char *buf = __buf + AST_FRIENDLY_OFFSET;
-
- if (!user) {
- ast_log(LOG_ERROR, "Out of memory\n");
+
+ if (!(user = ast_calloc(1, sizeof(*user)))) {
return ret;
}
Modified: team/russell/autoconf_and_menuselect/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_milliwatt.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_milliwatt.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_milliwatt.c Sun Jan 15 19:17:33 2006
@@ -41,6 +41,7 @@
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
+#include "asterisk/utils.h"
static char *tdesc = "Digital Milliwatt (mu-law) Test Application";
@@ -59,11 +60,7 @@
static void *milliwatt_alloc(struct ast_channel *chan, void *params)
{
-int *indexp;
- indexp = ast_malloc(sizeof(*indexp));
- if (indexp == NULL) return(NULL);
- *indexp = 0;
- return(indexp);
+ return ast_calloc(1, sizeof(int));
}
static void milliwatt_release(struct ast_channel *chan, void *data)
Modified: team/russell/autoconf_and_menuselect/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_mixmonitor.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_mixmonitor.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_mixmonitor.c Sun Jan 15 19:17:33 2006
@@ -53,6 +53,7 @@
#include "asterisk/options.h"
#include "asterisk/app.h"
#include "asterisk/linkedlists.h"
+#include "asterisk/utils.h"
#define get_volfactor(x) x ? ((x > 0) ? (1 << x) : ((1 << abs(x)) * -1)) : 0
@@ -292,8 +293,7 @@
if (!ast_strlen_zero(post_process))
len += strlen(post_process) + 1;
- if (!(mixmonitor = calloc(1, len))) {
- ast_log(LOG_ERROR, "Memory Error!\n");
+ if (!(mixmonitor = ast_calloc(1, len))) {
return;
}
Modified: team/russell/autoconf_and_menuselect/apps/app_morsecode.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_morsecode.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_morsecode.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_morsecode.c Sun Jan 15 19:17:33 2006
@@ -55,12 +55,8 @@
LOCAL_USER_DECL;
-#define TONE 440
-#define DITLEN 100
-#define DAHLEN 250
-#define DITDAHSEPLEN 50
-#define CHARSEPLEN 200
-/* Pause between words will be twice CHARSEPLEN plus DITDAHSEPLEN - 450 */
+#define TONE 800
+#define DITLEN 80
static char *morsecode[] = {
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /* 0-15 */
@@ -109,9 +105,9 @@
static void playtone(struct ast_channel *chan, int tone, int len)
{
char dtmf[20];
- snprintf(dtmf, sizeof(dtmf), "%d/%d", tone, len);
+ snprintf(dtmf, sizeof(dtmf), "%d/%d", tone, DITLEN * len);
ast_playtones_start(chan, 0, dtmf, 0);
- ast_safe_sleep(chan, len);
+ ast_safe_sleep(chan, DITLEN * len);
ast_playtones_stop(chan);
}
@@ -136,18 +132,19 @@
}
for (dahdit = morsecode[(int)*digit]; *dahdit; dahdit++) {
if (*dahdit == '-') {
- playtone(chan, TONE, DAHLEN);
+ playtone(chan, TONE, 3);
} else if (*dahdit == '.') {
- playtone(chan, TONE, DITLEN);
+ playtone(chan, TONE, 1);
} else {
- playtone(chan, TONE, CHARSEPLEN);
+ /* Account for ditlen of silence immediately following */
+ playtone(chan, 0, 2);
}
/* Pause slightly between each dit and dah */
- playtone(chan, 0, DITDAHSEPLEN);
+ playtone(chan, 0, 1);
}
/* Pause between characters */
- playtone(chan, 0, CHARSEPLEN);
+ playtone(chan, 0, 2);
}
LOCAL_USER_REMOVE(u);
Modified: team/russell/autoconf_and_menuselect/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_page.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_page.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_page.c Sun Jan 15 19:17:33 2006
@@ -43,7 +43,7 @@
#include "asterisk/file.h"
#include "asterisk/app.h"
#include "asterisk/chanvars.h"
-
+#include "asterisk/utils.h"
static const char *tdesc = "Page Multiple Phones";
@@ -100,8 +100,7 @@
struct ast_var_t *varptr;
pthread_t t;
pthread_attr_t attr;
- cd = ast_calloc(1, sizeof(*cd));
- if (cd) {
+ if ((cd = ast_calloc(1, sizeof(*cd)))) {
ast_copy_string(cd->cidnum, chan->cid.cid_num ? chan->cid.cid_num : "", sizeof(cd->cidnum));
ast_copy_string(cd->cidname, chan->cid.cid_name ? chan->cid.cid_name : "", sizeof(cd->cidname));
ast_copy_string(cd->tech, tech, sizeof(cd->tech));
Modified: team/russell/autoconf_and_menuselect/apps/app_parkandannounce.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_parkandannounce.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_parkandannounce.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_parkandannounce.c Sun Jan 15 19:17:33 2006
@@ -49,6 +49,7 @@
#include "asterisk/logger.h"
#include "asterisk/say.h"
#include "asterisk/lock.h"
+#include "asterisk/utils.h"
static char *tdesc = "Call Parking and Announce Application";
@@ -94,10 +95,8 @@
LOCAL_USER_ADD(u);
- l=strlen(data)+2;
- orig_s=malloc(l);
- if(!orig_s) {
- ast_log(LOG_WARNING, "Out of memory\n");
+ l=strlen(data)+2;
+ if (!(orig_s = ast_malloc(l))) {
LOCAL_USER_REMOVE(u);
return -1;
}
Modified: team/russell/autoconf_and_menuselect/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_queue.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_queue.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_queue.c Sun Jan 15 19:17:33 2006
@@ -317,18 +317,18 @@
char moh[80]; /*!< Music On Hold class to be used */
char announce[80]; /*!< Announcement to play when call is answered */
char context[AST_MAX_CONTEXT]; /*!< Exit context */
- unsigned int monjoin:1;
- unsigned int dead:1;
- unsigned int joinempty:2;
- unsigned int eventwhencalled:1;
- unsigned int leavewhenempty:2;
- unsigned int reportholdtime:1;
- unsigned int wrapped:1;
- unsigned int timeoutrestart:1;
- unsigned int announceholdtime:2;
- unsigned int strategy:3;
- unsigned int maskmemberstatus:1;
- unsigned int realtime:1;
+ unsigned int monjoin:1;
+ unsigned int dead:1;
+ unsigned int joinempty:2;
+ unsigned int eventwhencalled:1;
+ unsigned int leavewhenempty:2;
+ unsigned int reportholdtime:1;
+ unsigned int wrapped:1;
+ unsigned int timeoutrestart:1;
+ unsigned int announceholdtime:2;
+ unsigned int strategy:3;
+ unsigned int maskmemberstatus:1;
+ unsigned int realtime:1;
int announcefrequency; /*!< How often to announce their position */
int periodicannouncefrequency; /*!< How often to play periodic announcement */
int roundingseconds; /*!< How many seconds do we round to? */
@@ -356,11 +356,13 @@
int retry; /*!< Retry calling everyone after this amount of time */
int timeout; /*!< How long to wait for an answer */
int weight; /*!< Respective weight */
-
+ int autopause; /*!< Auto pause queue members if they fail to answer */
+
/* Queue strategy things */
int rrpos; /*!< Round Robin - position */
int memberdelay; /*!< Seconds to delay connecting member to caller */
-
+ int autofill; /*!< Ignore the head call status and ring an available agent */
+
struct member *members; /*!< Head of the list of members */
struct queue_ent *head; /*!< Head of the list of callers */
struct ast_call_queue *next; /*!< Next call queue */
@@ -368,6 +370,8 @@
static struct ast_call_queue *queues = NULL;
AST_MUTEX_DEFINE_STATIC(qlock);
+
+static int set_member_paused(char *queuename, char *interface, int paused);
static void set_queue_result(struct ast_channel *chan, enum queue_result res)
{
@@ -514,9 +518,8 @@
struct statechange *sc;
pthread_t t;
pthread_attr_t attr;
-
- sc = ast_calloc(1, sizeof(*sc) + strlen(dev) + 1);
- if (sc) {
+
+ if ((sc = ast_calloc(1, sizeof(*sc) + strlen(dev) + 1))) {
sc->state = state;
strcpy(sc->dev, dev);
pthread_attr_init(&attr);
@@ -535,9 +538,7 @@
/* Add a new member */
- cur = ast_calloc(1, sizeof(*cur));
-
- if (cur) {
+ if ((cur = ast_calloc(1, sizeof(*cur)))) {
cur->penalty = penalty;
cur->paused = paused;
ast_copy_string(cur->interface, interface, sizeof(cur->interface));
@@ -553,8 +554,7 @@
{
struct ast_call_queue *q;
- q = ast_calloc(1, sizeof(*q));
- if (q) {
+ if ((q = ast_calloc(1, sizeof(*q)))) {
ast_mutex_init(&q->lock);
ast_copy_string(q->name, queuename, sizeof(q->name));
}
@@ -670,6 +670,10 @@
q->retry = DEFAULT_RETRY;
} else if (!strcasecmp(param, "wrapuptime")) {
q->wrapuptime = atoi(val);
+ } else if (!strcasecmp(param, "autofill")) {
+ q->autofill = ast_true(val);
+ } else if (!strcasecmp(param, "autopause")) {
+ q->autopause = ast_true(val);
} else if (!strcasecmp(param, "maxlen")) {
q->maxlen = atoi(val);
if (q->maxlen < 0)
@@ -827,8 +831,7 @@
/* Create a new queue if an in-core entry does not exist yet. */
if (!q) {
- q = alloc_queue(queuename);
- if (!q)
+ if (!(q = alloc_queue(queuename)))
return NULL;
ast_mutex_lock(&q->lock);
clear_queue(q);
@@ -1323,7 +1326,6 @@
if (found)
break;
}
- ast_mutex_unlock(&qlock);
return found;
}
@@ -1613,6 +1615,7 @@
static struct localuser *wait_for_answer(struct queue_ent *qe, struct localuser *outgoing, int *to, char *digit, int prebusies, int caller_disconnect)
{
char *queue = qe->parent->name;
+ char on[256] = "";
struct localuser *o;
int found;
int numlines;
@@ -1656,6 +1659,7 @@
peer = o;
}
} else if (o->chan && (o->chan == winner)) {
+ ast_copy_string(on, o->member->interface, sizeof(on));
if (!ast_strlen_zero(o->chan->call_forward)) {
char tmpchan[256]="";
char *stuff;
@@ -1705,11 +1709,7 @@
if (in->cid.cid_ani) {
if (o->chan->cid.cid_ani)
free(o->chan->cid.cid_ani);
- o->chan->cid.cid_ani = ast_calloc(1, strlen(in->cid.cid_ani) + 1);
- if (o->chan->cid.cid_ani)
- strncpy(o->chan->cid.cid_ani, in->cid.cid_ani, strlen(in->cid.cid_ani) + 1);
- else
- ast_log(LOG_WARNING, "Out of memory\n");
+ o->chan->cid.cid_ani = ast_strdup(in->cid.cid_ani);
}
if (o->chan->cid.cid_rdnis)
free(o->chan->cid.cid_rdnis);
@@ -1834,8 +1834,19 @@
}
ast_frfree(f);
}
- if (!*to && (option_verbose > 2))
- ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", orig);
+ if (!*to) {
+ if (option_verbose > 2)
+ ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", orig);
+ if (qe->parent->autopause) {
+ if (!set_member_paused(qe->parent->name, on, 1)) {
+ if (option_verbose > 2)
+ ast_verbose( VERBOSE_PREFIX_3 "Auto-Pausing Queue Member %s in queue %s since they failed to answer.\n", on, qe->parent->name);
+ } else {
+ if (option_verbose > 2)
+ ast_verbose( VERBOSE_PREFIX_3 "Failed to pause Queue Member %s in queue %s!\n", on, qe->parent->name);
+ }
+ }
+ }
}
return peer;
@@ -1850,7 +1861,7 @@
/* Atomically read the parent head -- does not need a lock */
ch = qe->parent->head;
/* If we are now at the top of the head, break out */
- if (ch == qe) {
+ if ((ch == qe) || (qe->parent->autofill)) {
if (option_debug)
ast_log(LOG_DEBUG, "It's our turn (%s).\n", qe->chan->name);
res = 1;
@@ -2061,12 +2072,10 @@
announce = announceoverride;
while(cur) {
- tmp = ast_calloc(1, sizeof(*tmp));
- if (!tmp) {
+ if (!(tmp = ast_calloc(1, sizeof(*tmp)))) {
ast_mutex_unlock(&qe->parent->lock);
if (use_weight)
ast_mutex_unlock(&qlock);
- ast_log(LOG_WARNING, "Out of memory\n");
goto out;
}
tmp->stillgoing = -1;
@@ -3122,7 +3131,7 @@
ast_copy_string(buf, "0", len);
if (ast_strlen_zero(data)) {
- ast_log(LOG_ERROR, "QUEUEAGENTCOUNT requires an argument: queuename\n");
+ ast_log(LOG_ERROR, "%s requires an argument: queuename\n", cmd);
LOCAL_USER_REMOVE(u);
return buf;
}
@@ -3154,11 +3163,85 @@
return buf;
}
+static char *queue_function_queuememberlist(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+{
+ struct localuser *u;
+ struct ast_call_queue *q;
+ struct member *m;
+
+ /* Ensure an otherwise empty list doesn't return garbage */
+ buf[0] = '\0';
+
+ if (!data || ast_strlen_zero(data)) {
+ ast_log(LOG_ERROR, "QUEUE_MEMBER_LIST requires an argument: queuename\n");
+ return buf;
+ }
+
+ LOCAL_USER_ACF_ADD(u);
+
+ ast_mutex_lock(&qlock);
+
+ /* Find the right queue */
+ for (q = queues; q; q = q->next) {
+ if (!strcasecmp(q->name, data)) {
+ ast_mutex_lock(&q->lock);
+ break;
+ }
+ }
+
+ ast_mutex_unlock(&qlock);
+
+ if (q) {
+ int buflen = 0, count = 0;
+ for (m = q->members; m; m = m->next) {
+ /* strcat() is always faster than printf() */
+ if (count++) {
+ strncat(buf + buflen, ",", len - buflen - 1);
+ buflen++;
+ }
+ strncat(buf + buflen, m->interface, len - buflen - 1);
+ buflen += strlen(m->interface);
+ /* Safeguard against overflow (negative length) */
+ if (buflen >= len - 2) {
+ ast_log(LOG_WARNING, "Truncating list\n");
+ break;
+ }
+ }
+ ast_mutex_unlock(&q->lock);
+ }
+
+ /* We should already be terminated, but let's make sure. */
+ buf[len - 1] = '\0';
+ LOCAL_USER_REMOVE(u);
+ return buf;
+}
+
static struct ast_custom_function queueagentcount_function = {
.name = "QUEUEAGENTCOUNT",
.synopsis = "Count number of agents answering a queue",
.syntax = "QUEUEAGENTCOUNT(<queuename>)",
+ .desc =
+"Returns the number of members currently associated with the specified queue.\n"
+"This function is deprecated. You should use QUEUE_MEMBER_COUNT() instead.\n",
.read = queue_function_qac,
+};
+
+static struct ast_custom_function queuemembercount_function = {
+ .name = "QUEUE_MEMBER_COUNT",
+ .synopsis = "Count number of members answering a queue",
+ .syntax = "QUEUE_MEMBER_COUNT(<queuename>)",
+ .desc =
+"Returns the number of members currently associated with the specified queue.\n",
+ .read = queue_function_qac,
+};
+
+static struct ast_custom_function queuememberlist_function = {
+ .name = "QUEUE_MEMBER_LIST",
+ .synopsis = "Returns a list of interfaces on a queue",
+ .syntax = "QUEUE_MEMBER_LIST(<queuename>)",
+ .desc =
+"Returns a comma-separated list of members associated with the specified queue.\n",
+ .read = queue_function_queuememberlist,
};
static void reload_queues(void)
@@ -3205,7 +3288,9 @@
}
if (!q) {
/* Make one then */
- q = alloc_queue(cat);
+ if (!(q = alloc_queue(cat))) {
+ /* TODO: Handle memory allocation failure */
+ }
new = 1;
} else
new = 0;
@@ -3682,8 +3767,8 @@
}
case 7:
if (state < 100) { /* 0-99 */
- char *num = ast_malloc(3);
- if (num) {
+ char *num;
+ if ((num = ast_malloc(3))) {
sprintf(num, "%d", state);
}
return num;
@@ -3813,6 +3898,8 @@
res |= ast_unregister_application(app_pqm);
res |= ast_unregister_application(app_upqm);
res |= ast_custom_function_unregister(&queueagentcount_function);
+ res |= ast_custom_function_unregister(&queuemembercount_function);
+ res |= ast_custom_function_unregister(&queuememberlist_function);
res |= ast_unregister_application(app);
STANDARD_HANGUP_LOCALUSERS;
@@ -3840,6 +3927,8 @@
res |= ast_register_application(app_pqm, pqm_exec, app_pqm_synopsis, app_pqm_descrip) ;
res |= ast_register_application(app_upqm, upqm_exec, app_upqm_synopsis, app_upqm_descrip) ;
res |= ast_custom_function_register(&queueagentcount_function);
+ res |= ast_custom_function_register(&queuemembercount_function);
+ res |= ast_custom_function_register(&queuememberlist_function);
if (!res) {
reload_queues();
Modified: team/russell/autoconf_and_menuselect/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/russell/autoconf_and_menuselect/apps/app_rpt.c?rev=8086&r1=8085&r2=8086&view=diff
==============================================================================
--- team/russell/autoconf_and_menuselect/apps/app_rpt.c (original)
+++ team/russell/autoconf_and_menuselect/apps/app_rpt.c Sun Jan 15 19:17:33 2006
@@ -1041,8 +1041,7 @@
/* allocate a pseudo-channel thru asterisk */
- mychannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
- if (!mychannel)
+ if (!(mychannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL)))
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
ast_mutex_lock(&myrpt->lock);
@@ -1312,11 +1311,9 @@
{
l = l->next;
continue;
- }
- m = ast_malloc(sizeof(*m));
- if (!m)
+ }
+ if (!(m = ast_malloc(sizeof(*m))))
{
- ast_log(LOG_WARNING, "Cannot alloc memory on %s\n", mychannel->name);
ast_mutex_lock(&myrpt->lock);
remque((struct qelem *)mytele);
ast_mutex_unlock(&myrpt->lock);
@@ -1563,16 +1560,12 @@
struct rpt_tele *tele;
struct rpt_link *mylink = (struct rpt_link *) data;
pthread_attr_t attr;
-
- tele = ast_malloc(sizeof(*tele));
- if (!tele)
- {
- ast_log(LOG_WARNING, "Unable to allocate memory\n");
+
+ if (!(tele = ast_calloc(1, sizeof(*tele))))
+ {
pthread_exit(NULL);
return;
}
- /* zero it out */
- memset((char *)tele,0,sizeof(struct rpt_tele));
tele->rpt = myrpt;
tele->mode = mode;
ast_mutex_lock(&myrpt->lock);
@@ -1605,8 +1598,7 @@
myrpt->mydtmf = 0;
/* allocate a pseudo-channel thru asterisk */
- mychannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
- if (!mychannel)
+ if (!(mychannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL)))
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
pthread_exit(NULL);
@@ -1624,8 +1616,7 @@
pthread_exit(NULL);
}
/* allocate a pseudo-channel thru asterisk */
- genchannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
- if (!genchannel)
+ if (!(genchannel = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL)))
{
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
ast_hangup(mychannel);
@@ -1951,10 +1942,8 @@
} else
ast_mutex_unlock(&myrpt->lock);
strncpy(myrpt->lastlinknode,digitbuf,MAXNODESTR - 1);
- /* establish call in monitor mode */
- l = ast_calloc(1, sizeof(*l));
- if (!l){
- ast_log(LOG_WARNING, "Unable to malloc\n");
+ /* establish call in monitor mode */
+ if (!(l = ast_calloc(1, sizeof(*l)))) {
return DC_ERROR;
}
/* zero the silly thing */
@@ -1993,8 +1982,7 @@
return DC_ERROR;
}
/* allocate a pseudo-channel thru asterisk */
- l->pchan = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
- if (!l->pchan){
+ if (!(l->pchan = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL))) {
fprintf(stderr,"rpt:Sorry unable to obtain pseudo channel\n");
ast_hangup(l->chan);
free(l);
@@ -2065,9 +2053,7 @@
ast_mutex_unlock(&myrpt->lock);
strncpy(myrpt->lastlinknode,digitbuf,MAXNODESTR - 1);
/* establish call in tranceive mode */
- l = ast_calloc(1, sizeof(*l));
- if (!l){
- ast_log(LOG_WARNING, "Unable to malloc\n");
+ if (!(l = ast_calloc(1, sizeof(*l)))) {
return(DC_ERROR);
}
l->mode = 1;
@@ -2107,8 +2093,7 @@
return DC_ERROR;
}
/* allocate a pseudo-channel thru asterisk */
- l->pchan = ast_request("zap",AST_FORMAT_SLINEAR,"pseudo",NULL);
- if (!l->pchan){
[... 1767 lines stripped ...]
More information about the asterisk-commits
mailing list