[Freeswitch-svn] [commit] r6415 - in freeswitch/trunk: . conf conf/autoload_configs src/mod/applications/mod_voicemail
Freeswitch SVN
anthm at freeswitch.org
Tue Nov 27 14:50:32 EST 2007
Author: anthm
Date: Tue Nov 27 14:50:32 2007
New Revision: 6415
Added:
freeswitch/trunk/conf/voicemail.tpl
Modified:
freeswitch/trunk/Makefile.am
freeswitch/trunk/conf/autoload_configs/voicemail.conf.xml
freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
Log:
add external voicemail template file
Modified: freeswitch/trunk/Makefile.am
==============================================================================
--- freeswitch/trunk/Makefile.am (original)
+++ freeswitch/trunk/Makefile.am Tue Nov 27 14:50:32 2007
@@ -160,7 +160,7 @@
@for x in conf conf/dialplan conf/directory conf/sip_profiles mod db log log/xml_cdr bin scripts htdocs grammar ; do \
$(mkinstalldirs) $(DESTDIR)$(prefix)/$$x ; \
done
- for conffile in `find conf -name \*.xml && find conf -name \*.conf && find conf -name mime.types` ; do \
+ for conffile in `find conf -name \*.xml && find conf -name \*.conf && find conf -name \*.tpl && find conf -name mime.types` ; do \
dir=`echo $$conffile | sed -e 's|/[^/]*$$||'`; \
filename=`echo $$conffile | sed -e 's|^.*/||'`; \
test -d $(DESTDIR)$(PREFIX)/$$dir || $(mkinstalldirs) $(DESTDIR)$(prefix)/$$dir ; \
Modified: freeswitch/trunk/conf/autoload_configs/voicemail.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/voicemail.conf.xml (original)
+++ freeswitch/trunk/conf/autoload_configs/voicemail.conf.xml Tue Nov 27 14:50:32 2007
@@ -39,16 +39,8 @@
<param name="operator-extension" value="operator XML default"/>
<param name="operator-key" value="9"/>
<email>
- <body><![CDATA[At ${voicemail_time} you were left a ${voicemail_message_len} second message from ${voicemail_caller_id_name} ${voicemail_caller_id_number}
-to your account ${voicemail_account}@${voicemail_domain}
-]]></body>
- <headers><![CDATA[From: FreeSWITCH mod_voicemail <${voicemail_account}@${voicemail_domain}>
-To: <${voicemail_email}>
-Subject: ${voicemail_message_len} sec Voicemail from ${voicemail_caller_id_name} ${voicemail_caller_id_number}
-X-Priority: ${voicemail_priority}
-X-Mailer: FreeSWITCH
-]]></headers>
- <!-- this is the format voicemail_time will have -->
+ <param name="template-file" value="voicemail.tpl"/>
+ <!-- this is the format voicemail_time will have -->
<param name="date-fmt" value="%A, %B %d %Y, %I %M %p"/>
<param name="email-from" value="${voicemail_account}@${voicemail_domain}"/>
</email>
Added: freeswitch/trunk/conf/voicemail.tpl
==============================================================================
--- (empty file)
+++ freeswitch/trunk/conf/voicemail.tpl Tue Nov 27 14:50:32 2007
@@ -0,0 +1,11 @@
+From: FreeSWITCH mod_voicemail <${voicemail_account}@${voicemail_domain}>
+To: <${voicemail_email}>
+Subject: ${voicemail_message_len} sec Voicemail from ${voicemail_caller_id_name} ${voicemail_caller_id_number}
+X-Priority: ${voicemail_priority}
+X-Mailer: FreeSWITCH
+
+At ${voicemail_time} you were left a ${voicemail_message_len} second message from ${voicemail_caller_id_name} ${voicemail_caller_id_number}
+to your account ${voicemail_account}@${voicemail_domain}
+
+
+
Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c Tue Nov 27 14:50:32 2007
@@ -330,6 +330,39 @@
date_fmt = val;
} else if (!strcasecmp(var, "email-from") && !switch_strlen_zero(val)) {
email_from = val;
+ } else if (!strcasecmp(var, "template-file") && !switch_strlen_zero(val)) {
+ switch_stream_handle_t stream = { 0 };
+ int fd;
+ char *dpath = NULL;
+ char *path;
+
+ if (switch_is_file_path(val)) {
+ path = val;
+ } else {
+ dpath = switch_mprintf("%s%s%s",
+ SWITCH_GLOBAL_dirs.conf_dir,
+ SWITCH_PATH_SEPARATOR,
+ val);
+ path = dpath;
+ }
+
+ if ((fd = open(path, O_RDONLY)) > -1) {
+ char buf[2048];
+ SWITCH_STANDARD_STREAM(stream);
+ while(switch_fd_read_line(fd, buf, sizeof(buf))) {
+ stream.write_function(&stream, "%s", buf);
+ }
+ close(fd);
+ email_headers = stream.data;
+ if ((email_body = strstr(email_headers, "\n\n"))) {
+ *email_body = '\0';
+ email_body += 2;
+ } else if ((email_body = strstr(email_headers, "\r\n\r\n"))) {
+ *email_body = '\0';
+ email_body += 4;
+ }
+ }
+ switch_safe_free(dpath);
}
}
}
More information about the Freeswitch-svn
mailing list