mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +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:
@@ -1956,12 +1956,14 @@ static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, in
|
||||
create_dirpath(tmpdir, sizeof(tmpdir), vmu->context, vmu->mailbox, "tmp");
|
||||
snprintf(newtmp, sizeof(newtmp), "%s/XXXXXX", tmpdir);
|
||||
tmpfd = mkstemp(newtmp);
|
||||
ast_log(LOG_DEBUG, "newtmp: %s\n", newtmp);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "newtmp: %s\n", newtmp);
|
||||
if (vmu->volgain < -.001 || vmu->volgain > .001) {
|
||||
snprintf(tmpcmd, sizeof(tmpcmd), "sox -v %.4f %s.%s %s.%s", vmu->volgain, attach, format, newtmp, format);
|
||||
ast_safe_system(tmpcmd);
|
||||
attach = newtmp;
|
||||
ast_log(LOG_DEBUG, "VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", attach, format, vmu->volgain, mailbox);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", attach, format, vmu->volgain, mailbox);
|
||||
}
|
||||
fprintf(p, "--%s\r\n", bound);
|
||||
fprintf(p, "Content-Type: %s%s; name=\"msg%04d.%s\"\r\n", ctype, format, msgnum, format);
|
||||
@@ -1998,7 +2000,8 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c
|
||||
}
|
||||
if (!strcmp(format, "wav49"))
|
||||
format = "WAV";
|
||||
ast_log(LOG_DEBUG, "Attaching file '%s', format '%s', uservm is '%d', global is %d\n", attach, format, attach_user_voicemail, ast_test_flag((&globalflags), VM_ATTACH));
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "Attaching file '%s', format '%s', uservm is '%d', global is %d\n", attach, format, attach_user_voicemail, ast_test_flag((&globalflags), VM_ATTACH));
|
||||
/* Make a temporary file instead of piping directly to sendmail, in case the mail
|
||||
command hangs */
|
||||
if ((p = vm_mkftemp(tmp)) == NULL) {
|
||||
@@ -2009,7 +2012,8 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c
|
||||
fclose(p);
|
||||
snprintf(tmp2, sizeof(tmp2), "( %s < %s ; rm -f %s ) &", mailcmd, tmp, tmp);
|
||||
ast_safe_system(tmp2);
|
||||
ast_log(LOG_DEBUG, "Sent mail to %s with command '%s'\n", vmu->email, mailcmd);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "Sent mail to %s with command '%s'\n", vmu->email, mailcmd);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -2092,7 +2096,8 @@ static int sendpage(char *srcemail, char *pager, int msgnum, char *context, char
|
||||
fclose(p);
|
||||
snprintf(tmp2, sizeof(tmp2), "( %s < %s ; rm -f %s ) &", mailcmd, tmp, tmp);
|
||||
ast_safe_system(tmp2);
|
||||
ast_log(LOG_DEBUG, "Sent page to %s with command '%s'\n", pager, mailcmd);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "Sent page to %s with command '%s'\n", pager, mailcmd);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -2764,14 +2769,16 @@ static void run_externnotify(char *context, char *extension)
|
||||
ast_log(LOG_WARNING, "The switch reported '%s'\n", mwi_msg->cause);
|
||||
ASTOBJ_UNREF(mwi_msg, ast_smdi_mwi_message_destroy);
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "Successfully executed SMDI MWI change for %s on %s\n", extension, smdi_iface->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Successfully executed SMDI MWI change for %s on %s\n", extension, smdi_iface->name);
|
||||
}
|
||||
} else if (!ast_strlen_zero(externnotify)) {
|
||||
if (inboxcount(ext_context, &newvoicemails, &oldvoicemails)) {
|
||||
ast_log(LOG_ERROR, "Problem in calculating number of voicemail messages available for extension %s\n", extension);
|
||||
} else {
|
||||
snprintf(arguments, sizeof(arguments), "%s %s %s %d&", externnotify, context, extension, newvoicemails);
|
||||
ast_log(LOG_DEBUG, "Executing %s\n", arguments);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Executing %s\n", arguments);
|
||||
ast_safe_system(arguments);
|
||||
}
|
||||
}
|
||||
@@ -2896,12 +2903,14 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_
|
||||
if (ast_streamfile(chan, prefile, chan->language) > -1)
|
||||
res = ast_waitstream(chan, ecodes);
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "%s doesn't exist, doing what we can\n", prefile);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "%s doesn't exist, doing what we can\n", prefile);
|
||||
res = invent_message(chan, vmu->context, ext, ast_test_flag(options, OPT_BUSY_GREETING), ecodes);
|
||||
}
|
||||
DISPOSE(prefile, -1);
|
||||
if (res < 0) {
|
||||
ast_log(LOG_DEBUG, "Hang up during prefile playback\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Hang up during prefile playback\n");
|
||||
free_user(vmu);
|
||||
pbx_builtin_setvar_helper(chan, "VMSTATUS", "FAILED");
|
||||
return -1;
|
||||
@@ -3351,7 +3360,8 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
|
||||
bytes += ast_adsi_voice_mode(buf + bytes, 0);
|
||||
ast_adsi_transmit_message(chan, buf, bytes, ADSI_MSG_DOWNLOAD);
|
||||
|
||||
ast_log(LOG_DEBUG, "Done downloading scripts...\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Done downloading scripts...\n");
|
||||
|
||||
#ifdef DISPLAY
|
||||
/* Add last dot */
|
||||
@@ -3359,7 +3369,8 @@ static int adsi_load_vmail(struct ast_channel *chan, int *useadsi)
|
||||
bytes += ast_adsi_display(buf + bytes, ADSI_COMM_PAGE, 4, ADSI_JUST_CENT, 0, " ......", "");
|
||||
bytes += ast_adsi_set_line(buf + bytes, ADSI_COMM_PAGE, 1);
|
||||
#endif
|
||||
ast_log(LOG_DEBUG, "Restarting session...\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Restarting session...\n");
|
||||
|
||||
bytes = 0;
|
||||
/* Load the session now */
|
||||
@@ -4252,13 +4263,15 @@ static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms,
|
||||
return res;
|
||||
|
||||
/* Strip off caller ID number from name */
|
||||
ast_log(LOG_DEBUG, "VM-CID: composite caller ID received: %s, context: %s\n", cid, context);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "VM-CID: composite caller ID received: %s, context: %s\n", cid, context);
|
||||
ast_callerid_parse(cid, &name, &callerid);
|
||||
if ((!ast_strlen_zero(callerid)) && strcmp(callerid, "Unknown")) {
|
||||
/* Check for internal contexts and only */
|
||||
/* say extension when the call didn't come from an internal context in the list */
|
||||
for (i = 0 ; i < MAX_NUM_CID_CONTEXTS ; i++){
|
||||
ast_log(LOG_DEBUG, "VM-CID: comparing internalcontext: %s\n", cidinternalcontexts[i]);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "VM-CID: comparing internalcontext: %s\n", cidinternalcontexts[i]);
|
||||
if ((strcmp(cidinternalcontexts[i], context) == 0))
|
||||
break;
|
||||
}
|
||||
@@ -4286,7 +4299,8 @@ static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms,
|
||||
}
|
||||
|
||||
else if (!res){
|
||||
ast_log(LOG_DEBUG, "VM-CID: Numeric caller id: (%s)\n",callerid);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "VM-CID: Numeric caller id: (%s)\n",callerid);
|
||||
/* BB: Since this is all nicely figured out, why not say "from phone number" in this case" */
|
||||
if (!callback)
|
||||
res = wait_file2(chan, vms, "vm-from-phonenumber");
|
||||
@@ -4294,7 +4308,8 @@ static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms,
|
||||
}
|
||||
} else {
|
||||
/* Number unknown */
|
||||
ast_log(LOG_DEBUG, "VM-CID: From an unknown number\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "VM-CID: From an unknown number\n");
|
||||
/* Say "from an unknown caller" as one phrase - it is already recorded by "the voice" anyhow */
|
||||
res = wait_file2(chan, vms, "vm-unknown-caller");
|
||||
}
|
||||
@@ -4314,7 +4329,8 @@ static int play_message_duration(struct ast_channel *chan, struct vm_state *vms,
|
||||
durations=atoi(duration);
|
||||
durationm=(durations / 60);
|
||||
|
||||
ast_log(LOG_DEBUG, "VM-Duration: duration is: %d seconds converted to: %d minutes\n", durations, durationm);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "VM-Duration: duration is: %d seconds converted to: %d minutes\n", durations, durationm);
|
||||
|
||||
if ((!res) && (durationm >= minduration)) {
|
||||
res = wait_file2(chan, vms, "vm-duration");
|
||||
@@ -4613,7 +4629,8 @@ static int init_mailstream(struct vm_state *vms, int box)
|
||||
if(option_debug > 2)
|
||||
ast_log (LOG_DEBUG,"vm_state user is:%s\n",vms->imapuser);
|
||||
if (vms->mailstream == NIL || !vms->mailstream) {
|
||||
ast_log (LOG_DEBUG,"mailstream not set.\n");
|
||||
if (option_debug)
|
||||
ast_log (LOG_DEBUG,"mailstream not set.\n");
|
||||
} else {
|
||||
stream = vms->mailstream;
|
||||
}
|
||||
@@ -5684,7 +5701,8 @@ static int vm_newuser(struct ast_channel *chan, struct ast_vm_user *vmu, struct
|
||||
vm_change_password(vmu,newpassword);
|
||||
else
|
||||
vm_change_password_shell(vmu,newpassword);
|
||||
ast_log(LOG_DEBUG,"User %s set password to %s of length %d\n",vms->username,newpassword,(int)strlen(newpassword));
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG,"User %s set password to %s of length %d\n",vms->username,newpassword,(int)strlen(newpassword));
|
||||
cmd = ast_play_and_wait(chan,"vm-passchanged");
|
||||
|
||||
/* If forcename is set, have the user record their name */
|
||||
@@ -5786,7 +5804,8 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct
|
||||
vm_change_password(vmu,newpassword);
|
||||
else
|
||||
vm_change_password_shell(vmu,newpassword);
|
||||
ast_log(LOG_DEBUG,"User %s set password to %s of length %d\n",vms->username,newpassword,(int)strlen(newpassword));
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG,"User %s set password to %s of length %d\n",vms->username,newpassword,(int)strlen(newpassword));
|
||||
cmd = ast_play_and_wait(chan,"vm-passchanged");
|
||||
break;
|
||||
case '*':
|
||||
@@ -6037,7 +6056,8 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_
|
||||
ast_copy_string(mailbox, fullusername, mailbox_size);
|
||||
}
|
||||
|
||||
ast_log(LOG_DEBUG, "Before find user for mailbox %s\n",mailbox);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Before find user for mailbox %s\n",mailbox);
|
||||
vmu = find_user(&vmus, context, mailbox);
|
||||
if (vmu && (vmu->password[0] == '\0' || (vmu->password[0] == '-' && vmu->password[1] == '\0'))) {
|
||||
/* saved password is blank, so don't bother asking */
|
||||
@@ -6129,7 +6149,8 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
memset(&vmus, 0, sizeof(vmus));
|
||||
|
||||
if (chan->_state != AST_STATE_UP) {
|
||||
ast_log(LOG_DEBUG, "Before ast_answer\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Before ast_answer\n");
|
||||
ast_answer(chan);
|
||||
}
|
||||
|
||||
@@ -6211,7 +6232,8 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
if (!valid)
|
||||
res = vm_authenticate(chan, vms.username, sizeof(vms.username), &vmus, context, prefixstr, skipuser, maxlogins, 0);
|
||||
|
||||
ast_log(LOG_DEBUG, "After vm_authenticate\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "After vm_authenticate\n");
|
||||
if (!res) {
|
||||
valid = 1;
|
||||
if (!skipuser)
|
||||
@@ -6246,18 +6268,21 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
create_dirpath(vms.curdir, sizeof(vms.curdir), vmu->context, vms.username, "");
|
||||
#endif
|
||||
/* Retrieve old and new message counts */
|
||||
ast_log(LOG_DEBUG, "Before open_mailbox\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Before open_mailbox\n");
|
||||
res = open_mailbox(&vms, vmu, 1);
|
||||
if (res == ERROR_LOCK_PATH)
|
||||
goto out;
|
||||
vms.oldmessages = vms.lastmsg + 1;
|
||||
ast_log(LOG_DEBUG, "Number of old messages: %d\n",vms.oldmessages);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "Number of old messages: %d\n",vms.oldmessages);
|
||||
/* Start in INBOX */
|
||||
res = open_mailbox(&vms, vmu, 0);
|
||||
if (res == ERROR_LOCK_PATH)
|
||||
goto out;
|
||||
vms.newmessages = vms.lastmsg + 1;
|
||||
ast_log(LOG_DEBUG, "Number of new messages: %d\n",vms.newmessages);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "Number of new messages: %d\n",vms.newmessages);
|
||||
|
||||
/* Select proper mailbox FIRST!! */
|
||||
if (play_auto) {
|
||||
@@ -6304,7 +6329,8 @@ static int vm_execmain(struct ast_channel *chan, void *data)
|
||||
if(option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "Checking quotas: comparing %u to %u\n",vms.quota_usage,vms.quota_limit);
|
||||
if (vms.quota_limit && vms.quota_usage >= vms.quota_limit) {
|
||||
ast_log(LOG_DEBUG, "*** QUOTA EXCEEDED!!\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "*** QUOTA EXCEEDED!!\n");
|
||||
cmd = ast_play_and_wait(chan, "vm-mailboxfull");
|
||||
}
|
||||
#endif
|
||||
@@ -7154,13 +7180,16 @@ static int load_config(void)
|
||||
|
||||
if ((notifystr = ast_variable_retrieve(cfg, "general", "externnotify"))) {
|
||||
ast_copy_string(externnotify, notifystr, sizeof(externnotify));
|
||||
ast_log(LOG_DEBUG, "found externnotify: %s\n", externnotify);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "found externnotify: %s\n", externnotify);
|
||||
if (!strcasecmp(externnotify, "smdi")) {
|
||||
ast_log(LOG_DEBUG, "Using SMDI for external voicemail notification\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Using SMDI for external voicemail notification\n");
|
||||
if ((smdistr = ast_variable_retrieve(cfg, "general", "smdiport"))) {
|
||||
smdi_iface = ast_smdi_interface_find(smdistr);
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "No SMDI interface set, trying default (/dev/ttyS0)\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "No SMDI interface set, trying default (/dev/ttyS0)\n");
|
||||
smdi_iface = ast_smdi_interface_find("/dev/ttyS0");
|
||||
}
|
||||
|
||||
@@ -7168,7 +7197,8 @@ static int load_config(void)
|
||||
ast_log(LOG_ERROR, "No valid SMDI interface specfied, disabling external voicemail notification\n");
|
||||
externnotify[0] = '\0';
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "Using SMDI port %s\n", smdi_iface->name);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG, "Using SMDI port %s\n", smdi_iface->name);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -7245,7 +7275,8 @@ static int load_config(void)
|
||||
ast_set2_flag((&globalflags), ast_true(astforcegreet), VM_FORCEGREET);
|
||||
|
||||
if ((s = ast_variable_retrieve(cfg, "general", "cidinternalcontexts"))){
|
||||
ast_log(LOG_DEBUG,"VM_CID Internal context string: %s\n",s);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG,"VM_CID Internal context string: %s\n",s);
|
||||
stringp = ast_strdupa(s);
|
||||
for (x = 0 ; x < MAX_NUM_CID_CONTEXTS ; x++){
|
||||
if (!ast_strlen_zero(stringp)) {
|
||||
@@ -7253,53 +7284,62 @@ static int load_config(void)
|
||||
while ((*q == ' ')||(*q == '\t')) /* Eat white space between contexts */
|
||||
q++;
|
||||
ast_copy_string(cidinternalcontexts[x], q, sizeof(cidinternalcontexts[x]));
|
||||
ast_log(LOG_DEBUG,"VM_CID Internal context %d: %s\n", x, cidinternalcontexts[x]);
|
||||
if (option_debug > 2)
|
||||
ast_log(LOG_DEBUG,"VM_CID Internal context %d: %s\n", x, cidinternalcontexts[x]);
|
||||
} else {
|
||||
cidinternalcontexts[x][0] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!(astreview = ast_variable_retrieve(cfg, "general", "review"))){
|
||||
ast_log(LOG_DEBUG,"VM Review Option disabled globally\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG,"VM Review Option disabled globally\n");
|
||||
astreview = "no";
|
||||
}
|
||||
ast_set2_flag((&globalflags), ast_true(astreview), VM_REVIEW);
|
||||
|
||||
/*Temperary greeting reminder */
|
||||
if (!(asttempgreetwarn = ast_variable_retrieve(cfg, "general", "tempgreetwarn"))) {
|
||||
ast_log(LOG_DEBUG, "VM Temperary Greeting Reminder Option disabled globally\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "VM Temperary Greeting Reminder Option disabled globally\n");
|
||||
asttempgreetwarn = "no";
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "VM Temperary Greeting Reminder Option enabled globally\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "VM Temperary Greeting Reminder Option enabled globally\n");
|
||||
}
|
||||
ast_set2_flag((&globalflags), ast_true(asttempgreetwarn), VM_TEMPGREETWARN);
|
||||
|
||||
if (!(astcallop = ast_variable_retrieve(cfg, "general", "operator"))){
|
||||
ast_log(LOG_DEBUG,"VM Operator break disabled globally\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG,"VM Operator break disabled globally\n");
|
||||
astcallop = "no";
|
||||
}
|
||||
ast_set2_flag((&globalflags), ast_true(astcallop), VM_OPERATOR);
|
||||
|
||||
if (!(astsaycid = ast_variable_retrieve(cfg, "general", "saycid"))) {
|
||||
ast_log(LOG_DEBUG,"VM CID Info before msg disabled globally\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG,"VM CID Info before msg disabled globally\n");
|
||||
astsaycid = "no";
|
||||
}
|
||||
ast_set2_flag((&globalflags), ast_true(astsaycid), VM_SAYCID);
|
||||
|
||||
if (!(send_voicemail = ast_variable_retrieve(cfg,"general", "sendvoicemail"))){
|
||||
ast_log(LOG_DEBUG,"Send Voicemail msg disabled globally\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG,"Send Voicemail msg disabled globally\n");
|
||||
send_voicemail = "no";
|
||||
}
|
||||
ast_set2_flag((&globalflags), ast_true(send_voicemail), VM_SVMAIL);
|
||||
|
||||
if (!(asthearenv = ast_variable_retrieve(cfg, "general", "envelope"))) {
|
||||
ast_log(LOG_DEBUG,"ENVELOPE before msg enabled globally\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG,"ENVELOPE before msg enabled globally\n");
|
||||
asthearenv = "yes";
|
||||
}
|
||||
ast_set2_flag((&globalflags), ast_true(asthearenv), VM_ENVELOPE);
|
||||
|
||||
if (!(astsaydurationinfo = ast_variable_retrieve(cfg, "general", "sayduration"))) {
|
||||
ast_log(LOG_DEBUG,"Duration info before msg enabled globally\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG,"Duration info before msg enabled globally\n");
|
||||
astsaydurationinfo = "yes";
|
||||
}
|
||||
ast_set2_flag((&globalflags), ast_true(astsaydurationinfo), VM_SAYDURATION);
|
||||
@@ -7314,28 +7354,32 @@ static int load_config(void)
|
||||
}
|
||||
|
||||
if (!(astskipcmd = ast_variable_retrieve(cfg, "general", "nextaftercmd"))) {
|
||||
ast_log(LOG_DEBUG,"We are not going to skip to the next msg after save/delete\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG,"We are not going to skip to the next msg after save/delete\n");
|
||||
astskipcmd = "no";
|
||||
}
|
||||
ast_set2_flag((&globalflags), ast_true(astskipcmd), VM_SKIPAFTERCMD);
|
||||
|
||||
if ((dialoutcxt = ast_variable_retrieve(cfg, "general", "dialout"))) {
|
||||
ast_copy_string(dialcontext, dialoutcxt, sizeof(dialcontext));
|
||||
ast_log(LOG_DEBUG, "found dialout context: %s\n", dialcontext);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "found dialout context: %s\n", dialcontext);
|
||||
} else {
|
||||
dialcontext[0] = '\0';
|
||||
}
|
||||
|
||||
if ((callbackcxt = ast_variable_retrieve(cfg, "general", "callback"))) {
|
||||
ast_copy_string(callcontext, callbackcxt, sizeof(callcontext));
|
||||
ast_log(LOG_DEBUG, "found callback context: %s\n", callcontext);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "found callback context: %s\n", callcontext);
|
||||
} else {
|
||||
callcontext[0] = '\0';
|
||||
}
|
||||
|
||||
if ((exitcxt = ast_variable_retrieve(cfg, "general", "exitcontext"))) {
|
||||
ast_copy_string(exitcontext, exitcxt, sizeof(exitcontext));
|
||||
ast_log(LOG_DEBUG, "found operator context: %s\n", exitcontext);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "found operator context: %s\n", exitcontext);
|
||||
} else {
|
||||
exitcontext[0] = '\0';
|
||||
}
|
||||
|
@@ -35,6 +35,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
||||
#include <regex.h>
|
||||
|
||||
#include "asterisk/module.h"
|
||||
#include "asterisk/options.h"
|
||||
#include "asterisk/channel.h"
|
||||
#include "asterisk/pbx.h"
|
||||
#include "asterisk/logger.h"
|
||||
@@ -126,7 +127,8 @@ static int regex(struct ast_channel *chan, char *cmd, char *parse, char *buf,
|
||||
if ((*args.str == ' ') || (*args.str == '\t'))
|
||||
args.str++;
|
||||
|
||||
ast_log(LOG_DEBUG, "FUNCTION REGEX (%s)(%s)\n", args.reg, args.str);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "FUNCTION REGEX (%s)(%s)\n", args.reg, args.str);
|
||||
|
||||
if ((errcode = regcomp(®exbuf, args.reg, REG_EXTENDED | REG_NOSUB))) {
|
||||
regerror(errcode, ®exbuf, buf, len);
|
||||
@@ -175,7 +177,8 @@ static int array(struct ast_channel *chan, char *cmd, char *var,
|
||||
* want them to be surprised by the result. Hence, we prefer commas as the
|
||||
* delimiter, but we'll fall back to vertical bars if commas aren't found.
|
||||
*/
|
||||
ast_log(LOG_DEBUG, "array (%s=%s)\n", var, value2);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "array (%s=%s)\n", var, value2);
|
||||
if (strchr(var, ','))
|
||||
AST_NONSTANDARD_APP_ARGS(arg1, var, ',');
|
||||
else
|
||||
@@ -187,8 +190,9 @@ static int array(struct ast_channel *chan, char *cmd, char *var,
|
||||
AST_STANDARD_APP_ARGS(arg2, value2);
|
||||
|
||||
for (i = 0; i < arg1.argc; i++) {
|
||||
ast_log(LOG_DEBUG, "array set value (%s=%s)\n", arg1.var[i],
|
||||
arg2.val[i]);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "array set value (%s=%s)\n", arg1.var[i],
|
||||
arg2.val[i]);
|
||||
if (i < arg2.argc) {
|
||||
pbx_builtin_setvar_helper(chan, arg1.var[i], arg2.val[i]);
|
||||
} else {
|
||||
|
42
main/app.c
42
main/app.c
@@ -420,7 +420,8 @@ int ast_control_streamfile(struct ast_channel *chan, const char *file,
|
||||
|
||||
/* We go at next loop if we got the restart char */
|
||||
if (restart && strchr(restart, res)) {
|
||||
ast_log(LOG_DEBUG, "we'll restart the stream here at next loop\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "we'll restart the stream here at next loop\n");
|
||||
pause_restart_point = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -512,7 +513,8 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
|
||||
return -1;
|
||||
}
|
||||
|
||||
ast_log(LOG_DEBUG,"play_and_record: %s, %s, '%s'\n", playfile ? playfile : "<None>", recordfile, fmt);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG,"play_and_record: %s, %s, '%s'\n", playfile ? playfile : "<None>", recordfile, fmt);
|
||||
snprintf(comment, sizeof(comment), "Playing %s, Recording to: %s on %s\n", playfile ? playfile : "<None>", recordfile, chan->name);
|
||||
|
||||
if (playfile || beep) {
|
||||
@@ -533,7 +535,8 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
|
||||
|
||||
stringp = fmts;
|
||||
strsep(&stringp, "|");
|
||||
ast_log(LOG_DEBUG, "Recording Formats: sfmts=%s\n", fmts);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Recording Formats: sfmts=%s\n", fmts);
|
||||
sfmt[0] = ast_strdupa(fmts);
|
||||
|
||||
while ((fmt = strsep(&stringp, "|"))) {
|
||||
@@ -588,7 +591,8 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile,
|
||||
for (;;) {
|
||||
res = ast_waitfor(chan, 2000);
|
||||
if (!res) {
|
||||
ast_log(LOG_DEBUG, "One waitfor failed, trying another\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "One waitfor failed, trying another\n");
|
||||
/* Try one more time in case of masq */
|
||||
res = ast_waitfor(chan, 2000);
|
||||
if (!res) {
|
||||
@@ -935,7 +939,8 @@ enum AST_LOCK_RESULT ast_lock_path(const char *path)
|
||||
ast_log(LOG_WARNING, "Failed to lock path '%s': %s\n", path, strerror(errno));
|
||||
return AST_LOCK_TIMEOUT;
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "Locked path '%s'\n", path);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Locked path '%s'\n", path);
|
||||
return AST_LOCK_SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -954,8 +959,10 @@ int ast_unlock_path(const char *path)
|
||||
|
||||
if ((res = unlink(s)))
|
||||
ast_log(LOG_ERROR, "Could not unlock path '%s': %s\n", path, strerror(errno));
|
||||
else
|
||||
ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path);
|
||||
else {
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Unlocked path '%s'\n", path);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -1185,7 +1192,8 @@ static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_me
|
||||
while(menu->options[pos].option) {
|
||||
if (!strcasecmp(menu->options[pos].option, exten)) {
|
||||
res = ivr_dispatch(chan, menu->options + pos, exten, cbdata);
|
||||
ast_log(LOG_DEBUG, "IVR Dispatch of '%s' (pos %d) yields %d\n", exten, pos, res);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "IVR Dispatch of '%s' (pos %d) yields %d\n", exten, pos, res);
|
||||
if (res < 0)
|
||||
break;
|
||||
else if (res & RES_UPONE)
|
||||
@@ -1201,7 +1209,8 @@ static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_me
|
||||
if (!maxretries)
|
||||
maxretries = 3;
|
||||
if ((maxretries > 0) && (retries >= maxretries)) {
|
||||
ast_log(LOG_DEBUG, "Max retries %d exceeded\n", maxretries);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Max retries %d exceeded\n", maxretries);
|
||||
return -2;
|
||||
} else {
|
||||
if (option_exists(menu, "g") > -1)
|
||||
@@ -1212,24 +1221,28 @@ static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_me
|
||||
pos = 0;
|
||||
continue;
|
||||
} else if (res && strchr(AST_DIGIT_ANY, res)) {
|
||||
ast_log(LOG_DEBUG, "Got start of extension, %c\n", res);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Got start of extension, %c\n", res);
|
||||
exten[1] = '\0';
|
||||
exten[0] = res;
|
||||
if ((res = read_newoption(chan, menu, exten, sizeof(exten))))
|
||||
break;
|
||||
if (option_exists(menu, exten) < 0) {
|
||||
if (option_exists(menu, "i")) {
|
||||
ast_log(LOG_DEBUG, "Invalid extension entered, going to 'i'!\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Invalid extension entered, going to 'i'!\n");
|
||||
strcpy(exten, "i");
|
||||
pos = 0;
|
||||
continue;
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "Aborting on invalid entry, with no 'i' option!\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Aborting on invalid entry, with no 'i' option!\n");
|
||||
res = -2;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "New existing extension: %s\n", exten);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "New existing extension: %s\n", exten);
|
||||
pos = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -1237,7 +1250,8 @@ static int ast_ivr_menu_run_internal(struct ast_channel *chan, struct ast_ivr_me
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
ast_log(LOG_DEBUG, "Stopping option '%s', res is %d\n", exten, res);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Stopping option '%s', res is %d\n", exten, res);
|
||||
pos = 0;
|
||||
if (!strcasecmp(exten, "s"))
|
||||
strcpy(exten, "g");
|
||||
|
100
main/channel.c
100
main/channel.c
@@ -878,7 +878,8 @@ int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin)
|
||||
ast_log(LOG_WARNING, "Exceptionally long queue length queuing to %s\n", chan->name);
|
||||
CRASH;
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "Dropping voice to exceptionally long queue on %s\n", chan->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Dropping voice to exceptionally long queue on %s\n", chan->name);
|
||||
ast_frfree(f);
|
||||
ast_channel_unlock(chan);
|
||||
return 0;
|
||||
@@ -1015,7 +1016,8 @@ static struct ast_channel *channel_find_locked(const struct ast_channel *prev,
|
||||
/* this is slightly unsafe, as we _should_ hold the lock to access c->name */
|
||||
done = c == NULL || ast_channel_trylock(c) == 0;
|
||||
if (!done)
|
||||
ast_log(LOG_DEBUG, "Avoiding %s for channel '%p'\n", msg, c);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Avoiding %s for channel '%p'\n", msg, c);
|
||||
AST_LIST_UNLOCK(&channels);
|
||||
if (done)
|
||||
return c;
|
||||
@@ -1025,8 +1027,9 @@ static struct ast_channel *channel_find_locked(const struct ast_channel *prev,
|
||||
* c is surely not null, but we don't have the lock so cannot
|
||||
* access c->name
|
||||
*/
|
||||
ast_log(LOG_DEBUG, "Failure, could not lock '%p' after %d retries!\n",
|
||||
c, retries);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Failure, could not lock '%p' after %d retries!\n",
|
||||
c, retries);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -1335,8 +1338,9 @@ int ast_channel_spy_add(struct ast_channel *chan, struct ast_channel_spy *spy)
|
||||
ast_clear_flag(spy, CHANSPY_TRIGGER_WRITE);
|
||||
}
|
||||
|
||||
ast_log(LOG_DEBUG, "Spy %s added to channel %s\n",
|
||||
spy->type, chan->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Spy %s added to channel %s\n",
|
||||
spy->type, chan->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1371,7 +1375,8 @@ static void spy_detach(struct ast_channel_spy *spy, struct ast_channel *chan)
|
||||
}
|
||||
|
||||
/* Print it out while we still have a lock so the structure can't go away (if signalled above) */
|
||||
ast_log(LOG_DEBUG, "Spy %s removed from channel %s\n", spy->type, chan->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Spy %s removed from channel %s\n", spy->type, chan->name);
|
||||
|
||||
ast_mutex_unlock(&spy->lock);
|
||||
|
||||
@@ -1516,8 +1521,9 @@ static void queue_frame_to_spies(struct ast_channel *chan, struct ast_frame *f,
|
||||
trans->path = NULL;
|
||||
}
|
||||
if (!trans->path) {
|
||||
ast_log(LOG_DEBUG, "Building translator from %s to SLINEAR for spies on channel %s\n",
|
||||
ast_getformatname(f->subclass), chan->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Building translator from %s to SLINEAR for spies on channel %s\n",
|
||||
ast_getformatname(f->subclass), chan->name);
|
||||
if ((trans->path = ast_translator_build_path(AST_FORMAT_SLINEAR, f->subclass)) == NULL) {
|
||||
ast_log(LOG_WARNING, "Cannot build a path from %s to %s\n",
|
||||
ast_getformatname(f->subclass), ast_getformatname(AST_FORMAT_SLINEAR));
|
||||
@@ -1761,7 +1767,8 @@ static int generator_force(void *data)
|
||||
res = generate(chan, tmp, 0, 160);
|
||||
chan->generatordata = tmp;
|
||||
if (res) {
|
||||
ast_log(LOG_DEBUG, "Auto-deactivating generator\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Auto-deactivating generator\n");
|
||||
ast_deactivate_generator(chan);
|
||||
}
|
||||
return 0;
|
||||
@@ -1980,7 +1987,8 @@ int ast_settimeout(struct ast_channel *c, int samples, int (*func)(void *data),
|
||||
samples = 0;
|
||||
data = 0;
|
||||
}
|
||||
ast_log(LOG_DEBUG, "Scheduling timer at %d sample intervals\n", samples);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Scheduling timer at %d sample intervals\n", samples);
|
||||
res = ioctl(c->timingfd, ZT_TIMERCONFIG, &samples);
|
||||
c->timingfunc = func;
|
||||
c->timingdata = data;
|
||||
@@ -2185,11 +2193,13 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
|
||||
case AST_FRAME_CONTROL:
|
||||
if (f->subclass == AST_CONTROL_ANSWER) {
|
||||
if (!ast_test_flag(chan, AST_FLAG_OUTGOING)) {
|
||||
ast_log(LOG_DEBUG, "Ignoring answer on an inbound call!\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Ignoring answer on an inbound call!\n");
|
||||
ast_frfree(f);
|
||||
f = &ast_null_frame;
|
||||
} else if (prestate == AST_STATE_UP) {
|
||||
ast_log(LOG_DEBUG, "Dropping duplicate answer!\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Dropping duplicate answer!\n");
|
||||
ast_frfree(f);
|
||||
f = &ast_null_frame;
|
||||
} else {
|
||||
@@ -2399,7 +2409,8 @@ int ast_indicate_data(struct ast_channel *chan, int condition, const void *data,
|
||||
break;
|
||||
}
|
||||
if (ts && ts->data[0]) {
|
||||
ast_log(LOG_DEBUG, "Driver for channel '%s' does not support indication %d, emulating it\n", chan->name, condition);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Driver for channel '%s' does not support indication %d, emulating it\n", chan->name, condition);
|
||||
ast_playtones_start(chan,0,ts->data, 1);
|
||||
res = 0;
|
||||
} else if (condition == AST_CONTROL_PROGRESS) {
|
||||
@@ -2512,7 +2523,8 @@ int ast_senddigit_begin(struct ast_channel *chan, char digit)
|
||||
ast_playtones_start(chan, 0, dtmf_tones[15], 0);
|
||||
else {
|
||||
/* not handled */
|
||||
ast_log(LOG_DEBUG, "Unable to generate DTMF tone '%c' for '%s'\n", digit, chan->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Unable to generate DTMF tone '%c' for '%s'\n", digit, chan->name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2548,7 +2560,8 @@ int ast_prod(struct ast_channel *chan)
|
||||
|
||||
/* Send an empty audio frame to get things moving */
|
||||
if (chan->_state != AST_STATE_UP) {
|
||||
ast_log(LOG_DEBUG, "Prodding channel '%s'\n", chan->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Prodding channel '%s'\n", chan->name);
|
||||
a.subclass = chan->rawwriteformat;
|
||||
a.data = nothing + AST_FRIENDLY_OFFSET;
|
||||
a.src = "ast_prod";
|
||||
@@ -3193,8 +3206,9 @@ int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clo
|
||||
return -1;
|
||||
}
|
||||
|
||||
ast_log(LOG_DEBUG, "Planning to masquerade channel %s into the structure of %s\n",
|
||||
clone->name, original->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Planning to masquerade channel %s into the structure of %s\n",
|
||||
clone->name, original->name);
|
||||
if (original->masq) {
|
||||
ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
|
||||
original->masq->name, original->name);
|
||||
@@ -3206,7 +3220,8 @@ int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clo
|
||||
clone->masqr = original;
|
||||
ast_queue_frame(original, &ast_null_frame);
|
||||
ast_queue_frame(clone, &ast_null_frame);
|
||||
ast_log(LOG_DEBUG, "Done planning to masquerade channel %s into the structure of %s\n", clone->name, original->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Done planning to masquerade channel %s into the structure of %s\n", clone->name, original->name);
|
||||
res = 0;
|
||||
}
|
||||
|
||||
@@ -3565,7 +3580,8 @@ int ast_do_masquerade(struct ast_channel *original)
|
||||
);
|
||||
ast_channel_free(clone);
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "Released clone lock on '%s'\n", clone->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Released clone lock on '%s'\n", clone->name);
|
||||
ast_set_flag(clone, AST_FLAG_ZOMBIE);
|
||||
ast_queue_frame(clone, &ast_null_frame);
|
||||
ast_channel_unlock(clone);
|
||||
@@ -3756,7 +3772,8 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
|
||||
if (!f) {
|
||||
*fo = NULL;
|
||||
*rc = who;
|
||||
ast_log(LOG_DEBUG, "Didn't get a frame from channel: %s\n",who->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Didn't get a frame from channel: %s\n",who->name);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3778,7 +3795,8 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
|
||||
*fo = f;
|
||||
*rc = who;
|
||||
bridge_exit = 1;
|
||||
ast_log(LOG_DEBUG, "Got a FRAME_CONTROL (%d) frame on channel %s\n", f->subclass, who->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Got a FRAME_CONTROL (%d) frame on channel %s\n", f->subclass, who->name);
|
||||
break;
|
||||
}
|
||||
if (bridge_exit)
|
||||
@@ -3800,9 +3818,10 @@ static enum ast_bridge_result ast_generic_bridge(struct ast_channel *c0, struct
|
||||
f->frametype == AST_FRAME_DTMF_BEGIN)) {
|
||||
*fo = f;
|
||||
*rc = who;
|
||||
ast_log(LOG_DEBUG, "Got DTMF %s on channel (%s)\n",
|
||||
f->frametype == AST_FRAME_DTMF_END ? "end" : "begin",
|
||||
who->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Got DTMF %s on channel (%s)\n",
|
||||
f->frametype == AST_FRAME_DTMF_END ? "end" : "begin",
|
||||
who->name);
|
||||
break;
|
||||
}
|
||||
/* Write immediately frames, not passed through jb */
|
||||
@@ -3955,7 +3974,8 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
|
||||
c1->_softhangup = 0;
|
||||
c0->_bridge = c1;
|
||||
c1->_bridge = c0;
|
||||
ast_log(LOG_DEBUG, "Unbridge signal received. Ending native bridge.\n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Unbridge signal received. Ending native bridge.\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3966,12 +3986,13 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
|
||||
if (who)
|
||||
*rc = who;
|
||||
res = 0;
|
||||
ast_log(LOG_DEBUG, "Bridge stops because we're zombie or need a soft hangup: c0=%s, c1=%s, flags: %s,%s,%s,%s\n",
|
||||
c0->name, c1->name,
|
||||
ast_test_flag(c0, AST_FLAG_ZOMBIE) ? "Yes" : "No",
|
||||
ast_check_hangup(c0) ? "Yes" : "No",
|
||||
ast_test_flag(c1, AST_FLAG_ZOMBIE) ? "Yes" : "No",
|
||||
ast_check_hangup(c1) ? "Yes" : "No");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Bridge stops because we're zombie or need a soft hangup: c0=%s, c1=%s, flags: %s,%s,%s,%s\n",
|
||||
c0->name, c1->name,
|
||||
ast_test_flag(c0, AST_FLAG_ZOMBIE) ? "Yes" : "No",
|
||||
ast_check_hangup(c0) ? "Yes" : "No",
|
||||
ast_test_flag(c1, AST_FLAG_ZOMBIE) ? "Yes" : "No",
|
||||
ast_check_hangup(c1) ? "Yes" : "No");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -3994,7 +4015,8 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
|
||||
"CallerID1: %s\r\n"
|
||||
"CallerID2: %s\r\n",
|
||||
c0->name, c1->name, c0->uniqueid, c1->uniqueid, c0->cid.cid_num, c1->cid.cid_num);
|
||||
ast_log(LOG_DEBUG, "Returning from native bridge, channels: %s, %s\n", c0->name, c1->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Returning from native bridge, channels: %s, %s\n", c0->name, c1->name);
|
||||
|
||||
ast_clear_flag(c0, AST_FLAG_NBRIDGE);
|
||||
ast_clear_flag(c1, AST_FLAG_NBRIDGE);
|
||||
@@ -4060,7 +4082,8 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
|
||||
"CallerID1: %s\r\n"
|
||||
"CallerID2: %s\r\n",
|
||||
c0->name, c1->name, c0->uniqueid, c1->uniqueid, c0->cid.cid_num, c1->cid.cid_num);
|
||||
ast_log(LOG_DEBUG, "Bridge stops bridging channels %s and %s\n", c0->name, c1->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "Bridge stops bridging channels %s and %s\n", c0->name, c1->name);
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -4585,7 +4608,8 @@ int ast_channel_unlock(struct ast_channel *chan)
|
||||
ast_log(LOG_DEBUG, "::::==== Unlocking AST channel %s\n", chan->name);
|
||||
|
||||
if (!chan) {
|
||||
ast_log(LOG_DEBUG, "::::==== Unlocking non-existing channel \n");
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "::::==== Unlocking non-existing channel \n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4598,9 +4622,11 @@ int ast_channel_unlock(struct ast_channel *chan)
|
||||
ast_log(LOG_DEBUG, ":::=== Still have %d locks (recursive)\n", count);
|
||||
#endif
|
||||
if (!res)
|
||||
ast_log(LOG_DEBUG, "::::==== Channel %s was unlocked\n", chan->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "::::==== Channel %s was unlocked\n", chan->name);
|
||||
if (res == EINVAL) {
|
||||
ast_log(LOG_DEBUG, "::::==== Channel %s had no lock by this thread. Failed unlocking\n", chan->name);
|
||||
if (option_debug)
|
||||
ast_log(LOG_DEBUG, "::::==== Channel %s had no lock by this thread. Failed unlocking\n", chan->name);
|
||||
}
|
||||
}
|
||||
if (res == EPERM) {
|
||||
|
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