allow user-configurable date formats in voicemail message body (bug #4554)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6050 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Kevin P. Fleming 21 years ago
parent 608eec66d6
commit 64cf50c8e1

@ -338,6 +338,7 @@ static char charset[32] = "ISO-8859-1";
static char adsifdn[4] = "\x00\x00\x00\x0F"; static char adsifdn[4] = "\x00\x00\x00\x0F";
static char adsisec[4] = "\x9B\xDB\xF7\xAC"; static char adsisec[4] = "\x9B\xDB\xF7\xAC";
static int adsiver = 1; static int adsiver = 1;
static char emaildateformat[32] = "%A, %B %d, %Y at %r";
STANDARD_LOCAL_USER; STANDARD_LOCAL_USER;
@ -1540,6 +1541,9 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c
strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", &tm); strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", &tm);
fprintf(p, "Date: %s\n", date); fprintf(p, "Date: %s\n", date);
/* Set date format for voicemail mail */
strftime(date, sizeof(date), emaildateformat, &tm);
if (*fromstring) { if (*fromstring) {
struct ast_channel *ast = ast_channel_alloc(0); struct ast_channel *ast = ast_channel_alloc(0);
if (ast) { if (ast) {
@ -1589,7 +1593,6 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *c
fprintf(p, "--%s\n", bound); fprintf(p, "--%s\n", bound);
} }
fprintf(p, "Content-Type: text/plain; charset=%s\nContent-Transfer-Encoding: 8bit\n\n", charset); fprintf(p, "Content-Type: text/plain; charset=%s\nContent-Transfer-Encoding: 8bit\n\n", charset);
strftime(date, sizeof(date), "%A, %B %d, %Y at %r", &tm);
if (emailbody) { if (emailbody) {
struct ast_channel *ast = ast_channel_alloc(0); struct ast_channel *ast = ast_channel_alloc(0);
if (ast) { if (ast) {
@ -5300,6 +5303,7 @@ static int load_config(void)
char *callbackcxt = NULL; char *callbackcxt = NULL;
char *exitcxt = NULL; char *exitcxt = NULL;
char *extpc; char *extpc;
char *emaildateformatstr;
int x; int x;
int tmpadsi[4]; int tmpadsi[4];
@ -5349,6 +5353,11 @@ static int load_config(void)
maxsilence *= 1000; maxsilence *= 1000;
} }
/* Load date format config for voicemail mail */
if ((emaildateformatstr = ast_variable_retrieve(cfg, "general", "emaildateformat"))) {
strncpy(emaildateformat, emaildateformatstr, sizeof(emaildateformat) - 1);
}
/* External password changing command */ /* External password changing command */
if ((extpc = ast_variable_retrieve(cfg, "general", "externpass"))) { if ((extpc = ast_variable_retrieve(cfg, "general", "externpass"))) {
strncpy(ext_pass_cmd,extpc,sizeof(ext_pass_cmd) - 1); strncpy(ext_pass_cmd,extpc,sizeof(ext_pass_cmd) - 1);

@ -61,6 +61,12 @@ maxlogins=3
; The following definition is very close to the default, but the default shows just ; The following definition is very close to the default, but the default shows just
; the CIDNAME, if it is not null, else just the CIDNUM, or "an unknown caller" if they are both null. ; the CIDNAME, if it is not null, else just the CIDNUM, or "an unknown caller" if they are both null.
;emailbody=Dear ${VM_NAME}:\n\n\tjust wanted to let you know you were just left a ${VM_DUR} long message (number ${VM_MSGNUM})\nin mailbox ${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE}, so you might\nwant to check it when you get a chance. Thanks!\n\n\t\t\t\t--Asterisk\n ;emailbody=Dear ${VM_NAME}:\n\n\tjust wanted to let you know you were just left a ${VM_DUR} long message (number ${VM_MSGNUM})\nin mailbox ${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE}, so you might\nwant to check it when you get a chance. Thanks!\n\n\t\t\t\t--Asterisk\n
; Set the date format on outgoing mails. Valid arguments can be found on the strftime(3) man page
;
; Default
emaildateformat=%A, %B %d, %Y at %r
; 24h date format
;emaildateformat=%A, %d %B %Y at %H:%M:%S
; ;
; You can override the default program to send e-mail if you wish, too ; You can override the default program to send e-mail if you wish, too

Loading…
Cancel
Save