mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 14:56:58 +00:00
Fix attachment behavior in voicemail2
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1058 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -571,6 +571,7 @@ static int sendmail(char *srcemail, char *email, char *name, int msgnum, char *m
|
|||||||
struct tm tm;
|
struct tm tm;
|
||||||
if (!strcmp(format, "wav49"))
|
if (!strcmp(format, "wav49"))
|
||||||
format = "WAV";
|
format = "WAV";
|
||||||
|
ast_log(LOG_DEBUG, "Attaching file '%s', format '%s', uservm is '%d', global is %d\n", attach, format, attach_user_voicemail, attach_voicemail);
|
||||||
p = popen(SENDMAIL, "w");
|
p = popen(SENDMAIL, "w");
|
||||||
if (p) {
|
if (p) {
|
||||||
gethostname(host, sizeof(host));
|
gethostname(host, sizeof(host));
|
||||||
@@ -589,7 +590,7 @@ static int sendmail(char *srcemail, char *email, char *name, int msgnum, char *m
|
|||||||
fprintf(p, "Subject: [PBX]: New message %d in mailbox %s\n", msgnum, mailbox);
|
fprintf(p, "Subject: [PBX]: New message %d in mailbox %s\n", msgnum, mailbox);
|
||||||
fprintf(p, "Message-ID: <Asterisk-%d-%s-%d@%s>\n", msgnum, mailbox, getpid(), host);
|
fprintf(p, "Message-ID: <Asterisk-%d-%s-%d@%s>\n", msgnum, mailbox, getpid(), host);
|
||||||
fprintf(p, "MIME-Version: 1.0\n");
|
fprintf(p, "MIME-Version: 1.0\n");
|
||||||
if ((attach_user_voicemail==-1 && attach_voicemail) || attach_user_voicemail==1) {
|
if (attach_user_voicemail) {
|
||||||
// Something unique.
|
// Something unique.
|
||||||
snprintf(bound, sizeof(bound), "Boundary=%d%s%d", msgnum, mailbox, getpid());
|
snprintf(bound, sizeof(bound), "Boundary=%d%s%d", msgnum, mailbox, getpid());
|
||||||
|
|
||||||
@@ -604,7 +605,7 @@ static int sendmail(char *srcemail, char *email, char *name, int msgnum, char *m
|
|||||||
"in mailbox %s from %s, on %s so you might\n"
|
"in mailbox %s from %s, on %s so you might\n"
|
||||||
"want to check it when you get a chance. Thanks!\n\n\t\t\t\t--Asterisk\n\n", name,
|
"want to check it when you get a chance. Thanks!\n\n\t\t\t\t--Asterisk\n\n", name,
|
||||||
dur, msgnum, mailbox, (callerid ? callerid : "an unknown caller"), date);
|
dur, msgnum, mailbox, (callerid ? callerid : "an unknown caller"), date);
|
||||||
if ((attach_user_voicemail==-1 && attach_voicemail) || attach_user_voicemail==1) {
|
if (attach_user_voicemail) {
|
||||||
fprintf(p, "--%s\n", bound);
|
fprintf(p, "--%s\n", bound);
|
||||||
fprintf(p, "Content-Type: audio/x-wav; name=\"msg%04d.%s\"\n", msgnum, format);
|
fprintf(p, "Content-Type: audio/x-wav; name=\"msg%04d.%s\"\n", msgnum, format);
|
||||||
fprintf(p, "Content-Transfer-Encoding: BASE64\n");
|
fprintf(p, "Content-Transfer-Encoding: BASE64\n");
|
||||||
@@ -2396,6 +2397,7 @@ static int append_mailbox(char *context, char *mbox, char *data)
|
|||||||
memset(vmu, 0, sizeof(struct ast_vm_user));
|
memset(vmu, 0, sizeof(struct ast_vm_user));
|
||||||
strncpy(vmu->context, context, sizeof(vmu->context));
|
strncpy(vmu->context, context, sizeof(vmu->context));
|
||||||
strncpy(vmu->mailbox, mbox, sizeof(vmu->mailbox));
|
strncpy(vmu->mailbox, mbox, sizeof(vmu->mailbox));
|
||||||
|
vmu->attach = -1;
|
||||||
stringp = tmp;
|
stringp = tmp;
|
||||||
if ((s = strsep(&stringp, ",")))
|
if ((s = strsep(&stringp, ",")))
|
||||||
strncpy(vmu->password, s, sizeof(vmu->password));
|
strncpy(vmu->password, s, sizeof(vmu->password));
|
||||||
|
Reference in New Issue
Block a user