Merged revisions 325877 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r325877 | mjordan | 2011-06-30 15:09:48 -0500 (Thu, 30 Jun 2011) | 9 lines Patched voicemail user option for emailbody / emailsubject Incorporated changes per ASTERISK-16795; updated unit tests to check for vmu->emailbody / vmu->emailsubject (closes issue ASTERISK-16795) Reported by: mdeneen Tested by: mjordan ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@325900 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
b156c7f0ad
commit
c81556d8ef
1 changed files with 21 additions and 3 deletions
|
@ -903,6 +903,8 @@ static int add_email_attachment(FILE *p, struct ast_vm_user *vmu, char *format,
|
||||||
static int is_valid_dtmf(const char *key);
|
static int is_valid_dtmf(const char *key);
|
||||||
static void read_password_from_file(const char *secretfn, char *password, int passwordlen);
|
static void read_password_from_file(const char *secretfn, char *password, int passwordlen);
|
||||||
static int write_password_to_file(const char *secretfn, const char *password);
|
static int write_password_to_file(const char *secretfn, const char *password);
|
||||||
|
static const char *substitute_escapes(const char *value);
|
||||||
|
static void free_user(struct ast_vm_user *vmu);
|
||||||
|
|
||||||
struct ao2_container *inprocess_container;
|
struct ao2_container *inprocess_container;
|
||||||
|
|
||||||
|
@ -994,7 +996,8 @@ static char *strip_control_and_high(const char *input, char *buf, size_t buflen)
|
||||||
* - the dialcontext
|
* - the dialcontext
|
||||||
* - the exitcontext
|
* - the exitcontext
|
||||||
* - vmmaxsecs, vmmaxmsg, maxdeletedmsg
|
* - vmmaxsecs, vmmaxmsg, maxdeletedmsg
|
||||||
* - volume gain.
|
* - volume gain
|
||||||
|
* - emailsubject, emailbody set to NULL
|
||||||
*/
|
*/
|
||||||
static void populate_defaults(struct ast_vm_user *vmu)
|
static void populate_defaults(struct ast_vm_user *vmu)
|
||||||
{
|
{
|
||||||
|
@ -1045,6 +1048,10 @@ static void apply_option(struct ast_vm_user *vmu, const char *var, const char *v
|
||||||
ast_copy_string(vmu->attachfmt, value, sizeof(vmu->attachfmt));
|
ast_copy_string(vmu->attachfmt, value, sizeof(vmu->attachfmt));
|
||||||
} else if (!strcasecmp(var, "serveremail")) {
|
} else if (!strcasecmp(var, "serveremail")) {
|
||||||
ast_copy_string(vmu->serveremail, value, sizeof(vmu->serveremail));
|
ast_copy_string(vmu->serveremail, value, sizeof(vmu->serveremail));
|
||||||
|
} else if (!strcasecmp(var, "emailbody")) {
|
||||||
|
vmu->emailbody = ast_strdup(substitute_escapes(value));
|
||||||
|
} else if (!strcasecmp(var, "emailsubject")) {
|
||||||
|
vmu->emailsubject = ast_strdup(substitute_escapes(value));
|
||||||
} else if (!strcasecmp(var, "language")) {
|
} else if (!strcasecmp(var, "language")) {
|
||||||
ast_copy_string(vmu->language, value, sizeof(vmu->language));
|
ast_copy_string(vmu->language, value, sizeof(vmu->language));
|
||||||
} else if (!strcasecmp(var, "tz")) {
|
} else if (!strcasecmp(var, "tz")) {
|
||||||
|
@ -1382,7 +1389,7 @@ static struct ast_vm_user *find_user_realtime(struct ast_vm_user *ivm, const cha
|
||||||
ast_variables_destroy(var);
|
ast_variables_destroy(var);
|
||||||
} else {
|
} else {
|
||||||
if (!ivm)
|
if (!ivm)
|
||||||
ast_free(retval);
|
free_user(retval);
|
||||||
retval = NULL;
|
retval = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10637,7 +10644,9 @@ AST_TEST_DEFINE(test_voicemail_vmuser)
|
||||||
"envelope=yes|moveheard=yes|sayduration=yes|saydurationm=5|forcename=yes|"
|
"envelope=yes|moveheard=yes|sayduration=yes|saydurationm=5|forcename=yes|"
|
||||||
"forcegreetings=yes|callback=somecontext|dialout=somecontext2|"
|
"forcegreetings=yes|callback=somecontext|dialout=somecontext2|"
|
||||||
"exitcontext=somecontext3|minsecs=10|maxsecs=100|nextaftercmd=yes|"
|
"exitcontext=somecontext3|minsecs=10|maxsecs=100|nextaftercmd=yes|"
|
||||||
"backupdeleted=50|volgain=1.3|passwordlocation=spooldir";
|
"backupdeleted=50|volgain=1.3|passwordlocation=spooldir|emailbody="
|
||||||
|
"Dear ${VM_NAME}:\n\n\tYou were just left a ${VM_DUR} long message|emailsubject="
|
||||||
|
"[PBX]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}";
|
||||||
#ifdef IMAP_STORAGE
|
#ifdef IMAP_STORAGE
|
||||||
static const char option_string2[] = "imapuser=imapuser|imappassword=imappasswd|"
|
static const char option_string2[] = "imapuser=imapuser|imappassword=imappasswd|"
|
||||||
"imapfolder=INBOX|imapvmshareid=6000";
|
"imapfolder=INBOX|imapvmshareid=6000";
|
||||||
|
@ -10659,6 +10668,7 @@ AST_TEST_DEFINE(test_voicemail_vmuser)
|
||||||
return AST_TEST_NOT_RUN;
|
return AST_TEST_NOT_RUN;
|
||||||
}
|
}
|
||||||
ast_set_flag(vmu, VM_ALLOCED);
|
ast_set_flag(vmu, VM_ALLOCED);
|
||||||
|
populate_defaults(vmu);
|
||||||
|
|
||||||
apply_options(vmu, options_string);
|
apply_options(vmu, options_string);
|
||||||
|
|
||||||
|
@ -10674,6 +10684,14 @@ AST_TEST_DEFINE(test_voicemail_vmuser)
|
||||||
ast_test_status_update(test, "Parse failure for serveremail option\n");
|
ast_test_status_update(test, "Parse failure for serveremail option\n");
|
||||||
res = 1;
|
res = 1;
|
||||||
}
|
}
|
||||||
|
if (!vmu->emailsubject || strcasecmp(vmu->emailsubject, "[PBX]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}")) {
|
||||||
|
ast_test_status_update(test, "Parse failure for emailsubject option\n");
|
||||||
|
res = 1;
|
||||||
|
}
|
||||||
|
if (!vmu->emailbody || strcasecmp(vmu->emailbody, "Dear ${VM_NAME}:\n\n\tYou were just left a ${VM_DUR} long message")) {
|
||||||
|
ast_test_status_update(test, "Parse failure for emailbody option\n");
|
||||||
|
res = 1;
|
||||||
|
}
|
||||||
if (strcasecmp(vmu->zonetag, "central")) {
|
if (strcasecmp(vmu->zonetag, "central")) {
|
||||||
ast_test_status_update(test, "Parse failure for tz option\n");
|
ast_test_status_update(test, "Parse failure for tz option\n");
|
||||||
res = 1;
|
res = 1;
|
||||||
|
|
Loading…
Reference in a new issue