Review Board 1.7.16


Voicemail send email to multiple email addresses

Review Request #3829 - Created July 18, 2014 and submitted

Jacob Barber
12
ASTERISK-24045
Reviewers
asterisk-dev
Asterisk
Currently voicemail to email only works with a single email. This patch allows a user to use a space separated list of emails (up to 512 characters long), where the user would like for the emails to be sent. This is useful for people who don't want to go through setting up mailing groups, or for people who host provide VoIP services with asterisk as a backend, where their customers don't know how to set up mailing groups.
Tested calling and sending voicemails using the mysql realtime database and using the standard voicemail.conf implementation.

Diff revision 3 (Latest)

1 2 3
1 2 3

  1. /branches/12/apps/app_voicemail.c: Loading...
/branches/12/apps/app_voicemail.c
Revision 418713 New Change
[20] 782 lines
[+20] [+] struct baseio {
783
struct ast_vm_user {
783
struct ast_vm_user {
784
	char context[AST_MAX_CONTEXT];   /*!< Voicemail context */
784
	char context[AST_MAX_CONTEXT];   /*!< Voicemail context */
785
	char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox id, unique within vm context */
785
	char mailbox[AST_MAX_EXTENSION]; /*!< Mailbox id, unique within vm context */
786
	char password[80];               /*!< Secret pin code, numbers only */
786
	char password[80];               /*!< Secret pin code, numbers only */
787
	char fullname[80];               /*!< Full name, for directory app */
787
	char fullname[80];               /*!< Full name, for directory app */
788
	char email[80];                  /*!< E-mail address */
788
	char email[512];                  /*!< E-mail address */
789
	char *emailsubject;              /*!< E-mail subject */
789
	char *emailsubject;              /*!< E-mail subject */
790
	char *emailbody;                 /*!< E-mail body */
790
	char *emailbody;                 /*!< E-mail body */
791
	char pager[80];                  /*!< E-mail address to pager (no attachment) */
791
	char pager[80];                  /*!< E-mail address to pager (no attachment) */
792
	char serveremail[80];            /*!< From: Mail address */
792
	char serveremail[80];            /*!< From: Mail address */
793
	char language[MAX_LANGUAGE];     /*!< Config: Language setting */
793
	char language[MAX_LANGUAGE];     /*!< Config: Language setting */
[+20] [20] 4158 lines
[+20] [+] static void make_email_file(FILE *p,
4952
	struct ast_tm tm;
4952
	struct ast_tm tm;
4953
	char enc_cidnum[256] = "", enc_cidname[256] = "";
4953
	char enc_cidnum[256] = "", enc_cidname[256] = "";
4954
	struct ast_str *str1 = ast_str_create(16), *str2 = ast_str_create(16);
4954
	struct ast_str *str1 = ast_str_create(16), *str2 = ast_str_create(16);
4955
	char *greeting_attachment; 
4955
	char *greeting_attachment; 
4956
	char filename[256];
4956
	char filename[256];

    
   
4957
	char *tmp;

    
   
4958
	char *email;
4957

    
   
4959

   
4958
	if (!str1 || !str2) {
4960
	if (!str1 || !str2) {
4959
		ast_free(str1);
4961
		ast_free(str1);
4960
		ast_free(str2);
4962
		ast_free(str2);
4961
		return;
4963
		return;
[+20] [20] 52 lines
[+20] static void make_email_file(FILE *p,
5014
		}
5016
		}
5015
	} else {
5017
	} else {
5016
		fprintf(p, "From: Asterisk PBX <%s>" ENDL, who);
5018
		fprintf(p, "From: Asterisk PBX <%s>" ENDL, who);
5017
	}
5019
	}
5018

    
   
5020

   
5019
	if (check_mime(vmu->fullname)) {
5021
	if (strchr(vmu->email, ' ')) {

    
   
5022
		fprintf(p, "To: ");

    
   
5023
		tmp = ast_strdupa(vmu->email);

    
   
5024
		while ((email = strsep(&tmp, " "))) {

    
   
5025
			/* Only append to the TO field if the string isn't empty */

    
   
5026
			if(*email != '\0'){

    
   
5027
				fprintf(p, "%s <%s>,", ast_str_quote(&str2, 0, vmu->fullname), email);

    
   
5028
			}

    
   
5029
		}

    
   
5030
		fprintf(p, ENDL);

    
   
5031
	} else if (check_mime(vmu->fullname)) {
5020
		int first_line = 1;
5032
		int first_line = 1;
5021
		char *ptr;
5033
		char *ptr;
5022
		ast_str_encode_mime(&str2, 0, vmu->fullname, strlen("To: "), strlen(vmu->email) + 3);
5034
		ast_str_encode_mime(&str2, 0, vmu->fullname, strlen("To: "), strlen(vmu->email) + 3);
5023
		while ((ptr = strchr(ast_str_buffer(str2), ' '))) {
5035
		while ((ptr = strchr(ast_str_buffer(str2), ' '))) {
5024
			*ptr = '\0';
5036
			*ptr = '\0';
[+20] [20] 10744 lines
  1. /branches/12/apps/app_voicemail.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.