From: <abe...@us...> - 2014-08-09 22:59:36
|
Revision: 6622 http://sourceforge.net/p/astlinux/code/6622 Author: abelbeck Date: 2014-08-09 22:59:26 +0000 (Sat, 09 Aug 2014) Log Message: ----------- asterisk, back-port Asterisk 13 r420577 (plus minor fix) to allow voicemail to include multiple recipients Revision Links: -------------- http://sourceforge.net/p/astlinux/code/420577 Added Paths: ----------- branches/1.0/package/asterisk/asterisk-1.8-voicemail-multiple-recipients.patch branches/1.0/package/asterisk/asterisk-11-voicemail-multiple-recipients.patch Added: branches/1.0/package/asterisk/asterisk-1.8-voicemail-multiple-recipients.patch =================================================================== --- branches/1.0/package/asterisk/asterisk-1.8-voicemail-multiple-recipients.patch (rev 0) +++ branches/1.0/package/asterisk/asterisk-1.8-voicemail-multiple-recipients.patch 2014-08-09 22:59:26 UTC (rev 6622) @@ -0,0 +1,155 @@ +--- asterisk-1.8.29.0/apps/app_voicemail.c.orig 2014-05-09 17:18:59.000000000 -0500 ++++ asterisk-1.8.29.0/apps/app_voicemail.c 2014-08-09 11:49:46.000000000 -0500 +@@ -643,7 +643,7 @@ + char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox id, unique within vm context */ + char password[80]; /*!< Secret pin code, numbers only */ + char fullname[80]; /*!< Full name, for directory app */ +- char email[80]; /*!< E-mail address */ ++ char *email; /*!< E-mail address */ + char *emailsubject; /*!< E-mail subject */ + char *emailbody; /*!< E-mail body */ + char pager[80]; /*!< E-mail address to pager (no attachment) */ +@@ -1043,6 +1043,8 @@ + vmu->maxdeletedmsg = maxdeletedmsg; + } + vmu->volgain = volgain; ++ ast_free(vmu->email); ++ vmu->email = NULL; + ast_free(vmu->emailsubject); + vmu->emailsubject = NULL; + ast_free(vmu->emailbody); +@@ -1339,7 +1341,8 @@ + } else if (!strcasecmp(var->name, "pager")) { + ast_copy_string(retval->pager, var->value, sizeof(retval->pager)); + } else if (!strcasecmp(var->name, "email")) { +- ast_copy_string(retval->email, var->value, sizeof(retval->email)); ++ ast_free(retval->email); ++ retval->email = ast_strdup(var->value); + } else if (!strcasecmp(var->name, "fullname")) { + ast_copy_string(retval->fullname, var->value, sizeof(retval->fullname)); + } else if (!strcasecmp(var->name, "context")) { +@@ -1466,6 +1469,7 @@ + if ((vmu = (ivm ? ivm : ast_malloc(sizeof(*vmu))))) { + *vmu = *cur; + if (!ivm) { ++ vmu->email = ast_strdup(cur->email); + vmu->emailbody = ast_strdup(cur->emailbody); + vmu->emailsubject = ast_strdup(cur->emailsubject); + } +@@ -1761,6 +1765,9 @@ + { + if (ast_test_flag(vmu, VM_ALLOCED)) { + ++ ast_free(vmu->email); ++ vmu->email = NULL; ++ + ast_free(vmu->emailbody); + vmu->emailbody = NULL; + +@@ -2297,7 +2304,7 @@ + * of this function, we will revert back to an empty string if tempcopy + * is 1. + */ +- ast_copy_string(vmu->email, vmu->imapuser, sizeof(vmu->email)); ++ vmu->email = ast_strdup(vmu->imapuser); + tempcopy = 1; + } + +@@ -2309,8 +2316,10 @@ + command hangs. */ + if (!(p = vm_mkftemp(tmp))) { + ast_log(AST_LOG_WARNING, "Unable to store '%s' (can't create temporary file)\n", fn); +- if (tempcopy) +- *(vmu->email) = '\0'; ++ if (tempcopy) { ++ ast_free(vmu->email); ++ vmu->email = NULL; ++ } + return -1; + } + +@@ -4563,6 +4572,9 @@ + struct ast_str *str1 = ast_str_create(16), *str2 = ast_str_create(16); + char *greeting_attachment; + char filename[256]; ++ int first_line; ++ char *emailsbuf; ++ char *email; + + if (!str1 || !str2) { + ast_free(str1); +@@ -4604,7 +4616,7 @@ + ast_str_substitute_variables(&str1, 0, ast, fromstring); + + if (check_mime(ast_str_buffer(str1))) { +- int first_line = 1; ++ first_line = 1; + ast_str_encode_mime(&str2, 0, ast_str_buffer(str1), strlen("From: "), strlen(who) + 3); + while ((ptr = strchr(ast_str_buffer(str2), ' '))) { + *ptr = '\0'; +@@ -4625,20 +4637,25 @@ + fprintf(p, "From: Asterisk PBX <%s>" ENDL, who); + } + +- if (check_mime(vmu->fullname)) { +- int first_line = 1; +- char *ptr; +- ast_str_encode_mime(&str2, 0, vmu->fullname, strlen("To: "), strlen(vmu->email) + 3); +- while ((ptr = strchr(ast_str_buffer(str2), ' '))) { +- *ptr = '\0'; +- fprintf(p, "%s %s" ENDL, first_line ? "To:" : "", ast_str_buffer(str2)); +- first_line = 0; +- /* Substring is smaller, so this will never grow */ +- ast_str_set(&str2, 0, "%s", ptr + 1); ++ emailsbuf = ast_strdupa(vmu->email); ++ fprintf(p, "To:"); ++ first_line = 1; ++ while ((email = strsep(&emailsbuf, "|"))) { ++ char *next = emailsbuf; ++ if (check_mime(vmu->fullname)) { ++ char *ptr; ++ ast_str_encode_mime(&str2, 0, vmu->fullname, first_line ? strlen("To: ") : 0, strlen(email) + 3 + (next ? strlen(",") : 0)); ++ while ((ptr = strchr(ast_str_buffer(str2), ' '))) { ++ *ptr = '\0'; ++ fprintf(p, " %s" ENDL, ast_str_buffer(str2)); ++ /* Substring is smaller, so this will never grow */ ++ ast_str_set(&str2, 0, "%s", ptr + 1); ++ } ++ fprintf(p, " %s <%s>%s" ENDL, ast_str_buffer(str2), email, next ? "," : ""); ++ } else { ++ fprintf(p, " %s <%s>%s" ENDL, ast_str_quote(&str2, 0, vmu->fullname), email, next ? "," : ""); + } +- fprintf(p, "%s %s <%s>" ENDL, first_line ? "To:" : "", ast_str_buffer(str2), vmu->email); +- } else { +- fprintf(p, "To: %s <%s>" ENDL, ast_str_quote(&str2, 0, vmu->fullname), vmu->email); ++ first_line = 0; + } + + if (!ast_strlen_zero(emailsubject) || !ast_strlen_zero(vmu->emailsubject)) { +@@ -4648,7 +4665,7 @@ + prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, cidnum, cidname, dur, date, category, flag); + ast_str_substitute_variables(&str1, 0, ast, e_subj); + if (check_mime(ast_str_buffer(str1))) { +- int first_line = 1; ++ first_line = 1; + char *ptr; + ast_str_encode_mime(&str2, 0, ast_str_buffer(str1), strlen("Subject: "), 0); + while ((ptr = strchr(ast_str_buffer(str2), ' '))) { +@@ -10825,7 +10842,7 @@ + ast_copy_string(vmu->fullname, s, sizeof(vmu->fullname)); + } + if (stringp && (s = strsep(&stringp, ","))) { +- ast_copy_string(vmu->email, s, sizeof(vmu->email)); ++ vmu->email = ast_strdup(s); + } + if (stringp && (s = strsep(&stringp, ","))) { + ast_copy_string(vmu->pager, s, sizeof(vmu->pager)); +@@ -12985,7 +13002,7 @@ + } + + populate_defaults(vmu); +- ast_copy_string(vmu->email, "te...@ex...", sizeof(vmu->email)); ++ vmu->email = ast_strdup("te...@ex..."); + #ifdef IMAP_STORAGE + /* TODO When we set up the IMAP server test, we'll need to have credentials for the VMU structure added here */ + #endif Added: branches/1.0/package/asterisk/asterisk-11-voicemail-multiple-recipients.patch =================================================================== --- branches/1.0/package/asterisk/asterisk-11-voicemail-multiple-recipients.patch (rev 0) +++ branches/1.0/package/asterisk/asterisk-11-voicemail-multiple-recipients.patch 2014-08-09 22:59:26 UTC (rev 6622) @@ -0,0 +1,155 @@ +--- asterisk-11.11.0/apps/app_voicemail.c.orig 2014-05-09 17:28:40.000000000 -0500 ++++ asterisk-11.11.0/apps/app_voicemail.c 2014-08-09 11:29:01.000000000 -0500 +@@ -748,7 +748,7 @@ + char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox id, unique within vm context */ + char password[80]; /*!< Secret pin code, numbers only */ + char fullname[80]; /*!< Full name, for directory app */ +- char email[80]; /*!< E-mail address */ ++ char *email; /*!< E-mail address */ + char *emailsubject; /*!< E-mail subject */ + char *emailbody; /*!< E-mail body */ + char pager[80]; /*!< E-mail address to pager (no attachment) */ +@@ -1188,6 +1188,8 @@ + vmu->maxdeletedmsg = maxdeletedmsg; + } + vmu->volgain = volgain; ++ ast_free(vmu->email); ++ vmu->email = NULL; + ast_free(vmu->emailsubject); + vmu->emailsubject = NULL; + ast_free(vmu->emailbody); +@@ -1499,7 +1501,8 @@ + } else if (!strcasecmp(var->name, "pager")) { + ast_copy_string(retval->pager, var->value, sizeof(retval->pager)); + } else if (!strcasecmp(var->name, "email")) { +- ast_copy_string(retval->email, var->value, sizeof(retval->email)); ++ ast_free(retval->email); ++ retval->email = ast_strdup(var->value); + } else if (!strcasecmp(var->name, "fullname")) { + ast_copy_string(retval->fullname, var->value, sizeof(retval->fullname)); + } else if (!strcasecmp(var->name, "context")) { +@@ -1636,6 +1639,7 @@ + if ((vmu = (ivm ? ivm : ast_malloc(sizeof(*vmu))))) { + *vmu = *cur; + if (!ivm) { ++ vmu->email = ast_strdup(cur->email); + vmu->emailbody = ast_strdup(cur->emailbody); + vmu->emailsubject = ast_strdup(cur->emailsubject); + } +@@ -1918,6 +1922,9 @@ + { + if (ast_test_flag(vmu, VM_ALLOCED)) { + ++ ast_free(vmu->email); ++ vmu->email = NULL; ++ + ast_free(vmu->emailbody); + vmu->emailbody = NULL; + +@@ -2538,7 +2545,7 @@ + * of this function, we will revert back to an empty string if tempcopy + * is 1. + */ +- ast_copy_string(vmu->email, vmu->imapuser, sizeof(vmu->email)); ++ vmu->email = ast_strdup(vmu->imapuser); + tempcopy = 1; + } + +@@ -2550,8 +2557,10 @@ + command hangs. */ + if (!(p = vm_mkftemp(tmp))) { + ast_log(AST_LOG_WARNING, "Unable to store '%s' (can't create temporary file)\n", fn); +- if (tempcopy) +- *(vmu->email) = '\0'; ++ if (tempcopy) { ++ ast_free(vmu->email); ++ vmu->email = NULL; ++ } + return -1; + } + +@@ -4873,6 +4882,9 @@ + struct ast_str *str1 = ast_str_create(16), *str2 = ast_str_create(16); + char *greeting_attachment; + char filename[256]; ++ int first_line; ++ char *emailsbuf; ++ char *email; + + if (!str1 || !str2) { + ast_free(str1); +@@ -4914,7 +4926,7 @@ + ast_str_substitute_variables(&str1, 0, ast, fromstring); + + if (check_mime(ast_str_buffer(str1))) { +- int first_line = 1; ++ first_line = 1; + ast_str_encode_mime(&str2, 0, ast_str_buffer(str1), strlen("From: "), strlen(who) + 3); + while ((ptr = strchr(ast_str_buffer(str2), ' '))) { + *ptr = '\0'; +@@ -4935,20 +4947,25 @@ + fprintf(p, "From: Asterisk PBX <%s>" ENDL, who); + } + +- if (check_mime(vmu->fullname)) { +- int first_line = 1; +- char *ptr; +- ast_str_encode_mime(&str2, 0, vmu->fullname, strlen("To: "), strlen(vmu->email) + 3); +- while ((ptr = strchr(ast_str_buffer(str2), ' '))) { +- *ptr = '\0'; +- fprintf(p, "%s %s" ENDL, first_line ? "To:" : "", ast_str_buffer(str2)); +- first_line = 0; +- /* Substring is smaller, so this will never grow */ +- ast_str_set(&str2, 0, "%s", ptr + 1); ++ emailsbuf = ast_strdupa(vmu->email); ++ fprintf(p, "To:"); ++ first_line = 1; ++ while ((email = strsep(&emailsbuf, "|"))) { ++ char *next = emailsbuf; ++ if (check_mime(vmu->fullname)) { ++ char *ptr; ++ ast_str_encode_mime(&str2, 0, vmu->fullname, first_line ? strlen("To: ") : 0, strlen(email) + 3 + (next ? strlen(",") : 0)); ++ while ((ptr = strchr(ast_str_buffer(str2), ' '))) { ++ *ptr = '\0'; ++ fprintf(p, " %s" ENDL, ast_str_buffer(str2)); ++ /* Substring is smaller, so this will never grow */ ++ ast_str_set(&str2, 0, "%s", ptr + 1); ++ } ++ fprintf(p, " %s <%s>%s" ENDL, ast_str_buffer(str2), email, next ? "," : ""); ++ } else { ++ fprintf(p, " %s <%s>%s" ENDL, ast_str_quote(&str2, 0, vmu->fullname), email, next ? "," : ""); + } +- fprintf(p, "%s %s <%s>" ENDL, first_line ? "To:" : "", ast_str_buffer(str2), vmu->email); +- } else { +- fprintf(p, "To: %s <%s>" ENDL, ast_str_quote(&str2, 0, vmu->fullname), vmu->email); ++ first_line = 0; + } + + if (!ast_strlen_zero(emailsubject) || !ast_strlen_zero(vmu->emailsubject)) { +@@ -4958,7 +4975,7 @@ + prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, fromfolder, cidnum, cidname, dur, date, category, flag); + ast_str_substitute_variables(&str1, 0, ast, e_subj); + if (check_mime(ast_str_buffer(str1))) { +- int first_line = 1; ++ first_line = 1; + char *ptr; + ast_str_encode_mime(&str2, 0, ast_str_buffer(str1), strlen("Subject: "), 0); + while ((ptr = strchr(ast_str_buffer(str2), ' '))) { +@@ -11713,7 +11730,7 @@ + ast_copy_string(vmu->fullname, s, sizeof(vmu->fullname)); + } + if (stringp && (s = strsep(&stringp, ","))) { +- ast_copy_string(vmu->email, s, sizeof(vmu->email)); ++ vmu->email = ast_strdup(s); + } + if (stringp && (s = strsep(&stringp, ","))) { + ast_copy_string(vmu->pager, s, sizeof(vmu->pager)); +@@ -13982,7 +13999,7 @@ + } + + populate_defaults(vmu); +- ast_copy_string(vmu->email, "te...@ex...", sizeof(vmu->email)); ++ vmu->email = ast_strdup("te...@ex..."); + #ifdef IMAP_STORAGE + /* TODO When we set up the IMAP server test, we'll need to have credentials for the VMU structure added here */ + #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |