[asterisk-commits] tilghman: branch tilghman/str_substitution r178138 - in /team/tilghman/str_su...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 23 15:51:20 CST 2009


Author: tilghman
Date: Mon Feb 23 15:51:20 2009
New Revision: 178138

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=178138
Log:
Merged revisions 178107 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
  r178107 | tilghman | 2009-02-23 15:02:18 -0600 (Mon, 23 Feb 2009) | 7 lines
  
  Permit emailsubject and emailbody to be set per mailbox.
  (closes issue #14372)
   Reported by: fhackenberger
   Patches: 
         voicemail_individual_subject_and_body_1.6.1 uploaded by fhackenberger (license 592)
         with additional fixes by Corydon76 (license 14)
........

Modified:
    team/tilghman/str_substitution/   (props changed)
    team/tilghman/str_substitution/CHANGES
    team/tilghman/str_substitution/apps/app_voicemail.c
    team/tilghman/str_substitution/configs/voicemail.conf.sample

Propchange: team/tilghman/str_substitution/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/tilghman/str_substitution/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Feb 23 15:51:20 2009
@@ -1,1 +1,1 @@
-/trunk:1-178098
+/trunk:1-178137

Modified: team/tilghman/str_substitution/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/CHANGES?view=diff&rev=178138&r1=178137&r2=178138
==============================================================================
--- team/tilghman/str_substitution/CHANGES (original)
+++ team/tilghman/str_substitution/CHANGES Mon Feb 23 15:51:20 2009
@@ -109,6 +109,8 @@
    specified in the initial argument.
  * A new application, Originate, has been introduced, that allows asynchronous
    call origination from the dialplan.
+ * Voicemail now permits setting the emailsubject and emailbody per mailbox,
+   in addition to the setting in the "general" context.
 
 Miscellaneous
 -------------

Modified: team/tilghman/str_substitution/apps/app_voicemail.c
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/apps/app_voicemail.c?view=diff&rev=178138&r1=178137&r2=178138
==============================================================================
--- team/tilghman/str_substitution/apps/app_voicemail.c (original)
+++ team/tilghman/str_substitution/apps/app_voicemail.c Mon Feb 23 15:51:20 2009
@@ -562,6 +562,8 @@
 	char password[80];               /*!< Secret pin code, numbers only */
 	char fullname[80];               /*!< Full name, for directory app */
 	char email[80];                  /*!< E-mail address */
+	char *emailsubject;              /*!< E-mail subject */
+	char *emailbody;                 /*!< E-mail body */
 	char pager[80];                  /*!< E-mail address to pager (no attachment) */
 	char serveremail[80];            /*!< From: Mail address */
 	char mailcmd[160];               /*!< Configurable mail command */
@@ -861,6 +863,8 @@
 	if (maxdeletedmsg)
 		vmu->maxdeletedmsg = maxdeletedmsg;
 	vmu->volgain = volgain;
+	vmu->emailsubject = NULL;
+	vmu->emailbody = NULL;
 }
 
 /*!
@@ -1118,6 +1122,10 @@
 			ast_copy_string(retval->fullname, var->value, sizeof(retval->fullname));
 		} else if (!strcasecmp(var->name, "context")) {
 			ast_copy_string(retval->context, var->value, sizeof(retval->context));
+		} else if (!strcasecmp(var->name, "emailsubject")) {
+			retval->emailsubject = ast_strdup(var->value);
+		} else if (!strcasecmp(var->name, "emailbody")) {
+			retval->emailbody = ast_strdup(var->value);
 #ifdef IMAP_STORAGE
 		} else if (!strcasecmp(var->name, "imapuser")) {
 			ast_copy_string(retval->imapuser, var->value, sizeof(retval->imapuser));
@@ -1437,8 +1445,17 @@
 
 static void free_user(struct ast_vm_user *vmu)
 {
-	if (ast_test_flag(vmu, VM_ALLOCED))
+	if (ast_test_flag(vmu, VM_ALLOCED)) {
+		if (vmu->emailbody != NULL) {
+			ast_free(vmu->emailbody);
+			vmu->emailbody = NULL;
+		}
+		if (vmu->emailsubject != NULL) {
+			ast_free(vmu->emailsubject);
+			vmu->emailsubject = NULL;
+		}
 		ast_free(vmu);
+	}
 }
 
 /* All IMAP-specific functions should go in this block. This
@@ -4088,11 +4105,12 @@
 		fprintf(p, "To: %s <%s>" ENDL, ast_str_quote(&str2, 0, vmu->fullname), vmu->email);
 	}
 
-	if (!ast_strlen_zero(emailsubject)) {
+	if (!ast_strlen_zero(emailsubject) || !ast_strlen_zero(vmu->emailsubject)) {
+		char *e_subj = !ast_strlen_zero(vmu->emailsubject) ? vmu->emailsubject : emailsubject;
 		struct ast_channel *ast;
 		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "Substitution/voicemail"))) {
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, category, flag);
-			ast_str_substitute_variables(&str1, 0, ast, emailsubject);
+			ast_str_substitute_variables(&str1, 0, ast, e_subj);
 			if (check_mime(ast_str_buffer(str1))) {
 				int first_line = 1;
 				char *ptr;
@@ -4170,11 +4188,12 @@
 		fprintf(p, "--%s" ENDL, bound);
 	}
 	fprintf(p, "Content-Type: text/plain; charset=%s" ENDL "Content-Transfer-Encoding: 8bit" ENDL ENDL, charset);
-	if (emailbody) {
+	if (emailbody || vmu->emailbody) {
+		char* e_body = vmu->emailbody ? vmu->emailbody : emailbody;
 		struct ast_channel *ast;
 		if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "Substitution/voicemail"))) {
 			prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, category, flag);
-			ast_str_substitute_variables(&str1, 0, ast, emailbody);
+			ast_str_substitute_variables(&str1, 0, ast, e_body);
 			fprintf(p, "%s" ENDL, ast_str_buffer(str1));
 			ast_channel_free(ast);
 		} else {

Modified: team/tilghman/str_substitution/configs/voicemail.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/team/tilghman/str_substitution/configs/voicemail.conf.sample?view=diff&rev=178138&r1=178137&r2=178138
==============================================================================
--- team/tilghman/str_substitution/configs/voicemail.conf.sample (original)
+++ team/tilghman/str_substitution/configs/voicemail.conf.sample Mon Feb 23 15:51:20 2009
@@ -316,7 +316,7 @@
 ;4300 => 3456,Ben Rigas,ben at american-computer.net
 ;4310 => -5432,Sales,sales at marko.net
 ;4069 => 6522,Matt Brooks,matt at marko.net,,|tz=central|attach=yes|saycid=yes|dialout=fromvm|callback=fromvm|review=yes|operator=yes|envelope=yes|moveheard=yes|sayduration=yes|saydurationm=1
-;4073 => 1099,Bianca Paige,bianca at biancapaige.com,,delete=1
+;4073 => 1099,Bianca Paige,bianca at biancapaige.com,,delete=1|emailsubject=You have a new voicemail.|emailbody=Click on the attachment to listen.
 ;4110 => 3443,Rob Flynn,rflynn at blueridge.net
 ;4235 => 1234,Jim Holmes,jim at astricon.ips,,Tz=european
 




More information about the asterisk-commits mailing list