mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-18 20:50:17 +00:00
try this Vagabond
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16517 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
77ac925dc5
commit
3049cd5c8d
@ -338,6 +338,7 @@ struct switch_file_handle {
|
|||||||
int line;
|
int line;
|
||||||
char *file_path;
|
char *file_path;
|
||||||
char *spool_path;
|
char *spool_path;
|
||||||
|
const char *prefix;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! \brief Abstract interface to an asr module */
|
/*! \brief Abstract interface to an asr module */
|
||||||
|
@ -60,6 +60,10 @@ typedef struct file_string_context file_string_context_t;
|
|||||||
static int next_file(switch_file_handle_t *handle)
|
static int next_file(switch_file_handle_t *handle)
|
||||||
{
|
{
|
||||||
file_string_context_t *context = handle->private_info;
|
file_string_context_t *context = handle->private_info;
|
||||||
|
char *file;
|
||||||
|
const char *prefix = handle->prefix;
|
||||||
|
|
||||||
|
top:
|
||||||
|
|
||||||
context->index++;
|
context->index++;
|
||||||
|
|
||||||
@ -71,12 +75,25 @@ static int next_file(switch_file_handle_t *handle)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!prefix) {
|
||||||
|
if (!(prefix = switch_core_get_variable("sound_prefix"))) {
|
||||||
|
prefix = SWITCH_GLOBAL_dirs.sounds_dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!prefix || switch_is_file_path(context->argv[context->index])) {
|
||||||
|
file = context->argv[context->index];
|
||||||
|
} else {
|
||||||
|
file = switch_core_sprintf(handle->memory_pool, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, context->argv[context->index]);
|
||||||
|
}
|
||||||
|
|
||||||
if (switch_core_file_open(&context->fh,
|
if (switch_core_file_open(&context->fh,
|
||||||
context->argv[context->index],
|
file,
|
||||||
handle->channels,
|
handle->channels,
|
||||||
handle->samplerate,
|
handle->samplerate,
|
||||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
|
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
|
||||||
return 0;
|
goto top;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->samples = context->fh.samples;
|
handle->samples = context->fh.samples;
|
||||||
|
@ -399,6 +399,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
|
|||||||
switch_event_t *event;
|
switch_event_t *event;
|
||||||
int divisor = 0;
|
int divisor = 0;
|
||||||
int file_flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT;
|
int file_flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT;
|
||||||
|
const char *prefix;
|
||||||
|
|
||||||
|
prefix = switch_channel_get_variable(channel, "sound_prefix");
|
||||||
|
|
||||||
|
if (!prefix) {
|
||||||
|
prefix = SWITCH_GLOBAL_dirs.sounds_dir;
|
||||||
|
}
|
||||||
|
|
||||||
switch_core_session_get_read_impl(session, &read_impl);
|
switch_core_session_get_read_impl(session, &read_impl);
|
||||||
|
|
||||||
@ -468,14 +475,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
|
|||||||
|
|
||||||
if (!strstr(file, SWITCH_URL_SEPARATOR)) {
|
if (!strstr(file, SWITCH_URL_SEPARATOR)) {
|
||||||
char *ext;
|
char *ext;
|
||||||
const char *prefix;
|
|
||||||
|
|
||||||
prefix = switch_channel_get_variable(channel, "sound_prefix");
|
|
||||||
|
|
||||||
if (!prefix) {
|
|
||||||
prefix = SWITCH_GLOBAL_dirs.base_dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!switch_is_file_path(file)) {
|
if (!switch_is_file_path(file)) {
|
||||||
char *tfile = NULL;
|
char *tfile = NULL;
|
||||||
char *e;
|
char *e;
|
||||||
@ -510,7 +510,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
|
|||||||
file_flags |= SWITCH_FILE_WRITE_APPEND;
|
file_flags |= SWITCH_FILE_WRITE_APPEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!fh->prefix) {
|
||||||
|
fh->prefix = prefix;
|
||||||
|
}
|
||||||
|
|
||||||
if (switch_core_file_open(fh,
|
if (switch_core_file_open(fh,
|
||||||
file,
|
file,
|
||||||
fh->channels,
|
fh->channels,
|
||||||
@ -1076,6 +1079,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!fh->prefix) {
|
||||||
|
fh->prefix = prefix;
|
||||||
|
}
|
||||||
|
|
||||||
if (switch_core_file_open(fh,
|
if (switch_core_file_open(fh,
|
||||||
file,
|
file,
|
||||||
read_impl.number_of_channels,
|
read_impl.number_of_channels,
|
||||||
|
@ -1571,9 +1571,6 @@ static char unescape_char(char escaped)
|
|||||||
case 's':
|
case 's':
|
||||||
unescaped = ' ';
|
unescaped = ' ';
|
||||||
break;
|
break;
|
||||||
case '\\':
|
|
||||||
unescaped = 1; /* 1 means double esc */
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
unescaped = escaped;
|
unescaped = escaped;
|
||||||
}
|
}
|
||||||
@ -1642,16 +1639,12 @@ static char *cleanup_separated_string(char *str, char delim)
|
|||||||
for (start = dest = ptr; *ptr; ++ptr) {
|
for (start = dest = ptr; *ptr; ++ptr) {
|
||||||
char e;
|
char e;
|
||||||
int esc = 0;
|
int esc = 0;
|
||||||
|
|
||||||
if (*ptr == ESCAPE_META) {
|
if (*ptr == ESCAPE_META) {
|
||||||
e = *(ptr + 1);
|
e = *(ptr + 1);
|
||||||
if (e == '\'' || e == '"' || (delim && e == delim) || (e = unescape_char(*(ptr + 1))) != *(ptr + 1)) {
|
if (e == '\'' || e == '"' || (delim && e == delim) || e == ESCAPE_META || (e = unescape_char(*(ptr + 1))) != *(ptr + 1)) {
|
||||||
++ptr;
|
++ptr;
|
||||||
if (e == 1) {
|
*dest++ = e;
|
||||||
*dest++ = '\\';
|
|
||||||
} else {
|
|
||||||
*dest++ = e;
|
|
||||||
}
|
|
||||||
end = dest;
|
end = dest;
|
||||||
esc++;
|
esc++;
|
||||||
}
|
}
|
||||||
@ -1670,6 +1663,7 @@ static char *cleanup_separated_string(char *str, char delim)
|
|||||||
if (end) {
|
if (end) {
|
||||||
*end = '\0';
|
*end = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1727,8 +1721,10 @@ static unsigned int separate_string_char_delim(char *buf, char delim, char **arr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* strip quotes, escaped chars and leading / trailing spaces */
|
/* strip quotes, escaped chars and leading / trailing spaces */
|
||||||
for (i = 0; i < count; ++i) {
|
if (count > 1) {
|
||||||
array[i] = cleanup_separated_string(array[i], delim);
|
for (i = 0; i < count; ++i) {
|
||||||
|
array[i] = cleanup_separated_string(array[i], delim);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@ -1785,8 +1781,10 @@ static unsigned int separate_string_blank_delim(char *buf, char **array, unsigne
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* strip quotes, escaped chars and leading / trailing spaces */
|
/* strip quotes, escaped chars and leading / trailing spaces */
|
||||||
for (i = 0; i < count; ++i) {
|
if (count > 1) {
|
||||||
array[i] = cleanup_separated_string(array[i], 0);
|
for (i = 0; i < count; ++i) {
|
||||||
|
array[i] = cleanup_separated_string(array[i], 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user