diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 61f63d3f8..64bee7beb 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -338,6 +338,7 @@ static char charset[32] = "ISO-8859-1"; static char adsifdn[4] = "\x00\x00\x00\x0F"; static char adsisec[4] = "\x9B\xDB\xF7\xAC"; static int adsiver = 1; +static char emaildateformat[32] = "%A, %B %d, %Y at %r"; 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); fprintf(p, "Date: %s\n", date); + /* Set date format for voicemail mail */ + strftime(date, sizeof(date), emaildateformat, &tm); + if (*fromstring) { struct ast_channel *ast = ast_channel_alloc(0); 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, "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) { struct ast_channel *ast = ast_channel_alloc(0); if (ast) { @@ -5300,6 +5303,7 @@ static int load_config(void) char *callbackcxt = NULL; char *exitcxt = NULL; char *extpc; + char *emaildateformatstr; int x; int tmpadsi[4]; @@ -5349,6 +5353,11 @@ static int load_config(void) 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 */ if ((extpc = ast_variable_retrieve(cfg, "general", "externpass"))) { strncpy(ext_pass_cmd,extpc,sizeof(ext_pass_cmd) - 1); diff --git a/configs/voicemail.conf.sample b/configs/voicemail.conf.sample index 8cff4a803..da00c6fa7 100755 --- a/configs/voicemail.conf.sample +++ b/configs/voicemail.conf.sample @@ -61,6 +61,12 @@ maxlogins=3 ; 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. ;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