提交 847fb354 authored 作者: Anthony Minessale's avatar Anthony Minessale

add patch from MODAPP-150 with mods

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9775 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 a15da255
......@@ -42,6 +42,8 @@
<param name="operator-key" value="9"/>
<param name="vmain-extension" value="vmain XML default"/>
<param name="vmain-key" value="*"/>
<!-- playback created files as soon as they were recorded by default -->
<!--<param name="auto-playback-recordings" value="true"/>-->
<email>
<param name="template-file" value="voicemail.tpl"/>
<param name="notify-template-file" value="notify-voicemail.tpl"/>
......
......@@ -123,6 +123,7 @@ struct vm_profile {
uint32_t record_silence_hits;
uint32_t record_sample_rate;
switch_odbc_handle_t *master_odbc;
switch_bool_t auto_playback_recordings;
};
typedef struct vm_profile vm_profile_t;
......@@ -314,6 +315,8 @@ static switch_status_t load_config(void)
char *record_comment = "FreeSWITCH Voicemail";
char *record_copyright = "http://www.freeswitch.org";
switch_bool_t auto_playback_recordings = SWITCH_TRUE;
switch_core_db_t *db;
uint32_t timeout = 10000, max_login_attempts = 3, max_record_len = 300, min_record_len = 3;
......@@ -570,7 +573,7 @@ static switch_status_t load_config(void)
if (tmp > 0 && tmp < 10000) {
min_record_len = tmp;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid attempts [%s] must be between 1 and 10000s\n", val);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid record length [%s] must be between 1 and 10000s\n", val);
}
} else if (!strcasecmp(var, "max-record-len")) {
int tmp = 0;
......@@ -580,7 +583,7 @@ static switch_status_t load_config(void)
if (tmp > 0 && tmp < 10000) {
max_record_len = tmp;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid attempts [%s] must be between 1 and 10000s\n", val);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "invalid record length [%s] must be between 1 and 10000s\n", val);
}
} else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
#ifdef SWITCH_HAVE_ODBC
......@@ -594,6 +597,8 @@ static switch_status_t load_config(void)
#else
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
#endif
} else if (!strcasecmp(var, "auto-playback-recordings")){
auto_playback_recordings = switch_true(val);
}
}
......@@ -736,6 +741,7 @@ static switch_status_t load_config(void)
profile->record_silence_hits = record_silence_hits;
profile->record_sample_rate = record_sample_rate;
profile->auto_playback_recordings = auto_playback_recordings;
profile->operator_ext = switch_core_strdup(globals.pool, operator_ext);
profile->vmain_ext = switch_core_strdup(globals.pool, vmain_ext);
profile->storage_dir = switch_core_strdup(globals.pool, storage_dir);
......@@ -1061,14 +1067,15 @@ static switch_status_t create_file(switch_core_session_t *session, vm_profile_t
status = SWITCH_STATUS_SUCCESS;
}
play_file:
memset(&fh, 0, sizeof(fh));
args.input_callback = control_playback;
memset(&cc, 0, sizeof(cc));
cc.profile = profile;
cc.fh = &fh;
args.buf = &cc;
switch_ivr_play_file(session, &fh, file_path, &args);
if (profile->auto_playback_recordings) {
memset(&fh, 0, sizeof(fh));
args.input_callback = control_playback;
memset(&cc, 0, sizeof(cc));
cc.profile = profile;
cc.fh = &fh;
args.buf = &cc;
switch_ivr_play_file(session, &fh, file_path, &args);
}
while (switch_channel_ready(channel)) {
*input = '\0';
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论