diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_fax.c | 30 | ||||
-rw-r--r-- | apps/app_meetme.c | 144 | ||||
-rw-r--r-- | apps/app_rpt.c | 6 | ||||
-rw-r--r-- | apps/app_voicemail.c | 147 |
4 files changed, 158 insertions, 169 deletions
diff --git a/apps/app_fax.c b/apps/app_fax.c index ce8541910..39c6ad1b6 100644 --- a/apps/app_fax.c +++ b/apps/app_fax.c @@ -17,7 +17,7 @@ <depend>spandsp</depend> <conflict>res_fax</conflict> ***/ - + #include "asterisk.h" ASTERISK_FILE_VERSION(__FILE__, "$Revision$") @@ -172,7 +172,7 @@ static void span_message(int level, const char *msg) } else if (level == SPAN_LOG_WARNING) { ast_log(LOG_WARNING, "%s", msg); } else { - ast_log(LOG_DEBUG, "%s", msg); + ast_debug(1, "%s", msg); } } @@ -224,13 +224,13 @@ static void phase_e_handler(t30_state_t *f, void *user_data, int result) return; } - - s->finished = 1; - + + s->finished = 1; + local_ident = S_OR(t30_get_tx_ident(f), ""); far_ident = S_OR(t30_get_rx_ident(f), ""); - pbx_builtin_setvar_helper(s->chan, "FAXSTATUS", "SUCCESS"); - pbx_builtin_setvar_helper(s->chan, "FAXERROR", NULL); + pbx_builtin_setvar_helper(s->chan, "FAXSTATUS", "SUCCESS"); + pbx_builtin_setvar_helper(s->chan, "FAXERROR", NULL); pbx_builtin_setvar_helper(s->chan, "REMOTESTATIONID", far_ident); #if SPANDSP_RELEASE_DATE >= 20090220 pages_transferred = (s->direction) ? stat.pages_tx : stat.pages_rx; @@ -242,14 +242,14 @@ static void phase_e_handler(t30_state_t *f, void *user_data, int result) snprintf(buf, sizeof(buf), "%d", stat.y_resolution); pbx_builtin_setvar_helper(s->chan, "FAXRESOLUTION", buf); snprintf(buf, sizeof(buf), "%d", stat.bit_rate); - pbx_builtin_setvar_helper(s->chan, "FAXBITRATE", buf); - + pbx_builtin_setvar_helper(s->chan, "FAXBITRATE", buf); + ast_debug(1, "Fax transmitted successfully.\n"); ast_debug(1, " Remote station ID: %s\n", far_ident); ast_debug(1, " Pages transferred: %d\n", pages_transferred); ast_debug(1, " Image resolution: %d x %d\n", stat.x_resolution, stat.y_resolution); ast_debug(1, " Transfer Rate: %d\n", stat.bit_rate); - + ast_manager_event(s->chan, EVENT_FLAG_CALL, s->direction ? "FaxSent" : "FaxReceived", "Channel: %s\r\n" @@ -400,7 +400,7 @@ static int transmit_audio(fax_session *s) /* wait up to five seconds for negotiation to complete */ unsigned int timeout = 5000; int ms; - + ast_debug(1, "Negotiating T.38 for receive on %s\n", s->chan->name); while (timeout > 0) { ms = ast_waitfor(s->chan, 1000); @@ -425,7 +425,7 @@ static int transmit_audio(fax_session *s) (inf->subclass.integer == AST_CONTROL_T38_PARAMETERS) && (inf->datalen == sizeof(t38_parameters))) { struct ast_control_t38_parameters *parameters = inf->data.ptr; - + switch (parameters->request_response) { case AST_T38_NEGOTIATED: ast_debug(1, "Negotiated T.38 for receive on %s\n", s->chan->name); @@ -670,7 +670,7 @@ static int transmit_t38(fax_session *s) res = -1; break; } - + t38_terminal_send_timeout(&t38, ast_tvdiff_us(now, last_frame) / (1000000 / 8000)); if (!res) { @@ -727,7 +727,7 @@ disable_t38: /* wait up to five seconds for negotiation to complete */ unsigned int timeout = 5000; int ms; - + ast_debug(1, "Shutting down T.38 on %s\n", s->chan->name); while (timeout > 0) { ms = ast_waitfor(s->chan, 1000); @@ -752,7 +752,7 @@ disable_t38: (inf->subclass.integer == AST_CONTROL_T38_PARAMETERS) && (inf->datalen == sizeof(t38_parameters))) { struct ast_control_t38_parameters *parameters = inf->data.ptr; - + switch (parameters->request_response) { case AST_T38_TERMINATED: ast_debug(1, "Shut down T.38 on %s\n", s->chan->name); diff --git a/apps/app_meetme.c b/apps/app_meetme.c index ae60cfb90..edf987ef3 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -2051,7 +2051,7 @@ static int rt_extend_conf(const char *confno) static void conf_start_moh(struct ast_channel *chan, const char *musicclass) { - char *original_moh; + char *original_moh; ast_channel_lock(chan); original_moh = ast_strdupa(chan->musicclass); @@ -2106,7 +2106,7 @@ static void *announce_thread(void *data) } for (res = 1; !conf->announcethread_stop && (current = AST_LIST_REMOVE_HEAD(&local_list, entry)); ao2_ref(current, -1)) { - ast_log(LOG_DEBUG, "About to play %s\n", current->namerecloc); + ast_debug(1, "About to play %s\n", current->namerecloc); if (!ast_fileexists(current->namerecloc, NULL, NULL)) continue; if ((current->confchan) && (current->confusers > 1) && !ast_check_hangup(current->confchan)) { @@ -2251,16 +2251,16 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET]; char *buf = __buf + AST_FRIENDLY_OFFSET; char *exitkeys = NULL; - unsigned int calldurationlimit = 0; - long timelimit = 0; - long play_warning = 0; - long warning_freq = 0; - const char *warning_sound = NULL; - const char *end_sound = NULL; - char *parse; - long time_left_ms = 0; - struct timeval nexteventts = { 0, }; - int to; + unsigned int calldurationlimit = 0; + long timelimit = 0; + long play_warning = 0; + long warning_freq = 0; + const char *warning_sound = NULL; + const char *end_sound = NULL; + char *parse; + long time_left_ms = 0; + struct timeval nexteventts = { 0, }; + int to; int setusercount = 0; int confsilence = 0, totalsilence = 0; char *mailbox, *context; @@ -2283,72 +2283,72 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc (opt_waitmarked_timeout > 0)) { timeout = time(NULL) + opt_waitmarked_timeout; } - - if (ast_test_flag64(confflags, CONFFLAG_DURATION_STOP) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_STOP])) { - calldurationlimit = atoi(optargs[OPT_ARG_DURATION_STOP]); - ast_verb(3, "Setting call duration limit to %d seconds.\n", calldurationlimit); - } - - if (ast_test_flag64(confflags, CONFFLAG_DURATION_LIMIT) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_LIMIT])) { - char *limit_str, *warning_str, *warnfreq_str; + + if (ast_test_flag64(confflags, CONFFLAG_DURATION_STOP) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_STOP])) { + calldurationlimit = atoi(optargs[OPT_ARG_DURATION_STOP]); + ast_verb(3, "Setting call duration limit to %d seconds.\n", calldurationlimit); + } + + if (ast_test_flag64(confflags, CONFFLAG_DURATION_LIMIT) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_LIMIT])) { + char *limit_str, *warning_str, *warnfreq_str; const char *var; - - parse = optargs[OPT_ARG_DURATION_LIMIT]; - limit_str = strsep(&parse, ":"); - warning_str = strsep(&parse, ":"); - warnfreq_str = parse; - - timelimit = atol(limit_str); - if (warning_str) - play_warning = atol(warning_str); - if (warnfreq_str) - warning_freq = atol(warnfreq_str); - - if (!timelimit) { - timelimit = play_warning = warning_freq = 0; - warning_sound = NULL; - } else if (play_warning > timelimit) { - if (!warning_freq) { - play_warning = 0; - } else { - while (play_warning > timelimit) - play_warning -= warning_freq; - if (play_warning < 1) - play_warning = warning_freq = 0; - } - } - + + parse = optargs[OPT_ARG_DURATION_LIMIT]; + limit_str = strsep(&parse, ":"); + warning_str = strsep(&parse, ":"); + warnfreq_str = parse; + + timelimit = atol(limit_str); + if (warning_str) + play_warning = atol(warning_str); + if (warnfreq_str) + warning_freq = atol(warnfreq_str); + + if (!timelimit) { + timelimit = play_warning = warning_freq = 0; + warning_sound = NULL; + } else if (play_warning > timelimit) { + if (!warning_freq) { + play_warning = 0; + } else { + while (play_warning > timelimit) + play_warning -= warning_freq; + if (play_warning < 1) + play_warning = warning_freq = 0; + } + } + ast_channel_lock(chan); if ((var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_WARNING_FILE"))) { var = ast_strdupa(var); } ast_channel_unlock(chan); - warning_sound = var ? var : "timeleft"; - + warning_sound = var ? var : "timeleft"; + ast_channel_lock(chan); if ((var = pbx_builtin_getvar_helper(chan, "CONF_LIMIT_TIMEOUT_FILE"))) { var = ast_strdupa(var); } ast_channel_unlock(chan); - + end_sound = var ? var : NULL; - - /* undo effect of S(x) in case they are both used */ - calldurationlimit = 0; - /* more efficient do it like S(x) does since no advanced opts */ - if (!play_warning && !end_sound && timelimit) { - calldurationlimit = timelimit / 1000; - timelimit = play_warning = warning_freq = 0; - } else { - ast_debug(2, "Limit Data for this call:\n"); + + /* undo effect of S(x) in case they are both used */ + calldurationlimit = 0; + /* more efficient do it like S(x) does since no advanced opts */ + if (!play_warning && !end_sound && timelimit) { + calldurationlimit = timelimit / 1000; + timelimit = play_warning = warning_freq = 0; + } else { + ast_debug(2, "Limit Data for this call:\n"); ast_debug(2, "- timelimit = %ld\n", timelimit); - ast_debug(2, "- play_warning = %ld\n", play_warning); - ast_debug(2, "- warning_freq = %ld\n", warning_freq); - ast_debug(2, "- warning_sound = %s\n", warning_sound ? warning_sound : "UNDEF"); - ast_debug(2, "- end_sound = %s\n", end_sound ? end_sound : "UNDEF"); - } - } + ast_debug(2, "- play_warning = %ld\n", play_warning); + ast_debug(2, "- warning_freq = %ld\n", warning_freq); + ast_debug(2, "- warning_sound = %s\n", warning_sound ? warning_sound : "UNDEF"); + ast_debug(2, "- end_sound = %s\n", end_sound ? end_sound : "UNDEF"); + } + } /* Get exit keys */ if (ast_test_flag64(confflags, CONFFLAG_KEYEXIT)) { @@ -2667,7 +2667,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc memset(&dahdic, 0, sizeof(dahdic)); memset(&dahdic_empty, 0, sizeof(dahdic_empty)); /* Check to see if we're in a conference... */ - dahdic.chan = 0; + dahdic.chan = 0; if (ioctl(fd, DAHDI_GETCONF, &dahdic)) { ast_log(LOG_WARNING, "Error getting conference\n"); close(fd); @@ -2683,7 +2683,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc } memset(&dahdic, 0, sizeof(dahdic)); /* Add us to the conference */ - dahdic.chan = 0; + dahdic.chan = 0; dahdic.confno = conf->dahdiconf; if (!ast_test_flag64(confflags, CONFFLAG_QUIET) && (ast_test_flag64(confflags, CONFFLAG_INTROUSER) || @@ -2717,7 +2717,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc dahdic.confmode = DAHDI_CONF_CONFMON | DAHDI_CONF_LISTENER; else if (ast_test_flag64(confflags, CONFFLAG_TALKER)) dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER; - else + else dahdic.confmode = DAHDI_CONF_CONF | DAHDI_CONF_TALKER | DAHDI_CONF_LISTENER; if (ioctl(fd, DAHDI_SETCONF, &dahdic)) { @@ -3595,7 +3595,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc } else if ((f->frametype == AST_FRAME_DTMF) && ast_test_flag64(confflags, CONFFLAG_KEYEXIT) && (strchr(exitkeys, f->subclass.integer))) { pbx_builtin_setvar_helper(chan, "MEETME_EXIT_KEY", dtmfstr); - + if (ast_test_flag64(confflags, CONFFLAG_PASS_DTMF)) { conf_queue_dtmf(conf, user, f); } @@ -3623,12 +3623,12 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc goto outrun; break; default: - ast_debug(1, + ast_debug(1, "Got ignored control frame on channel %s, f->frametype=%d,f->subclass=%d\n", chan->name, f->frametype, f->subclass.integer); } } else { - ast_debug(1, + ast_debug(1, "Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n", chan->name, f->frametype, f->subclass.integer); } @@ -4046,7 +4046,7 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno, AST_LIST_LOCK(&confs); AST_LIST_TRAVERSE(&confs, cnf, list) { ast_debug(3, "Does conf %s match %s?\n", confno, cnf->confno); - if (!strcmp(confno, cnf->confno)) + if (!strcmp(confno, cnf->confno)) break; } if (cnf) { @@ -6280,7 +6280,7 @@ static int sla_station_exec(struct ast_channel *chan, const char *data) } snprintf(conf_name, sizeof(conf_name), "SLA_%s", trunk_ref->trunk->name); - ast_set_flag64(&conf_flags, + ast_set_flag64(&conf_flags, CONFFLAG_QUIET | CONFFLAG_MARKEDEXIT | CONFFLAG_PASS_DTMF | CONFFLAG_SLA_STATION); ast_answer(chan); conf = build_conf(conf_name, "", "", 0, 0, 1, chan, NULL); diff --git a/apps/app_rpt.c b/apps/app_rpt.c index 765f73184..88997936c 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -1646,7 +1646,7 @@ static const char* dtmf_tones[] = { ast_playtones_start(myrpt->txchannel, 0, dtmf_tones[15], 0); else { /* not handled */ - ast_log(LOG_DEBUG, "Unable to generate DTMF tone '%c' for '%s'\n", digit, myrpt->txchannel->name); + ast_debug(1, "Unable to generate DTMF tone '%c' for '%s'\n", digit, myrpt->txchannel->name); } rpt_mutex_lock(&myrpt->lock); } @@ -12525,7 +12525,7 @@ struct ast_format_cap *cap = NULL; f->data.ptr,f->datalen / 2); if (n1 != l->wasvox) { - if (debug)ast_log(LOG_DEBUG,"Link Node %s, vox %d\n",l->name,n1); + ast_debug(1,"Link Node %s, vox %d\n",l->name,n1); l->wasvox = n1; l->voxtostate = 0; if (n1) l->voxtotimer = myrpt->p.voxtimeout_ms; @@ -12874,7 +12874,7 @@ struct ast_format_cap *cap = NULL; n = dovox(&myrpt->vox,f->data.ptr,f->datalen / 2); if (n != myrpt->wasvox) { - if (debug) ast_log(LOG_DEBUG,"Node %s, vox %d\n",myrpt->name,n); + ast_debug(1,"Node %s, vox %d\n",myrpt->name,n); myrpt->wasvox = n; myrpt->voxtostate = 0; if (n) myrpt->voxtotimer = myrpt->p.voxtimeout_ms; diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index f7882c20d..7223d3d4f 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -1212,7 +1212,7 @@ static int check_password(struct ast_vm_user *vmu, char *password) if (!ast_strlen_zero(ext_pass_check_cmd)) { char cmd[255], buf[255]; - ast_log(AST_LOG_DEBUG, "Verify password policies for %s\n", password); + ast_debug(1, "Verify password policies for %s\n", password); snprintf(cmd, sizeof(cmd), "%s %s %s %s %s", ext_pass_check_cmd, vmu->mailbox, vmu->context, vmu->password, password); if (vm_check_password_shell(cmd, buf, sizeof(buf))) { @@ -1754,8 +1754,7 @@ static void vm_imap_delete(char *file, int msgnum, struct ast_vm_user *vmu) ast_log(LOG_WARNING, "msgnum %d, mailbox message %lu is zero.\n", msgnum, messageNum); return; } - if (option_debug > 2) - ast_log(LOG_DEBUG, "deleting msgnum %d, which is mailbox message %lu\n", msgnum, messageNum); + ast_debug(3, "deleting msgnum %d, which is mailbox message %lu\n", msgnum, messageNum); /* delete message */ snprintf (arg, sizeof(arg), "%lu", messageNum); ast_mutex_lock(&vms->lock); @@ -1782,7 +1781,7 @@ static int imap_retrieve_greeting(const char *dir, const int msgnum, struct ast_ if (file) *file++ = '\0'; else { - ast_debug (1, "Failed to procure file name from directory passed.\n"); + ast_debug(1, "Failed to procure file name from directory passed.\n"); return -1; } } @@ -1878,7 +1877,7 @@ static int imap_retrieve_file(const char *dir, const int msgnum, const char *mai res = -1; goto exit; } - + make_file(vms->fn, sizeof(vms->fn), dir, msgnum); snprintf(vms->introfn, sizeof(vms->introfn), "%sintro", vms->fn); @@ -1888,8 +1887,7 @@ static int imap_retrieve_file(const char *dir, const int msgnum, const char *mai goto exit; } - if (option_debug > 2) - ast_log(LOG_DEBUG, "Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n", msgnum, vms->msgArray[msgnum]); + ast_debug(3, "Before mail_fetchheaders, curmsg is: %d, imap messages is %lu\n", msgnum, vms->msgArray[msgnum]); if (vms->msgArray[msgnum] == 0) { ast_log(LOG_WARNING, "Trying to access unknown message\n"); res = -1; @@ -2029,7 +2027,7 @@ static int __messagecount(const char *context, const char *mailbox, const char * return -1; } } - + /* No IMAP account available */ if (vmu->imapuser[0] == '\0') { ast_log(AST_LOG_WARNING, "IMAP user not set for mailbox %s\n", vmu->mailbox); @@ -2126,7 +2124,7 @@ static int imap_check_limits(struct ast_channel *chan, struct vm_state *vms, str ast_play_and_wait(chan, "vm-mailboxfull"); return -1; } - + /* Check if we have exceeded maxmsg */ ast_debug(3, "Checking message number quota: mailbox has %d messages, maximum is set to %d, current messages %d\n", msgnum, vmu->maxmsg, inprocess_count(vmu->mailbox, vmu->context, 0)); if (msgnum >= vmu->maxmsg - inprocess_count(vmu->mailbox, vmu->context, +1)) { @@ -2178,7 +2176,7 @@ static int imap_store_file(const char *dir, const char *mailboxuser, const char if (msgnum < 0 && !imapgreetings) { return 0; } - + if (imap_check_limits(chan, vms, vmu, msgcount)) { return -1; } @@ -2188,7 +2186,7 @@ static int imap_store_file(const char *dir, const char *mailboxuser, const char ast_debug(3, "Setting message flag \\\\FLAGGED.\n"); imap_flags = "\\FLAGGED"; } - + /* Attach only the first format */ fmt = ast_strdupa(fmt); stringp = fmt; @@ -2206,7 +2204,7 @@ static int imap_store_file(const char *dir, const char *mailboxuser, const char if (ast_fileexists(introfn, NULL, NULL) <= 0) { *introfn = '\0'; } - + if (ast_strlen_zero(vmu->email)) { /* We need the vmu->email to be set when we call make_email_file, but * if we keep it set, a duplicate e-mail will be created. So at the end @@ -2278,7 +2276,7 @@ static int imap_store_file(const char *dir, const char *mailboxuser, const char return -1; } ast_debug(3, "%s stored\n", fn); - + if (tempcopy) *(vmu->email) = '\0'; inprocess_count(vmu->mailbox, vmu->context, -1); @@ -2317,7 +2315,7 @@ static int inboxcount2(const char *mailbox_context, int *urgentmsgs, int *newmsg /* If no mailbox, return immediately */ if (ast_strlen_zero(mailbox_context)) return 0; - + ast_copy_string(tmp, mailbox_context, sizeof(tmp)); context = strchr(tmp, '@'); if (strchr(mailbox_context, ',')) { @@ -2499,16 +2497,14 @@ static int init_mailstream(struct vm_state *vms, int box) MAILSTREAM *stream = NIL; long debug; char tmp[256]; - + if (!vms) { ast_log(LOG_ERROR, "vm_state is NULL!\n"); return -1; } - if (option_debug > 2) - ast_log(LOG_DEBUG, "vm_state user is:%s\n", vms->imapuser); + ast_debug(3, "vm_state user is:%s\n", vms->imapuser); if (vms->mailstream == NIL || !vms->mailstream) { - if (option_debug) - ast_log(LOG_DEBUG, "mailstream not set.\n"); + ast_debug(1, "mailstream not set.\n"); } else { stream = vms->mailstream; } @@ -2541,8 +2537,7 @@ static int init_mailstream(struct vm_state *vms, int box) } /* Now connect to the target folder */ imap_mailbox_name(tmp, sizeof(tmp), vms, box, 1); - if (option_debug > 2) - ast_log(LOG_DEBUG, "Before mail_open, server: %s, box:%d\n", tmp, box); + ast_debug(3, "Before mail_open, server: %s, box:%d\n", tmp, box); ast_mutex_lock(&vms->lock); vms->mailstream = mail_open (stream, tmp, debug ? OP_DEBUG : NIL); ast_mutex_unlock(&vms->lock); @@ -2574,9 +2569,9 @@ static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box) ast_log(AST_LOG_ERROR, "Could not initialize mailstream\n"); return -1; } - + create_dirpath(vms->curdir, sizeof(vms->curdir), vmu->context, vms->username, vms->curbox); - + /* Check Quota */ if (box == 0) { ast_debug(3, "Mailbox name set to: %s, about to check quotas\n", mbox(vmu, box)); @@ -2853,13 +2848,13 @@ static void mm_parsequota(MAILSTREAM *stream, unsigned char *msg, QUOTALIST *pqu char *mailbox = stream->mailbox, *user; char buf[1024] = ""; unsigned long usage = 0, limit = 0; - + while (pquota) { usage = pquota->usage; limit = pquota->limit; pquota = pquota->next; } - + if (!(user = get_user_by_mailbox(mailbox, buf, sizeof(buf))) || (!(vms = get_vm_state_by_imapuser(user, 2)) && !(vms = get_vm_state_by_imapuser(user, 0)))) { ast_log(AST_LOG_ERROR, "No state found.\n"); return; @@ -2927,8 +2922,7 @@ static struct vm_state *create_vm_state_from_user(struct ast_vm_user *vmu) if ((vms_p = pthread_getspecific(ts_vmstate.key)) && !strcmp(vms_p->imapuser, vmu->imapuser) && !strcmp(vms_p->username, vmu->mailbox)) { return vms_p; } - if (option_debug > 4) - ast_log(AST_LOG_DEBUG, "Adding new vmstate for %s\n", vmu->imapuser); + ast_debug(5, "Adding new vmstate for %s\n", vmu->imapuser); if (!(vms_p = ast_calloc(1, sizeof(*vms_p)))) return NULL; ast_copy_string(vms_p->imapuser, vmu->imapuser, sizeof(vms_p->imapuser)); @@ -2937,8 +2931,7 @@ static struct vm_state *create_vm_state_from_user(struct ast_vm_user *vmu) ast_copy_string(vms_p->context, vmu->context, sizeof(vms_p->context)); vms_p->mailstream = NIL; /* save for access from interactive entry point */ vms_p->imapversion = vmu->imapversion; - if (option_debug > 4) - ast_log(AST_LOG_DEBUG, "Copied %s to %s\n", vmu->imapuser, vms_p->imapuser); + ast_debug(5, "Copied %s to %s\n", vmu->imapuser, vms_p->imapuser); vms_p->updated = 1; /* set mailbox to INBOX! */ ast_copy_string(vms_p->curbox, mbox(vmu, 0), sizeof(vms_p->curbox)); @@ -3012,7 +3005,7 @@ static struct vm_state *get_vm_state_by_mailbox(const char *mailbox, const char } ast_debug(3, "comparing mailbox %s@%s (i=%d) to vmstate mailbox %s@%s (i=%d)\n", mailbox, local_context, interactive, vlist->vms->username, vlist->vms->context, vlist->vms->interactive); - + if (!strcmp(vlist->vms->username, mailbox) && !strcmp(vlist->vms->context, local_context) && vlist->vms->interactive == interactive) { ast_debug(3, "Found it!\n"); AST_LIST_UNLOCK(&vmstates); @@ -3026,7 +3019,7 @@ static struct vm_state *get_vm_state_by_mailbox(const char *mailbox, const char return NULL; } -static void vmstate_insert(struct vm_state *vms) +static void vmstate_insert(struct vm_state *vms) { struct vmstate *v; struct vm_state *altvms; @@ -3036,7 +3029,7 @@ static void vmstate_insert(struct vm_state *vms) We can compare the username to find the duplicate */ if (vms->interactive == 1) { altvms = get_vm_state_by_mailbox(vms->username, vms->context, 0); - if (altvms) { + if (altvms) { ast_debug(3, "Duplicate mailbox %s, copying message info...\n", vms->username); vms->newmessages = altvms->newmessages; vms->oldmessages = altvms->oldmessages; @@ -3057,7 +3050,7 @@ static void vmstate_insert(struct vm_state *vms) if (!(v = ast_calloc(1, sizeof(*v)))) return; - + v->vms = vms; ast_debug(3, "Inserting vm_state for user:%s, mailbox %s\n", vms->imapuser, vms->username); @@ -3067,7 +3060,7 @@ static void vmstate_insert(struct vm_state *vms) AST_LIST_UNLOCK(&vmstates); } -static void vmstate_delete(struct vm_state *vms) +static void vmstate_delete(struct vm_state *vms) { struct vmstate *vc = NULL; struct vm_state *altvms = NULL; @@ -3084,9 +3077,9 @@ static void vmstate_delete(struct vm_state *vms) /* Interactive states are not stored within the persistent list */ return; } - + ast_debug(3, "Removing vm_state for user:%s, mailbox %s\n", vms->imapuser, vms->username); - + AST_LIST_LOCK(&vmstates); AST_LIST_TRAVERSE_SAFE_BEGIN(&vmstates, vc, list) { if (vc->vms == vms) { @@ -3105,7 +3098,7 @@ static void vmstate_delete(struct vm_state *vms) ast_log(AST_LOG_ERROR, "No vmstate found for user:%s, mailbox %s\n", vms->imapuser, vms->username); } -static void set_update(MAILSTREAM * stream) +static void set_update(MAILSTREAM * stream) { struct vm_state *vms; char *mailbox = stream->mailbox, *user; @@ -3122,7 +3115,7 @@ static void set_update(MAILSTREAM * stream) vms->updated = 1; /* Set updated flag since mailbox changed */ } -static void init_vm_state(struct vm_state *vms) +static void init_vm_state(struct vm_state *vms) { int x; vms->vmArrayIndex = 0; @@ -3132,7 +3125,7 @@ static void init_vm_state(struct vm_state *vms) ast_mutex_init(&vms->lock); } -static int save_body(BODY *body, struct vm_state *vms, char *section, char *format, int is_intro) +static int save_body(BODY *body, struct vm_state *vms, char *section, char *format, int is_intro) { char *body_content; char *body_decoded; @@ -3140,7 +3133,7 @@ static int save_body(BODY *body, struct vm_state *vms, char *section, char *form unsigned long len; unsigned long newlen; char filename[256]; - + if (!body || body == NIL) return -1; @@ -3149,9 +3142,9 @@ static int save_body(BODY *body, struct vm_state *vms, char *section, char *form ast_mutex_unlock(&vms->lock); if (body_content != NIL) { snprintf(filename, sizeof(filename), "%s.%s", fn, format); - /* ast_debug(1,body_content); */ + /* ast_debug(1, body_content); */ body_decoded = rfc822_base64((unsigned char *) body_content, len, &newlen); - /* If the body of the file is empty, return an error */ + /* If the body of the file is empty, return an error */ if (!newlen) { return -1; } @@ -4256,9 +4249,7 @@ static void prep_email_sub_vars(struct ast_channel *ast, struct ast_vm_user *vmu strcat(fromfile, ".txt"); } if (!(msg_cfg = ast_config_load(fromfile, config_flags))) { - if (option_debug > 0) { - ast_log(LOG_DEBUG, "Config load for message text file '%s' failed\n", fromfile); - } + ast_debug(1, "Config load for message text file '%s' failed\n", fromfile); return; } @@ -4930,7 +4921,7 @@ static int get_date(char *s, int len) { struct ast_tm tm; struct timeval t = ast_tvnow(); - + ast_localtime(&t, &tm, "UTC"); return ast_strftime(s, len, "%a %b %e %r UTC %Y", &tm); @@ -5669,8 +5660,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ } /* If maxmsg is zero, act as a "greetings only" voicemail: Exit successfully without recording */ if (vmu->maxmsg == 0) { - if (option_debug > 2) - ast_log(LOG_DEBUG, "Greetings only VM (maxmsg=0), Skipping voicemail recording\n"); + ast_debug(3, "Greetings only VM (maxmsg=0), Skipping voicemail recording\n"); pbx_builtin_setvar_helper(chan, "VMSTATUS", "SUCCESS"); goto leave_vm_out; } @@ -5762,7 +5752,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ } } vms->newmessages++; - + /* here is a big difference! We add one to it later */ msgnum = newmsgs + oldmsgs; ast_debug(3, "Messagecount set to %d\n", msgnum); @@ -6077,7 +6067,7 @@ static int save_to_folder(struct ast_vm_user *vmu, struct vm_state *vms, int msg /* get the real IMAP message number for this message */ snprintf(sequence, sizeof(sequence), "%ld", vms->msgArray[msg]); - + ast_debug(3, "Copying sequence %s to mailbox %s\n", sequence, mbox(vmu, box)); ast_mutex_lock(&vms->lock); /* if save to Old folder, put in INBOX as read */ @@ -6095,7 +6085,7 @@ static int save_to_folder(struct ast_vm_user *vmu, struct vm_state *vms, int msg /* Create the folder if it don't exist */ imap_mailbox_name(mailbox, sizeof(mailbox), vms, box, 1); /* Get the full mailbox name */ ast_debug(5, "Checking if folder exists: %s\n", mailbox); - if (mail_create(vms->mailstream, mailbox) == NIL) + if (mail_create(vms->mailstream, mailbox) == NIL) ast_debug(5, "Folder exists.\n"); else ast_log(AST_LOG_NOTICE, "Folder %s created!\n", mbox(vmu, box)); @@ -7407,7 +7397,6 @@ static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms, int i; char *callerid, *name; char prefile[PATH_MAX] = ""; - /* If voicemail cid is not enabled, or we didn't get cid or context from * the attribute file, leave now. @@ -9092,7 +9081,7 @@ static int vm_newuser(struct ast_channel *chan, struct ast_vm_user *vmu, struct ast_debug(1, "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 */ + /* If forcename is set, have the user record their name */ if (ast_test_flag(vmu, VM_FORCENAME)) { snprintf(prefile, sizeof(prefile), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, vms->username); if (ast_fileexists(prefile, NULL, NULL) < 1) { @@ -9214,10 +9203,10 @@ static int vm_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct vms->username, newpassword, (int) strlen(newpassword)); cmd = ast_play_and_wait(chan, vm_passchanged); break; - case '*': + case '*': cmd = 't'; break; - default: + default: cmd = 0; snprintf(prefile, sizeof(prefile), "%s%s/%s/temp", VM_SPOOL_DIR, vmu->context, vms->username); RETRIEVE(prefile, -1, vmu->mailbox, vmu->context); @@ -9845,7 +9834,7 @@ static int vm_execmain(struct ast_channel *chan, const char *data) cmd = ast_play_and_wait(chan, "an-error-has-occured"); return -1; } - + /* Set language from config to override channel language */ if (!ast_strlen_zero(vmu->language)) ast_string_field_set(chan, language, vmu->language); @@ -10209,7 +10198,7 @@ static int vm_execmain(struct ast_channel *chan, const char *data) deleted = 1; #endif break; - + case '8': /* Forward the current messgae */ if (vms.lastmsg > -1) { cmd = forward_message(chan, context, &vms, vmu, vmfmts, 0, record_gain, in_urgent); @@ -10382,7 +10371,7 @@ out: #ifdef HAVE_IMAP_TK2006 if (LEVELUIDPLUS (vms.mailstream)) { mail_expunge_full(vms.mailstream, NIL, EX_UID); - } else + } else #endif mail_expunge(vms.mailstream); ast_mutex_unlock(&vms.lock); @@ -11682,11 +11671,11 @@ static int load_config(int reload) ast_copy_string(ext_pass_cmd, val, sizeof(ext_pass_cmd)); pwdchange = PWDCHANGE_EXTERNAL | PWDCHANGE_INTERNAL; } - + /* External password validation command */ if ((val = ast_variable_retrieve(cfg, "general", "externpasscheck"))) { ast_copy_string(ext_pass_check_cmd, val, sizeof(ext_pass_check_cmd)); - ast_log(AST_LOG_DEBUG, "found externpasscheck: %s\n", ext_pass_check_cmd); + ast_debug(1, "found externpasscheck: %s\n", ext_pass_check_cmd); } #ifdef IMAP_STORAGE @@ -11796,18 +11785,18 @@ static int load_config(int reload) } if (!smdi_iface) { ast_log(AST_LOG_ERROR, "No valid SMDI interface specfied, disabling SMDI voicemail notification\n"); - } + } } /* Silence treshold */ silencethreshold = ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE); if ((val = ast_variable_retrieve(cfg, "general", "silencethreshold"))) silencethreshold = atoi(val); - - if (!(val = ast_variable_retrieve(cfg, "general", "serveremail"))) + + if (!(val = ast_variable_retrieve(cfg, "general", "serveremail"))) val = ASTERISK_USERNAME; ast_copy_string(serveremail, val, sizeof(serveremail)); - + vmmaxsecs = 0; if ((val = ast_variable_retrieve(cfg, "general", "maxsecs"))) { if (sscanf(val, "%30d", &x) == 1) { @@ -11903,12 +11892,12 @@ static int load_config(int reload) } /* Force new user to record name ? */ - if (!(val = ast_variable_retrieve(cfg, "general", "forcename"))) + if (!(val = ast_variable_retrieve(cfg, "general", "forcename"))) val = "no"; ast_set2_flag((&globalflags), ast_true(val), VM_FORCENAME); /* Force new user to record greetings ? */ - if (!(val = ast_variable_retrieve(cfg, "general", "forcegreetings"))) + if (!(val = ast_variable_retrieve(cfg, "general", "forcegreetings"))) val = "no"; ast_set2_flag((&globalflags), ast_true(val), VM_FORCEGREET); @@ -11931,7 +11920,7 @@ static int load_config(int reload) ast_debug(1, "VM Review Option disabled globally\n"); val = "no"; } - ast_set2_flag((&globalflags), ast_true(val), VM_REVIEW); + ast_set2_flag((&globalflags), ast_true(val), VM_REVIEW); /* Temporary greeting reminder */ if (!(val = ast_variable_retrieve(cfg, "general", "tempgreetwarn"))) { @@ -11945,49 +11934,49 @@ static int load_config(int reload) ast_debug(1, "VM next message wrap disabled globally\n"); val = "no"; } - ast_set2_flag((&globalflags), ast_true(val), VM_MESSAGEWRAP); + ast_set2_flag((&globalflags), ast_true(val), VM_MESSAGEWRAP); if (!(val = ast_variable_retrieve(cfg, "general", "operator"))){ ast_debug(1, "VM Operator break disabled globally\n"); val = "no"; } - ast_set2_flag((&globalflags), ast_true(val), VM_OPERATOR); + ast_set2_flag((&globalflags), ast_true(val), VM_OPERATOR); if (!(val = ast_variable_retrieve(cfg, "general", "saycid"))) { ast_debug(1, "VM CID Info before msg disabled globally\n"); val = "no"; - } - ast_set2_flag((&globalflags), ast_true(val), VM_SAYCID); + } + ast_set2_flag((&globalflags), ast_true(val), VM_SAYCID); if (!(val = ast_variable_retrieve(cfg, "general", "sendvoicemail"))){ ast_debug(1, "Send Voicemail msg disabled globally\n"); val = "no"; } ast_set2_flag((&globalflags), ast_true(val), VM_SVMAIL); - + if (!(val = ast_variable_retrieve(cfg, "general", "envelope"))) { ast_debug(1, "ENVELOPE before msg enabled globally\n"); val = "yes"; } - ast_set2_flag((&globalflags), ast_true(val), VM_ENVELOPE); + ast_set2_flag((&globalflags), ast_true(val), VM_ENVELOPE); if (!(val = ast_variable_retrieve(cfg, "general", "moveheard"))) { ast_debug(1, "Move Heard enabled globally\n"); val = "yes"; } - ast_set2_flag((&globalflags), ast_true(val), VM_MOVEHEARD); + ast_set2_flag((&globalflags), ast_true(val), VM_MOVEHEARD); if (!(val = ast_variable_retrieve(cfg, "general", "forward_urgent_auto"))) { ast_debug(1, "Autoset of Urgent flag on forwarded Urgent messages disabled globally\n"); val = "no"; } - ast_set2_flag((&globalflags), ast_true(val), VM_FWDURGAUTO); + ast_set2_flag((&globalflags), ast_true(val), VM_FWDURGAUTO); if (!(val = ast_variable_retrieve(cfg, "general", "sayduration"))) { ast_debug(1, "Duration info before msg enabled globally\n"); val = "yes"; } - ast_set2_flag((&globalflags), ast_true(val), VM_SAYDURATION); + ast_set2_flag((&globalflags), ast_true(val), VM_SAYDURATION); saydurationminfo = 2; if ((val = ast_variable_retrieve(cfg, "general", "saydurationm"))) { @@ -12008,9 +11997,9 @@ static int load_config(int reload) ast_copy_string(dialcontext, val, sizeof(dialcontext)); ast_debug(1, "found dialout context: %s\n", dialcontext); } else { - dialcontext[0] = '\0'; + dialcontext[0] = '\0'; } - + if ((val = ast_variable_retrieve(cfg, "general", "callback"))) { ast_copy_string(callcontext, val, sizeof(callcontext)); ast_debug(1, "found callback context: %s\n", callcontext); @@ -12024,7 +12013,7 @@ static int load_config(int reload) } else { exitcontext[0] = '\0'; } - + /* load password sounds configuration */ if ((val = ast_variable_retrieve(cfg, "general", "vm-password"))) ast_copy_string(vm_password, val, sizeof(vm_password)); |