[asterisk-commits] oej: branch oej/minivoicemail r58349 -
/team/oej/minivoicemail/apps/app_minivm.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Mar 8 03:38:21 MST 2007
Author: oej
Date: Thu Mar 8 04:38:20 2007
New Revision: 58349
URL: http://svn.digium.com/view/asterisk?view=rev&rev=58349
Log:
handle result code of notify_new_message
Modified:
team/oej/minivoicemail/apps/app_minivm.c
Modified: team/oej/minivoicemail/apps/app_minivm.c
URL: http://svn.digium.com/view/asterisk/team/oej/minivoicemail/apps/app_minivm.c?view=diff&rev=58349&r1=58348&r2=58349
==============================================================================
--- team/oej/minivoicemail/apps/app_minivm.c (original)
+++ team/oej/minivoicemail/apps/app_minivm.c Thu Mar 8 04:38:20 2007
@@ -994,8 +994,10 @@
len_passdata = strlen(passdata) * 2 + 3;
passdata2 = alloca(len_passdata);
fprintf(p, "From: %s <%s>\n", mailheader_quote(passdata, passdata2, len_passdata), who);
- } else
+ } else {
ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
+ return -1;
+ }
}
len_passdata = strlen(vmu->fullname) * 2 + 3;
@@ -1382,6 +1384,7 @@
char *myserveremail;
struct minivm_template *etemplate;
char *messageformat;
+ int res = 0;
snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->username, vmu->domain);
@@ -1406,22 +1409,21 @@
else
myserveremail = etemplate->fromstring;
- sendmail(etemplate, myserveremail, vmu, cidnum, cidname, filename, messageformat, duration, etemplate->attachment, MVM_MESSAGE_EMAIL);
-
- if (!ast_strlen_zero(vmu->pager)) {
+ res = sendmail(etemplate, myserveremail, vmu, cidnum, cidname, filename, messageformat, duration, etemplate->attachment, MVM_MESSAGE_EMAIL);
+
+ if (res == 0 && !ast_strlen_zero(vmu->pager)) {
/* Find template for paging */
etemplate = message_template_find(vmu->ptemplate);
if (!etemplate)
etemplate = message_template_find("pager-default");
- sendmail(etemplate, myserveremail, vmu, cidnum, cidname, filename, messageformat, duration, etemplate->attachment, MVM_MESSAGE_PAGE);
- }
-
+ res = sendmail(etemplate, myserveremail, vmu, cidnum, cidname, filename, messageformat, duration, etemplate->attachment, MVM_MESSAGE_PAGE);
+ }
manager_event(EVENT_FLAG_CALL, "MiniVoiceMail", "Action: SentNotification\rn\nMailbox: %s@%s\r\n", vmu->username, vmu->domain);
run_externnotify(chan, vmu); /* Run external notification */
- return 0;
+ return res;
}
@@ -1655,13 +1657,15 @@
format = pbx_builtin_getvar_helper(chan, "MVM_FORMAT");
duration_string = pbx_builtin_getvar_helper(chan, "MVM_DURATION");
/* Notify of new message to e-mail and pager */
- if (!ast_strlen_zero(filename))
- notify_new_message(chan, vmu, filename, atoi(duration_string), format, chan->cid.cid_num, chan->cid.cid_name);
+ if (!ast_strlen_zero(filename)) {
+ res = notify_new_message(chan, vmu, filename, atoi(duration_string), format, chan->cid.cid_num, chan->cid.cid_name);
+ };
+
+ pbx_builtin_setvar_helper(chan, "MINIVM_NOTIFY_STATUS", res == 0 ? "SUCCESS" : "FAILED");
if(ast_test_flag(vmu, MVM_ALLOCED))
free_user(vmu);
-
/* Ok, we're ready to rock and roll. Return to dialplan */
LOCAL_USER_REMOVE(u);
More information about the asterisk-commits
mailing list