[Asterisk-cvs] asterisk/apps app_voicemail.c,1.103,1.104
markster at lists.digium.com
markster at lists.digium.com
Sat May 29 22:47:55 CDT 2004
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv19866/apps
Modified Files:
app_voicemail.c
Log Message:
Allow variable substitution in from string (bug #1741)
Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- app_voicemail.c 27 May 2004 22:35:47 -0000 1.103
+++ app_voicemail.c 30 May 2004 03:03:19 -0000 1.104
@@ -842,10 +842,21 @@
ast_localtime(&t,&tm,NULL);
strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S %z", &tm);
fprintf(p, "Date: %s\n", date);
-
- if (*fromstring)
- fprintf(p, "From: %s <%s>\n", fromstring, who);
- else
+
+ if (*fromstring) {
+ struct ast_channel *ast = ast_channel_alloc(0);
+ if (ast) {
+ char *passdata;
+ int vmlen = strlen(fromstring)*3 + 200;
+ if ((passdata = alloca(vmlen))) {
+ memset(passdata, 0, vmlen);
+ prep_email_sub_vars(ast,vmu,msgnum + 1,mailbox,callerid,dur,date,passdata);
+ pbx_substitute_variables_helper(ast,fromstring,passdata,vmlen);
+ fprintf(p, "From: %s <%s>\n",passdata,who);
+ } else ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
+ ast_channel_free(ast);
+ } else ast_log(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
+ } else
fprintf(p, "From: Asterisk PBX <%s>\n", who);
fprintf(p, "To: %s <%s>\n", vmu->fullname, vmu->email);
More information about the svn-commits
mailing list