[Asterisk-Dev] BOUNTY: 100$ Name before Voicemail Playback
Matt Gibson
m.gibson at voxip.ca
Sun Sep 25 13:57:31 MST 2005
Hi Kevin,
Kevin P. Fleming wrote:
> That has not been implemented at this time, but it would be a fairly
> trivial patch, if you wish to do it.
Sorry to bother you, but can you tell us if this patch is along the
right course to make the category
be displayed in the email? We have tried variations on this but cannot
get it to work. We're not really
C coders so keep that in mind if this is totally wrong :)
I'll attach our little patch to this email.
Thanks for your time,
Matt G
-------------- next part --------------
--- app_voicemail.c.backups 2005-09-23 17:33:41.000000000 -0400
+++ app_voicemail.c 2005-09-24 19:15:44.000000000 -0400
@@ -1589,7 +1589,7 @@
return 1;
}
-static void prep_email_sub_vars(struct ast_channel *ast, struct ast_vm_user *vmu, int msgnum, char *context, char *mailbox, char *cidnum, char *cidname, char *dur, char *date, char *passdata, size_t passdatasize)
+static void prep_email_sub_vars(struct ast_channel *ast, struct ast_vm_user *vmu, int msgnum, char *context, char *mailbox, char *cidnum, char *cidname, char *dur, char *date, char *category, char *passdata, size_t passdatasize)
{
char callerid[256];
/* Prepare variables for substition in email body and subject */
@@ -1603,6 +1603,7 @@
pbx_builtin_setvar_helper(ast, "VM_CIDNAME", (cidname ? cidname : "an unknown caller"));
pbx_builtin_setvar_helper(ast, "VM_CIDNUM", (cidnum ? cidnum : "an unknown caller"));
pbx_builtin_setvar_helper(ast, "VM_DATE", date);
+ pbx_builtin_setvar_helper(ast, "VM_CATEGORY", category);
}
static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *context, char *mailbox, char *cidnum, char *cidname, char *attach, char *format, int duration, int attach_user_voicemail)
@@ -1617,6 +1618,7 @@
char dur[256];
char tmp[80] = "/tmp/astmail-XXXXXX";
char tmp2[256];
+ char category[256];
time_t t;
struct tm tm;
struct vm_zone *the_zone = NULL;
@@ -1678,7 +1680,7 @@
int vmlen = strlen(fromstring)*3 + 200;
if ((passdata = alloca(vmlen))) {
memset(passdata, 0, vmlen);
- prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,passdata, vmlen);
+ prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,category,passdata, vmlen);
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");
@@ -1695,7 +1697,7 @@
int vmlen = strlen(emailsubject)*3 + 200;
if ((passdata = alloca(vmlen))) {
memset(passdata, 0, vmlen);
- prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,passdata, vmlen);
+ prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,category,passdata, vmlen);
pbx_substitute_variables_helper(ast,emailsubject,passdata,vmlen);
fprintf(p, "Subject: %s\n",passdata);
} else ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
@@ -1727,7 +1729,7 @@
int vmlen = strlen(emailbody)*3 + 200;
if ((passdata = alloca(vmlen))) {
memset(passdata, 0, vmlen);
- prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,passdata, vmlen);
+ prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,category,passdata, vmlen);
pbx_substitute_variables_helper(ast,emailbody,passdata,vmlen);
fprintf(p, "%s\n",passdata);
} else ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
@@ -1777,6 +1779,7 @@
char dur[256];
char tmp[80] = "/tmp/astmail-XXXXXX";
char tmp2[256];
+ char category[256];
time_t t;
struct tm tm;
struct vm_zone *the_zone = NULL;
@@ -1829,7 +1832,7 @@
int vmlen = strlen(fromstring)*3 + 200;
if ((passdata = alloca(vmlen))) {
memset(passdata, 0, vmlen);
- prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,passdata, vmlen);
+ prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,category,passdata, vmlen);
pbx_substitute_variables_helper(ast,pagerfromstring,passdata,vmlen);
fprintf(p, "From: %s <%s>\n",passdata,who);
} else
@@ -1846,7 +1849,7 @@
int vmlen = strlen(pagersubject)*3 + 200;
if ((passdata = alloca(vmlen))) {
memset(passdata, 0, vmlen);
- prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,passdata, vmlen);
+ prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,category,passdata, vmlen);
pbx_substitute_variables_helper(ast,pagersubject,passdata,vmlen);
fprintf(p, "Subject: %s\n\n",passdata);
} else ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
@@ -1862,7 +1865,7 @@
int vmlen = strlen(pagerbody)*3 + 200;
if ((passdata = alloca(vmlen))) {
memset(passdata, 0, vmlen);
- prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,passdata, vmlen);
+ prep_email_sub_vars(ast,vmu,msgnum + 1,context,mailbox,cidnum, cidname,dur,date,category,passdata, vmlen);
pbx_substitute_variables_helper(ast,pagerbody,passdata,vmlen);
fprintf(p, "%s\n",passdata);
} else ast_log(LOG_WARNING, "Cannot allocate workspace for variable substitution\n");
More information about the asterisk-dev
mailing list