[Asterisk-cvs] asterisk/apps app_voicemail.c,1.85,1.86
markster at lists.digium.com
markster at lists.digium.com
Sat May 1 19:21:04 CDT 2004
- Previous message: [Asterisk-cvs] asterisk-sounds/sounds 1-for-am-2-for-pm.gsm,NONE,1.1 T-changed-to.gsm,NONE,1.1 T-is-not-available.gsm,NONE,1.1 T-to-disable-ancmnt.gsm,NONE,1.1 T-to-enable-ancmnt.gsm,NONE,1.1 T-to-hear-cur-ancmnt.gsm,NONE,1.1 T-to-leave-msg.gsm,NONE,1.1 T-to-reach-main-office.gsm,NONE,1.1 T-to-rec-ancmnt.gsm,NONE,1.1 T-to-rtrn-to-main-menu.gsm,NONE,1.1 a-charge-for-this-svc.gsm,NONE,1.1 accessible-through-system.gsm,NONE,1.1 added-to.gsm,NONE,1.1 address.gsm,NONE,1.1 all-circuits-busy-now.gsm,NONE,1.1 all-reps-busy.gsm,NONE,1.1 an-error-has-occured.gsm,NONE,1.1 asterisk-friend.gsm,NONE,1.1 at-customers-request.gsm,NONE,1.1 at-tone-time-exactly.gsm,NONE,1.1 busy-hangovers.gsm,NONE,1.1 by.gsm,NONE,1.1 call-forward.gsm,NONE,1.1 call-forwarding.gsm,NONE,1.1 calls-taken-by.gsm,NONE,1.1 company-dir-411.gsm,NONE,1.1 computer-friend1.gsm,NONE,1.1 computer-friend2.gsm,NONE,1.1 continue-english-press.gsm,NONE,1.1 current-time-is.gsm,NONE,1.1 days.gsm,NONE,1.1 digit.gsm,NONE,1.1 digits.gsm,NONE,1.1 directory-assistance.gsm,NONE,1.1 disabled.gsm,NONE,1.1 divided-by.gsm,NONE,1.1 do-not-disturb.gsm,NONE,1.1 enabled.gsm,NONE,1.1 enter-a-time.gsm,NONE,1.1 enter-phone-number10.gsm,NONE,1.1 entering-conf-number.gsm,NONE,1.1 error-number.gsm,NONE,1.1 extensions.gsm,NONE,1.1 feature-not-avail-line.gsm,NONE,1.1 flagged-for-lea.gsm,NONE,1.1 for-a-list-of.gsm,NONE,1.1 for-english-press.gsm,NONE,1.1 for-investor-relations.gsm,NONE,1.1 for-louie-louie.gsm,NONE,1.1 for-no-press.gsm,NONE,1.1 for-the-weather.gsm,NONE,1.1 for-wakeup-call.gsm,NONE,1.1 for-yes-press.gsm,NONE,1.1 has-been-changed-to.gsm,NONE,1.1 has-been-disconnected.gsm,NONE,1.1 has-been.gsm,NONE,1.1 hear-odd-noise.gsm,NONE,1.1 hear-toilet-flush.gsm,NONE,1.1 hold-or-dial-0.gsm,NONE,1.1 if-rotary-phone.gsm,NONE,1.1 if-u-know-ext-dial.gsm,NONE,1.1 if-you-know-the.gsm,NONE,1.1 info-about-last-call.gsm,NONE,1.1 infuriate-tech-staff.gsm,NONE,1.1 it-now.gsm,NONE,1.1 jedi-extension-trick.gsm,NONE,1.1 lea-may-request-info.gsm,NONE,1.1 lines-complaining-customers.gsm,NONE,1.1 list.gsm,NONE,1.1 lyrics-louie-louie.gsm,NONE,1.1 minus.gsm,NONE,1.1 months.gsm,NONE,1.1 no-empty-conferences.gsm,NONE,1.1 no-info-about-number.gsm,NONE,1.1 no-longer-in-service.gsm,NONE,1.1 not-rqsted-wakeup.gsm,NONE,1.1 not-yet-assigned.gsm,NONE,1.1 now.gsm,NONE,1.1 office-code.gsm,NONE,1.1 on-busy.gsm,NONE,1.1 on-monthly-tel-stment.gsm,NONE,1.1 on-no-answer.gsm,NONE,1.1 or-press.gsm,NONE,1.1 our-business-hours-are.gsm,NONE,1.1 please-enter-your.gsm,NONE,1.1 please-try.gsm,NONE,1.1 pls-hold-while-try.gsm,NONE,1.1 pls-lv-msg-will-contact.gsm,NONE,1.1 pls-stay-on-line.gsm,NONE,1.1 pls-try-area-code.gsm,NONE,1.1 pls-try-call-later.gsm,NONE,1.1 post-entry-pound.gsm,NONE,1.1 press-1.gsm,NONE,1.1 press-2.gsm,NONE,1.1 press-3.gsm,NONE,1.1 press-4.gsm,NONE,1.1 press-5.gsm,NONE,1.1 press-6.gsm,NONE,1.1 press-7.gsm,NONE,1.1 press-8.gsm,NONE,1.1 press-9.gsm,NONE,1.1 press-hash.gsm,NONE,1.1 press-pound.gsm,NONE,1.1 press-star.gsm,NONE,1.1 reassigned-new-areacode.gsm,NONE,1.1 rqsted-wakeup-for.gsm,NONE,1.1 save-announce-press.gsm,NONE,1.1 speak-to-the-operator.gsm,NONE,1.1 starting-with-either.gsm,NONE,1.1 system-status-msg.gsm,NONE,1.1 telephone-number.gsm,NONE,1.1 teletubbie-murder.gsm,NONE,1.1 temp-disconnected.gsm,NONE,1.1 thank-you-cooperation.gsm,NONE,1.1 thank-you-for-calling.gsm,NONE,1.1 that-number.gsm,NONE,1.1 that-you-require.gsm,NONE,1.1 the-new-number-is.gsm,NONE,1.1 the-next.gsm,NONE,1.1 the-number-u-dialed.gsm,NONE,1.1 this-is-yr-wakeup-call.gsm,NONE,1.1 times.gsm,NONE,1.1 to-be-called-back.gsm,NONE,1.1 to-cancel-wakeup.gsm,NONE,1.1 to-collect-voicemail.gsm,NONE,1.1 to-confirm-wakeup.gsm,NONE,1.1 to-extension.gsm,NONE,1.1 to-hear-msg-again.gsm,NONE,1.1 to-join-a-meeting.gsm,NONE,1.1 to-rerecord-announce.gsm,NONE,1.1 to-rqst-wakeup-call.gsm,NONE,1.1 to-snooze-for.gsm,NONE,1.1 uh-oh1.gsm,NONE,1.1 uh-oh2.gsm,NONE,1.1 uk.gsm,NONE,1.1 unconditional.gsm,NONE,1.1 user.gsm,NONE,1.1 wakeup-call-cancelled.gsm,NONE,1.1 wakeup-call.gsm,NONE,1.1 walks-into-bar-mail.gsm,NONE,1.1 weeks.gsm,NONE,1.1 welcome.gsm,NONE,1.1 what-time-it-is.gsm,NONE,1.1 what-time-it-is2.gsm,NONE,1.1 will-reflect-charge-of.gsm,NONE,1.1 wish-to-continue.gsm,NONE,1.1 within.gsm,NONE,1.1 www-switchboard-com.gsm,NONE,1.1 years.gsm,NONE,1.1 you-dialed-wrong-number.gsm,NONE,1.1 your-account.gsm,NONE,1.1 zip-code.gsm,NONE,1.1
- Next message: [Asterisk-cvs] asterisk/configs voicemail.conf.sample,1.28,1.29
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv31820/apps
Modified Files:
app_voicemail.c
Log Message:
Add ability to specify custom e-mail subject line (bug #1291)
Index: app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- app_voicemail.c 1 May 2004 22:29:54 -0000 1.85
+++ app_voicemail.c 1 May 2004 23:28:33 -0000 1.86
@@ -235,6 +235,7 @@
static char *emailbody = NULL;
static int pbxskip = 0;
+static char *emailsubject = NULL;
static char fromstring[100];
static char emailtitle[100];
@@ -754,6 +755,18 @@
return 1;
}
+static void prep_email_sub_vars(struct ast_channel *ast, struct ast_vm_user *vmu, int msgnum, char *mailbox, char *callerid, char *dur, char *date, char *passdata)
+{
+ /* Prepare variables for substition in email body and subject */
+ pbx_builtin_setvar_helper(ast, "VM_NAME", vmu->fullname);
+ pbx_builtin_setvar_helper(ast, "VM_DUR", dur);
+ sprintf(passdata,"%d",msgnum);
+ pbx_builtin_setvar_helper(ast, "VM_MSGNUM", passdata);
+ pbx_builtin_setvar_helper(ast, "VM_MAILBOX", mailbox);
+ pbx_builtin_setvar_helper(ast, "VM_CALLERID", (callerid ? callerid : "an unknown caller"));
+ pbx_builtin_setvar_helper(ast, "VM_DATE", date);
+}
+
static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *mailbox, char *callerid, char *attach, char *format, int duration, int attach_user_voicemail)
{
FILE *p=NULL;
@@ -820,6 +833,20 @@
fprintf(p, "From: Asterisk PBX <%s>\n", who);
fprintf(p, "To: %s <%s>\n", vmu->fullname, vmu->email);
+ if (emailsubject) {
+ struct ast_channel *ast = ast_channel_alloc(0);
+ if (ast) {
+ char *passdata;
+ int vmlen = strlen(emailsubject)*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,emailsubject,passdata,vmlen);
+ fprintf(p, "Subject: %s\n",passdata);
+ } 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
if( *emailtitle)
{
fprintf(p, emailtitle, msgnum + 1, mailbox) ;
@@ -849,13 +876,7 @@
int vmlen = strlen(emailbody)*3 + 200;
if ((passdata = alloca(vmlen))) {
memset(passdata, 0, vmlen);
- pbx_builtin_setvar_helper(ast, "VM_NAME", vmu->fullname);
- pbx_builtin_setvar_helper(ast, "VM_DUR", dur);
- sprintf(passdata,"%d",msgnum);
- pbx_builtin_setvar_helper(ast, "VM_MSGNUM", passdata);
- pbx_builtin_setvar_helper(ast, "VM_MAILBOX", mailbox);
- pbx_builtin_setvar_helper(ast, "VM_CALLERID", (callerid ? callerid : "an unknown caller"));
- pbx_builtin_setvar_helper(ast, "VM_DATE", date);
+ prep_email_sub_vars(ast,vmu,msgnum + 1,mailbox,callerid,dur,date,passdata);
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");
@@ -3811,12 +3832,18 @@
free(emailbody);
emailbody = NULL;
}
+ if (emailsubject) {
+ free(emailsubject);
+ emailsubject = NULL;
+ }
if ((s=ast_variable_retrieve(cfg, "general", "pbxskip")))
pbxskip = ast_true(s);
if ((s=ast_variable_retrieve(cfg, "general", "fromstring")))
strncpy(fromstring,s,sizeof(fromstring)-1);
if ((s=ast_variable_retrieve(cfg, "general", "emailtitle")))
strncpy(emailtitle,s,sizeof(emailtitle)-1);
+ if ((s=ast_variable_retrieve(cfg, "general", "emailsubject")))
+ emailsubject = strdup(s);
if ((s=ast_variable_retrieve(cfg, "general", "emailbody"))) {
char *tmpread, *tmpwrite;
emailbody = strdup(s);
- Previous message: [Asterisk-cvs] asterisk-sounds/sounds 1-for-am-2-for-pm.gsm,NONE,1.1 T-changed-to.gsm,NONE,1.1 T-is-not-available.gsm,NONE,1.1 T-to-disable-ancmnt.gsm,NONE,1.1 T-to-enable-ancmnt.gsm,NONE,1.1 T-to-hear-cur-ancmnt.gsm,NONE,1.1 T-to-leave-msg.gsm,NONE,1.1 T-to-reach-main-office.gsm,NONE,1.1 T-to-rec-ancmnt.gsm,NONE,1.1 T-to-rtrn-to-main-menu.gsm,NONE,1.1 a-charge-for-this-svc.gsm,NONE,1.1 accessible-through-system.gsm,NONE,1.1 added-to.gsm,NONE,1.1 address.gsm,NONE,1.1 all-circuits-busy-now.gsm,NONE,1.1 all-reps-busy.gsm,NONE,1.1 an-error-has-occured.gsm,NONE,1.1 asterisk-friend.gsm,NONE,1.1 at-customers-request.gsm,NONE,1.1 at-tone-time-exactly.gsm,NONE,1.1 busy-hangovers.gsm,NONE,1.1 by.gsm,NONE,1.1 call-forward.gsm,NONE,1.1 call-forwarding.gsm,NONE,1.1 calls-taken-by.gsm,NONE,1.1 company-dir-411.gsm,NONE,1.1 computer-friend1.gsm,NONE,1.1 computer-friend2.gsm,NONE,1.1 continue-english-press.gsm,NONE,1.1 current-time-is.gsm,NONE,1.1 days.gsm,NONE,1.1 digit.gsm,NONE,1.1 digits.gsm,NONE,1.1 directory-assistance.gsm,NONE,1.1 disabled.gsm,NONE,1.1 divided-by.gsm,NONE,1.1 do-not-disturb.gsm,NONE,1.1 enabled.gsm,NONE,1.1 enter-a-time.gsm,NONE,1.1 enter-phone-number10.gsm,NONE,1.1 entering-conf-number.gsm,NONE,1.1 error-number.gsm,NONE,1.1 extensions.gsm,NONE,1.1 feature-not-avail-line.gsm,NONE,1.1 flagged-for-lea.gsm,NONE,1.1 for-a-list-of.gsm,NONE,1.1 for-english-press.gsm,NONE,1.1 for-investor-relations.gsm,NONE,1.1 for-louie-louie.gsm,NONE,1.1 for-no-press.gsm,NONE,1.1 for-the-weather.gsm,NONE,1.1 for-wakeup-call.gsm,NONE,1.1 for-yes-press.gsm,NONE,1.1 has-been-changed-to.gsm,NONE,1.1 has-been-disconnected.gsm,NONE,1.1 has-been.gsm,NONE,1.1 hear-odd-noise.gsm,NONE,1.1 hear-toilet-flush.gsm,NONE,1.1 hold-or-dial-0.gsm,NONE,1.1 if-rotary-phone.gsm,NONE,1.1 if-u-know-ext-dial.gsm,NONE,1.1 if-you-know-the.gsm,NONE,1.1 info-about-last-call.gsm,NONE,1.1 infuriate-tech-staff.gsm,NONE,1.1 it-now.gsm,NONE,1.1 jedi-extension-trick.gsm,NONE,1.1 lea-may-request-info.gsm,NONE,1.1 lines-complaining-customers.gsm,NONE,1.1 list.gsm,NONE,1.1 lyrics-louie-louie.gsm,NONE,1.1 minus.gsm,NONE,1.1 months.gsm,NONE,1.1 no-empty-conferences.gsm,NONE,1.1 no-info-about-number.gsm,NONE,1.1 no-longer-in-service.gsm,NONE,1.1 not-rqsted-wakeup.gsm,NONE,1.1 not-yet-assigned.gsm,NONE,1.1 now.gsm,NONE,1.1 office-code.gsm,NONE,1.1 on-busy.gsm,NONE,1.1 on-monthly-tel-stment.gsm,NONE,1.1 on-no-answer.gsm,NONE,1.1 or-press.gsm,NONE,1.1 our-business-hours-are.gsm,NONE,1.1 please-enter-your.gsm,NONE,1.1 please-try.gsm,NONE,1.1 pls-hold-while-try.gsm,NONE,1.1 pls-lv-msg-will-contact.gsm,NONE,1.1 pls-stay-on-line.gsm,NONE,1.1 pls-try-area-code.gsm,NONE,1.1 pls-try-call-later.gsm,NONE,1.1 post-entry-pound.gsm,NONE,1.1 press-1.gsm,NONE,1.1 press-2.gsm,NONE,1.1 press-3.gsm,NONE,1.1 press-4.gsm,NONE,1.1 press-5.gsm,NONE,1.1 press-6.gsm,NONE,1.1 press-7.gsm,NONE,1.1 press-8.gsm,NONE,1.1 press-9.gsm,NONE,1.1 press-hash.gsm,NONE,1.1 press-pound.gsm,NONE,1.1 press-star.gsm,NONE,1.1 reassigned-new-areacode.gsm,NONE,1.1 rqsted-wakeup-for.gsm,NONE,1.1 save-announce-press.gsm,NONE,1.1 speak-to-the-operator.gsm,NONE,1.1 starting-with-either.gsm,NONE,1.1 system-status-msg.gsm,NONE,1.1 telephone-number.gsm,NONE,1.1 teletubbie-murder.gsm,NONE,1.1 temp-disconnected.gsm,NONE,1.1 thank-you-cooperation.gsm,NONE,1.1 thank-you-for-calling.gsm,NONE,1.1 that-number.gsm,NONE,1.1 that-you-require.gsm,NONE,1.1 the-new-number-is.gsm,NONE,1.1 the-next.gsm,NONE,1.1 the-number-u-dialed.gsm,NONE,1.1 this-is-yr-wakeup-call.gsm,NONE,1.1 times.gsm,NONE,1.1 to-be-called-back.gsm,NONE,1.1 to-cancel-wakeup.gsm,NONE,1.1 to-collect-voicemail.gsm,NONE,1.1 to-confirm-wakeup.gsm,NONE,1.1 to-extension.gsm,NONE,1.1 to-hear-msg-again.gsm,NONE,1.1 to-join-a-meeting.gsm,NONE,1.1 to-rerecord-announce.gsm,NONE,1.1 to-rqst-wakeup-call.gsm,NONE,1.1 to-snooze-for.gsm,NONE,1.1 uh-oh1.gsm,NONE,1.1 uh-oh2.gsm,NONE,1.1 uk.gsm,NONE,1.1 unconditional.gsm,NONE,1.1 user.gsm,NONE,1.1 wakeup-call-cancelled.gsm,NONE,1.1 wakeup-call.gsm,NONE,1.1 walks-into-bar-mail.gsm,NONE,1.1 weeks.gsm,NONE,1.1 welcome.gsm,NONE,1.1 what-time-it-is.gsm,NONE,1.1 what-time-it-is2.gsm,NONE,1.1 will-reflect-charge-of.gsm,NONE,1.1 wish-to-continue.gsm,NONE,1.1 within.gsm,NONE,1.1 www-switchboard-com.gsm,NONE,1.1 years.gsm,NONE,1.1 you-dialed-wrong-number.gsm,NONE,1.1 your-account.gsm,NONE,1.1 zip-code.gsm,NONE,1.1
- Next message: [Asterisk-cvs] asterisk/configs voicemail.conf.sample,1.28,1.29
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the svn-commits
mailing list