提交 e7fff13f authored 作者: Anthony Minessale's avatar Anthony Minessale

BOUNTY-9 (Thank you Xpander Communications) [part 2]

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14891 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 9a462e96
...@@ -933,6 +933,32 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t ...@@ -933,6 +933,32 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
fh->channels = channels; fh->channels = channels;
fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN; fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN;
if (!switch_is_file_path(file)) {
char *tfile = NULL;
char *e;
const char *prefix;
prefix = switch_channel_get_variable(channel, "sound_prefix");
if (!prefix) {
prefix = SWITCH_GLOBAL_dirs.base_dir;
}
if (*file == '[') {
tfile = switch_core_session_strdup(session, file);
if ((e = switch_find_end_paren(tfile, '[', ']'))) {
*e = '\0';
file = e + 1;
} else {
tfile = NULL;
}
}
file = switch_core_session_sprintf(session, "%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file);
}
if (switch_core_file_open(fh, if (switch_core_file_open(fh,
file, file,
channels, channels,
......
...@@ -461,12 +461,26 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se ...@@ -461,12 +461,26 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
const char *prefix; const char *prefix;
prefix = switch_channel_get_variable(channel, "sound_prefix"); prefix = switch_channel_get_variable(channel, "sound_prefix");
if (!prefix) { if (!prefix) {
prefix = SWITCH_GLOBAL_dirs.base_dir; prefix = SWITCH_GLOBAL_dirs.base_dir;
} }
if (!switch_is_file_path(file)) { if (!switch_is_file_path(file)) {
file = switch_core_session_sprintf(session, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, file); char *tfile = NULL;
char *e;
if (*file == '[') {
tfile = switch_core_session_strdup(session, file);
if ((e = switch_find_end_paren(tfile, '[', ']'))) {
*e = '\0';
file = e + 1;
} else {
tfile = NULL;
}
}
file = switch_core_session_sprintf(session, "%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file);
} }
if ((ext = strrchr(file, '.'))) { if ((ext = strrchr(file, '.'))) {
ext++; ext++;
...@@ -1001,7 +1015,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess ...@@ -1001,7 +1015,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
if (!strstr(file, SWITCH_URL_SEPARATOR)) { if (!strstr(file, SWITCH_URL_SEPARATOR)) {
if (!switch_is_file_path(file)) { if (!switch_is_file_path(file)) {
file = switch_core_session_sprintf(session, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, file); char *tfile = NULL;
char *e;
if (*file == '[') {
tfile = switch_core_session_strdup(session, file);
if ((e = switch_find_end_paren(tfile, '[', ']'))) {
*e = '\0';
file = e + 1;
} else {
tfile = NULL;
}
}
file = switch_core_session_sprintf(session, "%s%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file);
} }
if ((ext = strrchr(file, '.'))) { if ((ext = strrchr(file, '.'))) {
ext++; ext++;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论