More cleanups of app_voicemail
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@54861 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
ba32ee49d0
commit
401133e544
1 changed files with 14 additions and 17 deletions
|
@ -3926,17 +3926,17 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
|
||||||
char todir[PATH_MAX], fn[PATH_MAX], ext_context[PATH_MAX], *stringp;
|
char todir[PATH_MAX], fn[PATH_MAX], ext_context[PATH_MAX], *stringp;
|
||||||
int newmsgs = 0, oldmsgs = 0;
|
int newmsgs = 0, oldmsgs = 0;
|
||||||
const char *category = pbx_builtin_getvar_helper(chan, "VM_CATEGORY");
|
const char *category = pbx_builtin_getvar_helper(chan, "VM_CATEGORY");
|
||||||
|
char *myserveremail = serveremail;
|
||||||
|
|
||||||
make_dir(todir, sizeof(todir), vmu->context, vmu->mailbox, "INBOX");
|
make_dir(todir, sizeof(todir), vmu->context, vmu->mailbox, "INBOX");
|
||||||
make_file(fn, sizeof(fn), todir, msgnum);
|
make_file(fn, sizeof(fn), todir, msgnum);
|
||||||
snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
|
snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
|
||||||
|
|
||||||
if (!ast_strlen_zero(vmu->attachfmt)) {
|
if (!ast_strlen_zero(vmu->attachfmt)) {
|
||||||
if (strstr(fmt, vmu->attachfmt)) {
|
if (strstr(fmt, vmu->attachfmt))
|
||||||
fmt = vmu->attachfmt;
|
fmt = vmu->attachfmt;
|
||||||
} else {
|
else
|
||||||
ast_log(LOG_WARNING, "Attachment format '%s' is not one of the recorded formats '%s'. Falling back to default format for '%s@%s'.\n", vmu->attachfmt, fmt, vmu->mailbox, vmu->context);
|
ast_log(LOG_WARNING, "Attachment format '%s' is not one of the recorded formats '%s'. Falling back to default format for '%s@%s'.\n", vmu->attachfmt, fmt, vmu->mailbox, vmu->context);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Attach only the first format */
|
/* Attach only the first format */
|
||||||
|
@ -3944,34 +3944,31 @@ static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu,
|
||||||
stringp = fmt;
|
stringp = fmt;
|
||||||
strsep(&stringp, "|");
|
strsep(&stringp, "|");
|
||||||
|
|
||||||
|
if (!ast_strlen_zero(vmu->serveremail))
|
||||||
|
myserveremail = vmu->serveremail;
|
||||||
|
|
||||||
if (!ast_strlen_zero(vmu->email)) {
|
if (!ast_strlen_zero(vmu->email)) {
|
||||||
int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
|
int attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
|
||||||
char *myserveremail = serveremail;
|
if (!attach_user_voicemail)
|
||||||
attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
|
attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
|
||||||
if (!ast_strlen_zero(vmu->serveremail))
|
|
||||||
myserveremail = vmu->serveremail;
|
|
||||||
/*XXX possible imap issue, should category be NULL XXX*/
|
/*XXX possible imap issue, should category be NULL XXX*/
|
||||||
sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, chan, category);
|
sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, chan, category);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ast_strlen_zero(vmu->pager)) {
|
if (!ast_strlen_zero(vmu->pager))
|
||||||
char *myserveremail = serveremail;
|
|
||||||
if (!ast_strlen_zero(vmu->serveremail))
|
|
||||||
myserveremail = vmu->serveremail;
|
|
||||||
sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
|
sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
|
||||||
}
|
|
||||||
|
|
||||||
if (ast_test_flag(vmu, VM_DELETE)) {
|
if (ast_test_flag(vmu, VM_DELETE))
|
||||||
DELETE(todir, msgnum, fn);
|
DELETE(todir, msgnum, fn);
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef IMAP_STORAGE
|
#ifdef IMAP_STORAGE
|
||||||
DELETE(todir, msgnum, fn);
|
DELETE(todir, msgnum, fn);
|
||||||
#endif
|
#endif
|
||||||
/* Leave voicemail for someone */
|
/* Leave voicemail for someone */
|
||||||
if (ast_app_has_voicemail(ext_context, NULL)) {
|
if (ast_app_has_voicemail(ext_context, NULL))
|
||||||
ast_app_inboxcount(ext_context, &newmsgs, &oldmsgs);
|
ast_app_inboxcount(ext_context, &newmsgs, &oldmsgs);
|
||||||
}
|
|
||||||
manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s@%s\r\nWaiting: %d\r\nNew: %d\r\nOld: %d\r\n", vmu->mailbox, vmu->context, ast_app_has_voicemail(ext_context, NULL), newmsgs, oldmsgs);
|
manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s@%s\r\nWaiting: %d\r\nNew: %d\r\nOld: %d\r\n", vmu->mailbox, vmu->context, ast_app_has_voicemail(ext_context, NULL), newmsgs, oldmsgs);
|
||||||
run_externnotify(vmu->context, vmu->mailbox);
|
run_externnotify(vmu->context, vmu->mailbox);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue