[asterisk-commits] oej: branch oej/fixtoheader-1.4 r171363 - in /team/oej/fixtoheader-1.4: ./ ap...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jan 26 09:04:38 CST 2009
Author: oej
Date: Mon Jan 26 09:04:37 2009
New Revision: 171363
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=171363
Log:
Reset automerge
Added:
team/oej/fixtoheader-1.4/funcs/func_audiohookinherit.c
- copied unchanged from r171187, branches/1.4/funcs/func_audiohookinherit.c
Modified:
team/oej/fixtoheader-1.4/ (props changed)
team/oej/fixtoheader-1.4/CHANGES
team/oej/fixtoheader-1.4/README
team/oej/fixtoheader-1.4/apps/app_chanspy.c
team/oej/fixtoheader-1.4/apps/app_dahdibarge.c
team/oej/fixtoheader-1.4/apps/app_dahdiscan.c
team/oej/fixtoheader-1.4/apps/app_dial.c
team/oej/fixtoheader-1.4/apps/app_directory.c
team/oej/fixtoheader-1.4/apps/app_disa.c
team/oej/fixtoheader-1.4/apps/app_followme.c
team/oej/fixtoheader-1.4/apps/app_macro.c
team/oej/fixtoheader-1.4/apps/app_meetme.c
team/oej/fixtoheader-1.4/apps/app_page.c
team/oej/fixtoheader-1.4/apps/app_queue.c
team/oej/fixtoheader-1.4/apps/app_read.c
team/oej/fixtoheader-1.4/apps/app_realtime.c
team/oej/fixtoheader-1.4/apps/app_userevent.c
team/oej/fixtoheader-1.4/apps/app_voicemail.c
team/oej/fixtoheader-1.4/channels/chan_agent.c
team/oej/fixtoheader-1.4/channels/chan_alsa.c
team/oej/fixtoheader-1.4/channels/chan_dahdi.c
team/oej/fixtoheader-1.4/channels/chan_iax2.c
team/oej/fixtoheader-1.4/channels/chan_local.c
team/oej/fixtoheader-1.4/channels/chan_misdn.c
team/oej/fixtoheader-1.4/channels/chan_oss.c
team/oej/fixtoheader-1.4/channels/chan_sip.c
team/oej/fixtoheader-1.4/channels/misdn/isdn_lib.c
team/oej/fixtoheader-1.4/channels/misdn_config.c
team/oej/fixtoheader-1.4/codecs/codec_dahdi.c
team/oej/fixtoheader-1.4/configs/extconfig.conf.sample
team/oej/fixtoheader-1.4/configs/indications.conf.sample
team/oej/fixtoheader-1.4/configure
team/oej/fixtoheader-1.4/configure.ac
team/oej/fixtoheader-1.4/contrib/i18n.testsuite.conf
team/oej/fixtoheader-1.4/contrib/scripts/autosupport
team/oej/fixtoheader-1.4/funcs/func_channel.c
team/oej/fixtoheader-1.4/funcs/func_cut.c
team/oej/fixtoheader-1.4/funcs/func_logic.c
team/oej/fixtoheader-1.4/funcs/func_strings.c
team/oej/fixtoheader-1.4/include/asterisk/audiohook.h
team/oej/fixtoheader-1.4/include/asterisk/autoconfig.h.in
team/oej/fixtoheader-1.4/include/asterisk/channel.h
team/oej/fixtoheader-1.4/include/asterisk/dahdi_compat.h
team/oej/fixtoheader-1.4/include/asterisk/indications.h
team/oej/fixtoheader-1.4/include/asterisk/linkedlists.h
team/oej/fixtoheader-1.4/include/asterisk/pbx.h
team/oej/fixtoheader-1.4/include/asterisk/say.h
team/oej/fixtoheader-1.4/include/asterisk/strings.h
team/oej/fixtoheader-1.4/include/asterisk/threadstorage.h
team/oej/fixtoheader-1.4/main/app.c
team/oej/fixtoheader-1.4/main/asterisk.c
team/oej/fixtoheader-1.4/main/audiohook.c
team/oej/fixtoheader-1.4/main/autoservice.c
team/oej/fixtoheader-1.4/main/channel.c
team/oej/fixtoheader-1.4/main/db.c
team/oej/fixtoheader-1.4/main/editline/read.c
team/oej/fixtoheader-1.4/main/file.c
team/oej/fixtoheader-1.4/main/indications.c
team/oej/fixtoheader-1.4/main/manager.c
team/oej/fixtoheader-1.4/main/pbx.c
team/oej/fixtoheader-1.4/main/rtp.c
team/oej/fixtoheader-1.4/main/say.c
team/oej/fixtoheader-1.4/main/threadstorage.c
team/oej/fixtoheader-1.4/main/udptl.c
team/oej/fixtoheader-1.4/main/utils.c
team/oej/fixtoheader-1.4/pbx/pbx_ael.c
team/oej/fixtoheader-1.4/pbx/pbx_config.c
team/oej/fixtoheader-1.4/pbx/pbx_dundi.c
team/oej/fixtoheader-1.4/res/res_agi.c
team/oej/fixtoheader-1.4/res/res_features.c
team/oej/fixtoheader-1.4/res/res_indications.c
team/oej/fixtoheader-1.4/res/res_musiconhold.c
team/oej/fixtoheader-1.4/res/snmp/agent.c
team/oej/fixtoheader-1.4/sounds/Makefile
Propchange: team/oej/fixtoheader-1.4/
------------------------------------------------------------------------------
automerge = http://www.codename-pineapple.org/
Propchange: team/oej/fixtoheader-1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Propchange: team/oej/fixtoheader-1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/oej/fixtoheader-1.4/
------------------------------------------------------------------------------
--- reviewboard:url (added)
+++ reviewboard:url Mon Jan 26 09:04:37 2009
@@ -1,0 +1,1 @@
+http://reviewboard.digium.com
Propchange: team/oej/fixtoheader-1.4/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jan 26 09:04:37 2009
@@ -1,1 +1,1 @@
-/branches/1.4:1-162771
+/branches/1.4:1-171262
Modified: team/oej/fixtoheader-1.4/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/CHANGES?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/CHANGES (original)
+++ team/oej/fixtoheader-1.4/CHANGES Mon Jan 26 09:04:37 2009
@@ -120,6 +120,7 @@
19. SQL_ESC()
20. STAT()
21. STRPTIME()
+ 22. AUDIOHOOK_INHERIT()
* Apps that have changes to their interface:
1. Authenticate() -- optional maxdigits argument added.
2. ChanSpy() -- new options:
Modified: team/oej/fixtoheader-1.4/README
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/README?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/README (original)
+++ team/oej/fixtoheader-1.4/README Mon Jan 26 09:04:37 2009
@@ -2,7 +2,7 @@
by Mark Spencer <markster at digium.com>
and the Asterisk.org developer community
-Copyright (C) 2001-2008 Digium, Inc.
+Copyright (C) 2001-2009 Digium, Inc.
and other copyright holders.
================================================================
@@ -11,7 +11,7 @@
the security information file (doc/security.txt) before you attempt
to configure and run an Asterisk server.
-* WHAT IS ASTERISK ?
+* WHAT IS ASTERISK?
Asterisk is an Open Source PBX and telephony toolkit. It is, in a
sense, middleware between Internet and telephony channels on the bottom,
and Internet and telephony applications at the top. For more information
Modified: team/oej/fixtoheader-1.4/apps/app_chanspy.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_chanspy.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_chanspy.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_chanspy.c Mon Jan 26 09:04:37 2009
@@ -513,7 +513,7 @@
char *ptr;
int num;
int num_spyed_upon = 1;
- struct chanspy_ds chanspy_ds;
+ struct chanspy_ds chanspy_ds = { 0, };
ast_mutex_init(&chanspy_ds.lock);
Modified: team/oej/fixtoheader-1.4/apps/app_dahdibarge.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_dahdibarge.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_dahdibarge.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_dahdibarge.c Mon Jan 26 09:04:37 2009
@@ -134,11 +134,7 @@
zapretry:
origfd = chan->fds[0];
if (retryzap) {
-#ifdef HAVE_ZAPTEL
- fd = open("/dev/zap/pseudo", O_RDWR);
-#else
- fd = open("/dev/dahdi/pseudo", O_RDWR);
-#endif
+ fd = open(DAHDI_FILE_PSEUDO, O_RDWR);
if (fd < 0) {
ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
goto outrun;
Modified: team/oej/fixtoheader-1.4/apps/app_dahdiscan.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_dahdiscan.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_dahdiscan.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_dahdiscan.c Mon Jan 26 09:04:37 2009
@@ -135,7 +135,7 @@
zapretry:
origfd = chan->fds[0];
if (retryzap) {
- fd = open("/dev/zap/pseudo", O_RDWR);
+ fd = open(DAHDI_FILE_PSEUDO, O_RDWR);
if (fd < 0) {
ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
goto outrun;
Modified: team/oej/fixtoheader-1.4/apps/app_dial.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_dial.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_dial.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_dial.c Mon Jan 26 09:04:37 2009
@@ -564,6 +564,9 @@
ast_set_callerid(c, S_OR(in->macroexten, in->exten), get_cid_name(cidname, sizeof(cidname), in), NULL);
}
}
+ if (single) {
+ ast_indicate(in, -1);
+ }
}
/* Hangup the original channel now, in case we needed it */
ast_hangup(winner);
@@ -876,7 +879,7 @@
char numsubst[256];
char cidname[AST_MAX_EXTENSION] = "";
int privdb_val = 0;
- unsigned int calldurationlimit = 0;
+ int calldurationlimit = -1;
long timelimit = 0;
long play_warning = 0;
long warning_freq = 0;
@@ -1017,7 +1020,7 @@
start_sound = S_OR(var, NULL); /* XXX not much of a point in doing this! */
/* undo effect of S(x) in case they are both used */
- calldurationlimit = 0;
+ calldurationlimit = -1;
/* more efficient to do it like S(x) does since no advanced opts */
if (!play_warning && !start_sound && !end_sound && timelimit) {
calldurationlimit = timelimit / 1000;
@@ -1751,7 +1754,7 @@
if (!res) {
if (calldurationlimit > 0) {
peer->whentohangup = time(NULL) + calldurationlimit;
- } else if (timelimit > 0) {
+ } else if (calldurationlimit != -1 && timelimit > 0) {
/* Not enough granularity to make it less, but we can't use the special value 0 */
peer->whentohangup = time(NULL) + 1;
}
@@ -1837,37 +1840,29 @@
res = -1;
}
- if (res != AST_PBX_NO_HANGUP_PEER && res != AST_PBX_NO_HANGUP_PEER_PARKED) {
- if (res != AST_PBX_KEEPALIVE && !chan->_softhangup)
- chan->hangupcause = peer->hangupcause;
- ast_hangup(peer);
- }
+ if (!chan->_softhangup)
+ chan->hangupcause = peer->hangupcause;
+ ast_hangup(peer);
}
out:
- /* cleaning up chan is not a good idea here if AST_PBX_KEEPALIVE
- is returned; chan will get the love it needs from another
- thread */
- if (res != AST_PBX_KEEPALIVE) {
- if (moh) {
- moh = 0;
- ast_moh_stop(chan);
- } else if (sentringing) {
- sentringing = 0;
- ast_indicate(chan, -1);
- }
- ast_rtp_early_bridge(chan, NULL);
- hanguptree(outgoing, NULL);
- pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
- if (option_debug)
- ast_log(LOG_DEBUG, "Exiting with DIALSTATUS=%s.\n", status);
-
- if ((ast_test_flag(peerflags, OPT_GO_ON)) && (!chan->_softhangup) && (res != AST_PBX_KEEPALIVE)) {
- if (timelimit)
- chan->whentohangup = 0;
- res = 0;
- }
- }
-
+ if (moh) {
+ moh = 0;
+ ast_moh_stop(chan);
+ } else if (sentringing) {
+ sentringing = 0;
+ ast_indicate(chan, -1);
+ }
+ ast_rtp_early_bridge(chan, NULL);
+ hanguptree(outgoing, NULL);
+ pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Exiting with DIALSTATUS=%s.\n", status);
+
+ if (ast_test_flag(peerflags, OPT_GO_ON) && !chan->_softhangup) {
+ if (calldurationlimit)
+ chan->whentohangup = 0;
+ res = 0;
+ }
done:
ast_module_user_remove(u);
return res;
Modified: team/oej/fixtoheader-1.4/apps/app_directory.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_directory.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_directory.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_directory.c Mon Jan 26 09:04:37 2009
@@ -389,6 +389,9 @@
if (!cat) {
ast_log(LOG_WARNING, "Out of memory\n");
ast_config_destroy(cfg);
+ if (rtdata) {
+ ast_config_destroy(rtdata);
+ }
return NULL;
}
ast_category_append(cfg, cat);
Modified: team/oej/fixtoheader-1.4/apps/app_disa.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_disa.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_disa.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_disa.c Mon Jan 26 09:04:37 2009
@@ -98,7 +98,7 @@
static void play_dialtone(struct ast_channel *chan, char *mailbox)
{
- const struct ind_tone_zone_sound *ts = NULL;
+ const struct tone_zone_sound *ts = NULL;
if(ast_app_has_voicemail(mailbox, NULL))
ts = ast_get_indication_tone(chan->zone, "dialrecall");
else
Modified: team/oej/fixtoheader-1.4/apps/app_followme.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_followme.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_followme.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_followme.c Mon Jan 26 09:04:37 2009
@@ -960,22 +960,26 @@
AST_APP_ARG(options);
);
+ if (ast_strlen_zero(data)) {
+ ast_log(LOG_WARNING, "%s requires an argument (followmeid)\n",app);
+ return -1;
+ }
+
if (!(argstr = ast_strdupa((char *)data))) {
ast_log(LOG_ERROR, "Out of memory!\n");
return -1;
}
- if (!data) {
- ast_log(LOG_WARNING, "%s requires an argument (followmeid)\n",app);
+
+ AST_STANDARD_APP_ARGS(args, argstr);
+ if (ast_strlen_zero(args.followmeid)) {
+ ast_log(LOG_WARNING, "%s requires an argument (followmeid)\n", app);
return -1;
}
u = ast_module_user_add(chan);
- AST_STANDARD_APP_ARGS(args, argstr);
-
- if (!ast_strlen_zero(args.followmeid))
- AST_LIST_LOCK(&followmes);
+ AST_LIST_LOCK(&followmes);
AST_LIST_TRAVERSE(&followmes, f, entry) {
if (!strcasecmp(f->name, args.followmeid) && (f->active))
break;
Modified: team/oej/fixtoheader-1.4/apps/app_macro.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_macro.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_macro.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_macro.c Mon Jan 26 09:04:37 2009
@@ -103,6 +103,30 @@
static char *exclusive_synopsis = "Exclusive Macro Implementation";
static char *exit_synopsis = "Exit From Macro";
+static void macro_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan);
+
+struct ast_datastore_info macro_ds_info = {
+ .type = "MACRO",
+ .chan_fixup = macro_fixup,
+};
+
+static void macro_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
+{
+ int i;
+ char varname[10];
+ pbx_builtin_setvar_helper(new_chan, "MACRO_DEPTH", "0");
+ pbx_builtin_setvar_helper(new_chan, "MACRO_CONTEXT", NULL);
+ pbx_builtin_setvar_helper(new_chan, "MACRO_EXTEN", NULL);
+ pbx_builtin_setvar_helper(new_chan, "MACRO_PRIORITY", NULL);
+ pbx_builtin_setvar_helper(new_chan, "MACRO_OFFSET", NULL);
+ for (i = 1; i < 100; i++) {
+ snprintf(varname, sizeof(varname), "ARG%d", i);
+ while (pbx_builtin_getvar_helper(new_chan, varname)) {
+ /* Kill all levels of arguments */
+ pbx_builtin_setvar_helper(new_chan, varname, NULL);
+ }
+ }
+}
static struct ast_exten *find_matching_priority(struct ast_context *c, const char *exten, int priority, const char *callerid)
{
@@ -158,13 +182,14 @@
const char *inhangupc;
int offset, depth = 0, maxdepth = 7;
int setmacrocontext=0;
- int autoloopflag, dead = 0, inhangup = 0;
+ int autoloopflag, inhangup = 0;
char *save_macro_exten;
char *save_macro_context;
char *save_macro_priority;
char *save_macro_offset;
struct ast_module_user *u;
+ struct ast_datastore *macro_store = ast_channel_datastore_find(chan, ¯o_ds_info, NULL);
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Macro() requires arguments. See \"show application macro\" for help.\n");
@@ -172,6 +197,19 @@
}
u = ast_module_user_add(chan);
+
+ do {
+ if (macro_store) {
+ break;
+ }
+ if (!(macro_store = ast_channel_datastore_alloc(¯o_ds_info, NULL))) {
+ ast_log(LOG_WARNING, "Unable to allocate new datastore.\n");
+ break;
+ }
+ /* Just the existence of this datastore is enough. */
+ macro_store->inheritance = DATASTORE_INHERIT_FOREVER;
+ ast_channel_datastore_add(chan, macro_store);
+ } while (0);
/* does the user want a deeper rabbit hole? */
s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION");
@@ -323,13 +361,11 @@
else if (option_verbose > 1)
ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited KEEPALIVE in macro '%s' on '%s'\n", chan->context, chan->exten, chan->priority, macro, chan->name);
goto out;
- break;
default:
if (option_debug)
ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
else if (option_verbose > 1)
ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
- dead = 1;
goto out;
}
}
@@ -404,31 +440,30 @@
chan->priority++;
}
out:
+
+ /* Don't let the channel change now. */
+ ast_channel_lock(chan);
+
/* Reset the depth back to what it was when the routine was entered (like if we called Macro recursively) */
snprintf(depthc, sizeof(depthc), "%d", depth);
- if (!dead) {
- pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
- ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
- }
+ pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
+ ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
for (x = 1; x < argc; x++) {
/* Restore old arguments and delete ours */
snprintf(varname, sizeof(varname), "ARG%d", x);
if (oldargs[x]) {
- if (!dead)
- pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
+ pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
free(oldargs[x]);
- } else if (!dead) {
+ } else {
pbx_builtin_setvar_helper(chan, varname, NULL);
}
}
/* Restore macro variables */
- if (!dead) {
- pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", save_macro_exten);
- pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", save_macro_context);
- pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
- }
+ pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", save_macro_exten);
+ pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", save_macro_context);
+ pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
if (save_macro_exten)
free(save_macro_exten);
if (save_macro_context)
@@ -436,13 +471,13 @@
if (save_macro_priority)
free(save_macro_priority);
- if (!dead && setmacrocontext) {
+ if (setmacrocontext) {
chan->macrocontext[0] = '\0';
chan->macroexten[0] = '\0';
chan->macropriority = 0;
}
- if (!dead && !strcasecmp(chan->context, fullmacro)) {
+ if (!strcasecmp(chan->context, fullmacro)) {
/* If we're leaving the macro normally, restore original information */
chan->priority = oldpriority;
ast_copy_string(chan->context, oldcontext, sizeof(chan->context));
@@ -462,8 +497,7 @@
}
}
- if (!dead)
- pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
+ pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
if (save_macro_offset)
free(save_macro_offset);
@@ -475,6 +509,7 @@
res = 0;
}
}
+ ast_channel_unlock(chan);
ast_module_user_remove(u);
Modified: team/oej/fixtoheader-1.4/apps/app_meetme.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_meetme.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_meetme.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_meetme.c Mon Jan 26 09:04:37 2009
@@ -795,11 +795,7 @@
/* Setup a new zap conference */
ztc.confno = -1;
ztc.confmode = DAHDI_CONF_CONFANN | DAHDI_CONF_CONFANNMON;
-#ifdef HAVE_ZAPTEL
- cnf->fd = open("/dev/zap/pseudo", O_RDWR);
-#else
- cnf->fd = open("/dev/dahdi/pseudo", O_RDWR);
-#endif
+ cnf->fd = open(DAHDI_FILE_PSEUDO, O_RDWR);
if (cnf->fd < 0 || ioctl(cnf->fd, DAHDI_SETCONF, &ztc)) {
ast_log(LOG_WARNING, "Unable to open pseudo device\n");
if (cnf->fd >= 0)
@@ -1732,11 +1728,7 @@
zapretry:
origfd = chan->fds[0];
if (retryzap) {
-#ifdef HAVE_ZAPTEL
- fd = open("/dev/zap/pseudo", O_RDWR);
-#else
- fd = open("/dev/dahdi/pseudo", O_RDWR);
-#endif
+ fd = open(DAHDI_FILE_PSEUDO, O_RDWR);
if (fd < 0) {
ast_log(LOG_WARNING, "Unable to open pseudo channel: %s\n", strerror(errno));
goto outrun;
@@ -2477,7 +2469,7 @@
static struct ast_conference *find_conf_realtime(struct ast_channel *chan, char *confno, int make, int dynamic,
char *dynamic_pin, size_t pin_buf_len, int refcount, struct ast_flags *confflags)
{
- struct ast_variable *var;
+ struct ast_variable *var, *save;
struct ast_conference *cnf;
/* Check first in the conference list */
@@ -2499,6 +2491,7 @@
if (!var)
return NULL;
+ save = var;
while (var) {
if (!strcasecmp(var->name, "pin")) {
pin = ast_strdupa(var->value);
@@ -2507,7 +2500,7 @@
}
var = var->next;
}
- ast_variables_destroy(var);
+ ast_variables_destroy(save);
cnf = build_conf(confno, pin ? pin : "", pinadmin ? pinadmin : "", make, dynamic, refcount);
}
@@ -2515,9 +2508,9 @@
if (cnf) {
if (confflags && !cnf->chan &&
!ast_test_flag(confflags, CONFFLAG_QUIET) &&
- ast_test_flag(confflags, CONFFLAG_INTROUSER)) {
+ ast_test_flag(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW)) {
ast_log(LOG_WARNING, "No %s channel available for conference, user introduction disabled\n", dahdi_chan_name);
- ast_clear_flag(confflags, CONFFLAG_INTROUSER);
+ ast_clear_flag(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW);
}
if (confflags && !cnf->chan &&
@@ -2609,9 +2602,9 @@
if (cnf) {
if (confflags && !cnf->chan &&
!ast_test_flag(confflags, CONFFLAG_QUIET) &&
- ast_test_flag(confflags, CONFFLAG_INTROUSER)) {
+ ast_test_flag(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW)) {
ast_log(LOG_WARNING, "No %s channel available for conference, user introduction disabled\n", dahdi_chan_name);
- ast_clear_flag(confflags, CONFFLAG_INTROUSER);
+ ast_clear_flag(confflags, CONFFLAG_INTROUSER | CONFFLAG_INTROUSERNOREVIEW);
}
if (confflags && !cnf->chan &&
Modified: team/oej/fixtoheader-1.4/apps/app_page.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_page.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_page.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_page.c Mon Jan 26 09:04:37 2009
@@ -78,18 +78,18 @@
AST_APP_OPTION('r', PAGE_RECORD),
});
-#define MAX_DIALS 128
static int page_exec(struct ast_channel *chan, void *data)
{
struct ast_module_user *u;
- char *options, *tech, *resource, *tmp;
+ char *options, *tech, *resource, *tmp, *tmp2;
char meetmeopts[88], originator[AST_CHANNEL_NAME];
struct ast_flags flags = { 0 };
unsigned int confid = ast_random();
struct ast_app *app;
int res = 0, pos = 0, i = 0;
- struct ast_dial *dials[MAX_DIALS];
+ struct ast_dial **dial_list;
+ unsigned int num_dials;
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "This application requires at least one argument (destination(s) to page)\n");
@@ -117,6 +117,22 @@
snprintf(meetmeopts, sizeof(meetmeopts), "MeetMe|%ud|%s%sqxdw(5)", confid, (ast_test_flag(&flags, PAGE_DUPLEX) ? "" : "m"),
(ast_test_flag(&flags, PAGE_RECORD) ? "r" : "") );
+ /* Count number of extensions in list by number of ampersands + 1 */
+ num_dials = 1;
+ tmp2 = tmp;
+ while (*tmp2) {
+ if (*tmp2 == '&') {
+ num_dials++;
+ }
+ tmp2++;
+ }
+
+ if (!(dial_list = ast_calloc(num_dials, sizeof(struct ast_dial *)))) {
+ ast_log(LOG_ERROR, "Can't allocate %ld bytes for dial list\n", (long)(sizeof(struct ast_dial *) * num_dials));
+ ast_module_user_remove(u);
+ return -1;
+ }
+
/* Go through parsing/calling each device */
while ((tech = strsep(&tmp, "&"))) {
struct ast_dial *dial = NULL;
@@ -149,7 +165,7 @@
ast_dial_run(dial, chan, 1);
/* Put in our dialing array */
- dials[pos++] = dial;
+ dial_list[pos++] = dial;
}
if (!ast_test_flag(&flags, PAGE_QUIET)) {
@@ -166,7 +182,7 @@
/* Go through each dial attempt cancelling, joining, and destroying */
for (i = 0; i < pos; i++) {
- struct ast_dial *dial = dials[i];
+ struct ast_dial *dial = dial_list[i];
/* We have to wait for the async thread to exit as it's possible Meetme won't throw them out immediately */
ast_dial_join(dial);
@@ -178,6 +194,7 @@
ast_dial_destroy(dial);
}
+ ast_free(dial_list);
ast_module_user_remove(u);
return -1;
Modified: team/oej/fixtoheader-1.4/apps/app_queue.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_queue.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_queue.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_queue.c Mon Jan 26 09:04:37 2009
@@ -1301,11 +1301,12 @@
static int update_realtime_member_field(struct member *mem, const char *queue_name, const char *field, const char *value)
{
- struct ast_variable *var;
+ struct ast_variable *var, *save;
int ret = -1;
if (!(var = ast_load_realtime("queue_members", "interface", mem->interface, "queue_name", queue_name, NULL)))
return ret;
+ save = var;
while (var) {
if (!strcmp(var->name, "uniqueid"))
break;
@@ -1315,6 +1316,7 @@
if ((ast_update_realtime("queue_members", "uniqueid", var->value, field, value, NULL)) > -1)
ret = 0;
}
+ ast_variables_destroy(save);
return ret;
}
@@ -2576,7 +2578,7 @@
struct queue_transfer_ds {
struct queue_ent *qe;
struct member *member;
- int starttime;
+ time_t starttime;
int callcompletedinsl;
};
@@ -2603,12 +2605,12 @@
* At the end of this, we want to remove the datastore so that this fixup function is not called on any
* future masquerades of the caller during the current call.
*/
-static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
+static void queue_transfer_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
{
struct queue_transfer_ds *qtds = data;
struct queue_ent *qe = qtds->qe;
struct member *member = qtds->member;
- int callstart = qtds->starttime;
+ time_t callstart = qtds->starttime;
int callcompletedinsl = qtds->callcompletedinsl;
struct ast_datastore *datastore;
@@ -2618,13 +2620,12 @@
update_queue(qe->parent, member, callcompletedinsl);
- if (!(datastore = ast_channel_datastore_find(new_chan, &queue_transfer_info, NULL))) {
+ /* No need to lock the channels because they are already locked in ast_do_masquerade */
+ if ((datastore = ast_channel_datastore_find(old_chan, &queue_transfer_info, NULL))) {
+ ast_channel_datastore_remove(old_chan, datastore);
+ } else {
ast_log(LOG_WARNING, "Can't find the queue_transfer datastore.\n");
- return;
- }
-
- ast_channel_datastore_remove(new_chan, datastore);
- ast_channel_datastore_free(datastore);
+ }
}
/*! \brief mechanism to tell if a queue caller was atxferred by a queue member.
@@ -2632,6 +2633,8 @@
* When a caller is atxferred, then the queue_transfer_info datastore
* is removed from the channel. If it's still there after the bridge is
* broken, then the caller was not atxferred.
+ *
+ * \note Only call this with chan locked
*/
static int attended_transfer_occurred(struct ast_channel *chan)
{
@@ -2640,21 +2643,21 @@
/*! \brief create a datastore for storing relevant info to log attended transfers in the queue_log
*/
-static void setup_transfer_datastore(struct queue_ent *qe, struct member *member, int starttime, int callcompletedinsl)
+static struct ast_datastore *setup_transfer_datastore(struct queue_ent *qe, struct member *member, time_t starttime, int callcompletedinsl)
{
struct ast_datastore *ds;
struct queue_transfer_ds *qtds = ast_calloc(1, sizeof(*qtds));
if (!qtds) {
ast_log(LOG_WARNING, "Memory allocation error!\n");
- return;
+ return NULL;
}
ast_channel_lock(qe->chan);
if (!(ds = ast_channel_datastore_alloc(&queue_transfer_info, NULL))) {
ast_channel_unlock(qe->chan);
ast_log(LOG_WARNING, "Unable to create transfer datastore. queue_log will not show attended transfer\n");
- return;
+ return NULL;
}
qtds->qe = qe;
@@ -2665,6 +2668,7 @@
ds->data = qtds;
ast_channel_datastore_add(qe->chan, ds);
ast_channel_unlock(qe->chan);
+ return ds;
}
@@ -2728,7 +2732,7 @@
int forwardsallowed = 1;
int callcompletedinsl;
struct ao2_iterator memi;
- struct ast_datastore *datastore;
+ struct ast_datastore *datastore, *transfer_ds;
ast_channel_lock(qe->chan);
datastore = ast_channel_datastore_find(qe->chan, &dialed_interface_info, NULL);
@@ -2905,9 +2909,11 @@
* to which the datastore was moved hangs up, it will attempt to free this
* datastore again, causing a crash
*/
+ ast_channel_lock(qe->chan);
if (datastore && !ast_channel_datastore_remove(qe->chan, datastore)) {
ast_channel_datastore_free(datastore);
}
+ ast_channel_unlock(qe->chan);
ast_mutex_lock(&qe->parent->lock);
if (qe->parent->strategy == QUEUE_STRATEGY_RRMEMORY) {
store_next(qe, outgoing);
@@ -3151,11 +3157,12 @@
if (member->status == AST_DEVICE_NOT_INUSE)
ast_log(LOG_WARNING, "The device state of this queue member, %s, is still 'Not in Use' when it probably should not be! Please check UPGRADE.txt for correct configuration settings.\n", member->membername);
- setup_transfer_datastore(qe, member, callstart, callcompletedinsl);
+ transfer_ds = setup_transfer_datastore(qe, member, callstart, callcompletedinsl);
bridge = ast_bridge_call(qe->chan,peer, &bridge_config);
- if (bridge != AST_PBX_KEEPALIVE && !attended_transfer_occurred(qe->chan)) {
- struct ast_datastore *transfer_ds;
+ ast_channel_lock(qe->chan);
+ if (!attended_transfer_occurred(qe->chan)) {
+ struct ast_datastore *tds;
if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld",
qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
@@ -3163,7 +3170,7 @@
} else if (qe->chan->_softhangup) {
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETECALLER", "%ld|%ld|%d",
(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
- if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED && qe->parent->eventwhencalled)
+ if (qe->parent->eventwhencalled)
manager_event(EVENT_FLAG_AGENT, "AgentComplete",
"Queue: %s\r\n"
"Uniqueid: %s\r\n"
@@ -3180,7 +3187,7 @@
} else {
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETEAGENT", "%ld|%ld|%d",
(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
- if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED && qe->parent->eventwhencalled)
+ if (qe->parent->eventwhencalled)
manager_event(EVENT_FLAG_AGENT, "AgentComplete",
"Queue: %s\r\n"
"Uniqueid: %s\r\n"
@@ -3194,18 +3201,17 @@
(long)(time(NULL) - callstart),
qe->parent->eventwhencalled == QUEUE_EVENT_VARIABLES ? vars2manager(qe->chan, vars, sizeof(vars)) : "");
}
- ast_channel_lock(qe->chan);
- transfer_ds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL);
- if (transfer_ds) {
- ast_channel_datastore_remove(qe->chan, transfer_ds);
- ast_channel_datastore_free(transfer_ds);
- }
- ast_channel_unlock(qe->chan);
+ if ((tds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL))) {
+ ast_channel_datastore_remove(qe->chan, tds);
+ }
update_queue(qe->parent, member, callcompletedinsl);
}
- if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED)
- ast_hangup(peer);
+ if (transfer_ds) {
+ ast_channel_datastore_free(transfer_ds);
+ }
+ ast_channel_unlock(qe->chan);
+ ast_hangup(peer);
res = bridge ? bridge : 1;
ao2_ref(member, -1);
}
@@ -3447,7 +3453,7 @@
/* Reload dynamic queue members persisted into the astdb */
static void reload_queue_members(void)
{
- char *cur_ptr;
+ char *cur_ptr;
char *queue_name;
char *member;
char *interface;
@@ -4077,7 +4083,7 @@
}
/* Don't allow return code > 0 */
- if (res >= 0 && res != AST_PBX_KEEPALIVE) {
+ if (res >= 0) {
res = 0;
if (ringing) {
ast_indicate(chan, -1);
Modified: team/oej/fixtoheader-1.4/apps/app_read.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_read.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_read.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_read.c Mon Jan 26 09:04:37 2009
@@ -92,7 +92,7 @@
int maxdigits = 255;
int tries = 1, to = 0, x = 0;
char *argcopy = NULL;
- struct ind_tone_zone_sound *ts;
+ struct tone_zone_sound *ts;
struct ast_flags flags = {0};
AST_DECLARE_APP_ARGS(arglist,
Modified: team/oej/fixtoheader-1.4/apps/app_realtime.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_realtime.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_realtime.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_realtime.c Mon Jan 26 09:04:37 2009
@@ -72,22 +72,24 @@
static int cli_realtime_load(int fd, int argc, char **argv)
{
char *header_format = "%30s %-30s\n";
- struct ast_variable *var=NULL;
-
- if(argc<5) {
+ struct ast_variable *var = NULL, *save = NULL;
+
+ if (argc < 5) {
ast_cli(fd, "You must supply a family name, a column to match on, and a value to match to.\n");
return RESULT_FAILURE;
}
var = ast_load_realtime(argv[2], argv[3], argv[4], NULL);
- if(var) {
+ if (var) {
+ save = var;
ast_cli(fd, header_format, "Column Name", "Column Value");
ast_cli(fd, header_format, "--------------------", "--------------------");
- while(var) {
+ while (var) {
ast_cli(fd, header_format, var->name, var->value);
var = var->next;
}
+ ast_variables_destroy(save);
} else {
ast_cli(fd, "No rows found matching search criteria.\n");
}
Modified: team/oej/fixtoheader-1.4/apps/app_userevent.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_userevent.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_userevent.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_userevent.c Mon Jan 26 09:04:37 2009
@@ -59,7 +59,7 @@
{
struct ast_module_user *u;
char *parse, buf[2048] = "";
- int x, buflen = 0;
+ int x, buflen = 0, xlen;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(eventname);
AST_APP_ARG(extra)[100];
@@ -77,8 +77,13 @@
AST_STANDARD_APP_ARGS(args, parse);
for (x = 0; x < args.argc - 1; x++) {
- ast_copy_string(buf + buflen, args.extra[x], sizeof(buf) - buflen - 2);
- buflen += strlen(args.extra[x]);
+ /* Stop once a header comes up that exceeds our buffer. */
+ if (sizeof(buf) <= buflen + (xlen = strlen(args.extra[x])) + 3) {
+ ast_log(LOG_WARNING, "UserEvent exceeds our buffer length! Truncating.\n");
+ break;
+ }
+ ast_copy_string(buf + buflen, args.extra[x], sizeof(buf) - buflen - 3);
+ buflen += xlen;
ast_copy_string(buf + buflen, "\r\n", 3);
buflen += 2;
}
Modified: team/oej/fixtoheader-1.4/apps/app_voicemail.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/fixtoheader-1.4/apps/app_voicemail.c?view=diff&rev=171363&r1=171362&r2=171363
==============================================================================
--- team/oej/fixtoheader-1.4/apps/app_voicemail.c (original)
+++ team/oej/fixtoheader-1.4/apps/app_voicemail.c Mon Jan 26 09:04:37 2009
@@ -1015,7 +1015,9 @@
ast_log(LOG_DEBUG, "deleting msgnum %d, which is mailbox message %lu\n",msgnum,messageNum);
/* delete message */
snprintf (arg, sizeof(arg), "%lu",messageNum);
+ ast_mutex_lock(&vms->lock);
mail_setflag (vms->mailstream,arg,"\\DELETED");
+ ast_mutex_unlock(&vms->lock);
}
static int imap_retrieve_file(const char *dir, const int msgnum, const struct ast_vm_user *vmu)
@@ -1069,15 +1071,19 @@
}
/* This will only work for new messages... */
+ ast_mutex_lock(&vms->lock);
header_content = mail_fetchheader (vms->mailstream, vms->msgArray[msgnum]);
+ ast_mutex_unlock(&vms->lock);
/* empty string means no valid header */
if (ast_strlen_zero(header_content)) {
ast_log (LOG_ERROR,"Could not fetch header for message number %ld\n",vms->msgArray[msgnum]);
return -1;
}
+ ast_mutex_lock(&vms->lock);
mail_fetchstructure (vms->mailstream,vms->msgArray[msgnum],&body);
-
+ ast_mutex_unlock(&vms->lock);
+
/* We have the body, now we extract the file name of the first attachment. */
if (body->nested.part && body->nested.part->next && body->nested.part->next->body.parameter->value) {
attachedfilefmt = ast_strdupa(body->nested.part->next->body.parameter->value);
@@ -1211,6 +1217,7 @@
return -1;
}
if (ret == 0) {
+ ast_mutex_lock(&vms_p->lock);
pgm = mail_newsearchpgm ();
hdr = mail_newsearchheader ("X-Asterisk-VM-Extension", (char *)mailbox);
pgm->header = hdr;
@@ -1236,10 +1243,13 @@
vms_p->oldmessages = vms_p->vmArrayIndex;
/*Freeing the searchpgm also frees the searchhdr*/
mail_free_searchpgm(&pgm);
+ ast_mutex_unlock(&vms_p->lock);
vms_p->updated = 0;
return vms_p->vmArrayIndex;
- } else {
+ } else {
+ ast_mutex_lock(&vms_p->lock);
mail_ping(vms_p->mailstream);
+ ast_mutex_unlock(&vms_p->lock);
}
return 0;
}
@@ -1301,13 +1311,17 @@
fclose(p);
return -1;
}
- fread(buf, len, 1, p);
+ if (fread(buf, len, 1, p) != 1) {
+ ast_log(LOG_WARNING, "Short read: %s\n", strerror(errno));
+ }
((char *)buf)[len] = '\0';
INIT(&str, mail_string, buf, len);
init_mailstream(vms, 0);
imap_mailbox_name(mailbox, sizeof(mailbox), vms, 0, 1);
+ ast_mutex_lock(&vms->lock);
if (!mail_append(vms->mailstream, mailbox, &str))
ast_log(LOG_ERROR, "Error while sending the message to %s\n", mailbox);
+ ast_mutex_unlock(&vms->lock);
fclose(p);
unlink(tmp);
ast_free(buf);
@@ -1419,8 +1433,12 @@
return -1;
}
snprintf(messagestring, sizeof(messagestring), "%ld", sendvms->msgArray[msgnum]);
- if ((mail_copy(sendvms->mailstream, messagestring, (char *) mbox(imbox)) == T))
+ ast_mutex_lock(&sendvms->lock);
+ if ((mail_copy(sendvms->mailstream, messagestring, (char *) mbox(imbox)) == T)) {
+ ast_mutex_unlock(&sendvms->lock);
return 0;
+ }
+ ast_mutex_unlock(&sendvms->lock);
[... 6863 lines stripped ...]
More information about the asterisk-commits
mailing list