diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-05-30 03:03:19 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2004-05-30 03:03:19 +0000 |
commit | 645abf497072f07122792bf767b8335a9312f4d9 (patch) | |
tree | 545f9115a822f6c6b68b705bee58d103e11f5ccf /apps/app_voicemail.c | |
parent | 125c90939e9a46cc49dec6434f780133eafc5979 (diff) |
Allow variable substitution in from string (bug #1741)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3109 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_voicemail.c')
-rwxr-xr-x | apps/app_voicemail.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 82621fd24..9ca3c9383 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -842,10 +842,21 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *m 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); |