mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-17 07:18:15 +00:00
Add some more checks for option_debug before ast_log(LOG_DEBUG, ...) calls.
Issue 8832, patch(es) by tgrman git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@51265 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
39
main/pbx.c
39
main/pbx.c
@@ -1619,7 +1619,8 @@ static void pbx_substitute_variables_helper_full(struct ast_channel *c, struct v
|
||||
/* Evaluate function */
|
||||
cp4 = ast_func_read(c, vars, workspace, VAR_BUF_SIZE) ? NULL : workspace;
|
||||
|
||||
ast_log(LOG_DEBUG, "Function result is '%s'\n", cp4 ? cp4 : "(null)");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Function result is '%s'\n", cp4 ? cp4 : "(null)");
|
||||
} else {
|
||||
/* Retrieve variable value */
|
||||
pbx_retrieve_variable(c, vars, &cp4, workspace, VAR_BUF_SIZE, headp);
|
||||
@@ -1686,7 +1687,8 @@ static void pbx_substitute_variables_helper_full(struct ast_channel *c, struct v
|
||||
length = ast_expr(vars, cp2, count);
|
||||
|
||||
if (length) {
|
||||
ast_log(LOG_DEBUG, "Expression result is '%s'\n", cp2);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Expression result is '%s'\n", cp2);
|
||||
count -= length;
|
||||
cp2 += length;
|
||||
}
|
||||
@@ -1822,7 +1824,8 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con,
|
||||
ast_log(LOG_NOTICE, "No such label '%s' in extension '%s' in context '%s'\n", label, exten, context);
|
||||
break;
|
||||
default:
|
||||
ast_log(LOG_DEBUG, "Shouldn't happen!\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Shouldn't happen!\n");
|
||||
}
|
||||
|
||||
return (matching_action) ? 0 : -1;
|
||||
@@ -2346,7 +2349,8 @@ static int __ast_pbx_run(struct ast_channel *c)
|
||||
if ((res = ast_spawn_extension(c, c->context, c->exten, c->priority, c->cid.cid_num))) {
|
||||
/* Something bad happened, or a hangup has been requested. */
|
||||
if (strchr("0123456789ABCDEF*#", res)) {
|
||||
ast_log(LOG_DEBUG, "Oooh, got something to jump out with ('%c')!\n", res);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Oooh, got something to jump out with ('%c')!\n", res);
|
||||
pos = 0;
|
||||
dst_exten[pos++] = digit = res;
|
||||
dst_exten[pos] = '\0';
|
||||
@@ -2381,8 +2385,9 @@ static int __ast_pbx_run(struct ast_channel *c)
|
||||
c->whentohangup = 0;
|
||||
c->_softhangup &= ~AST_SOFTHANGUP_TIMEOUT;
|
||||
} else if (c->_softhangup) {
|
||||
ast_log(LOG_DEBUG, "Extension %s, priority %d returned normally even though call was hung up\n",
|
||||
c->exten, c->priority);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Extension %s, priority %d returned normally even though call was hung up\n",
|
||||
c->exten, c->priority);
|
||||
error = 1;
|
||||
break;
|
||||
}
|
||||
@@ -3896,7 +3901,8 @@ void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char
|
||||
tmp = *extcontexts;
|
||||
if (registrar) {
|
||||
/* XXX remove previous contexts from same registrar */
|
||||
ast_log(LOG_DEBUG, "must remove any reg %s\n", registrar);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "must remove any reg %s\n", registrar);
|
||||
__ast_context_destroy(NULL,registrar);
|
||||
while (tmp) {
|
||||
lasttmp = tmp;
|
||||
@@ -4785,11 +4791,13 @@ int ast_add_extension2(struct ast_context *con,
|
||||
}
|
||||
if (option_debug) {
|
||||
if (tmp->matchcid) {
|
||||
ast_log(LOG_DEBUG, "Added extension '%s' priority %d (CID match '%s') to %s\n",
|
||||
tmp->exten, tmp->priority, tmp->cidmatch, con->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Added extension '%s' priority %d (CID match '%s') to %s\n",
|
||||
tmp->exten, tmp->priority, tmp->cidmatch, con->name);
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "Added extension '%s' priority %d to %s\n",
|
||||
tmp->exten, tmp->priority, con->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Added extension '%s' priority %d to %s\n",
|
||||
tmp->exten, tmp->priority, con->name);
|
||||
}
|
||||
}
|
||||
if (option_verbose > 2) {
|
||||
@@ -5225,7 +5233,8 @@ void __ast_context_destroy(struct ast_context *con, const char *registrar)
|
||||
for (tmp = contexts; tmp; ) {
|
||||
struct ast_context *next; /* next starting point */
|
||||
for (; tmp; tmpl = tmp, tmp = tmp->next) {
|
||||
ast_log(LOG_DEBUG, "check ctx %s %s\n", tmp->name, tmp->registrar);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "check ctx %s %s\n", tmp->name, tmp->registrar);
|
||||
if ( (!registrar || !strcasecmp(registrar, tmp->registrar)) &&
|
||||
(!con || !strcasecmp(tmp->name, con->name)) )
|
||||
break; /* found it */
|
||||
@@ -5233,7 +5242,8 @@ void __ast_context_destroy(struct ast_context *con, const char *registrar)
|
||||
if (!tmp) /* not found, we are done */
|
||||
break;
|
||||
ast_mutex_lock(&tmp->lock);
|
||||
ast_log(LOG_DEBUG, "delete ctx %s %s\n", tmp->name, tmp->registrar);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "delete ctx %s %s\n", tmp->name, tmp->registrar);
|
||||
next = tmp->next;
|
||||
if (tmpl)
|
||||
tmpl->next = next;
|
||||
@@ -5927,7 +5937,8 @@ static int pbx_builtin_gotoif(struct ast_channel *chan, void *data)
|
||||
branch = pbx_checkcondition(condition) ? branch1 : branch2;
|
||||
|
||||
if (ast_strlen_zero(branch)) {
|
||||
ast_log(LOG_DEBUG, "Not taking any branch\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Not taking any branch\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user