add external voicemail template file
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6415 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
d87cfbdb2c
commit
54839c492e
|
@ -160,7 +160,7 @@ install-data-local:
|
|||
@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 ; \
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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}
|
||||
|
||||
|
||||
|
|
@ -330,6 +330,39 @@ static switch_status_t load_config(void)
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue