add record params (please test)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5542 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
25057d40ac
commit
008d4c0152
|
@ -953,25 +953,54 @@ SWITCH_STANDARD_APP(record_function)
|
||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
uint32_t limit = 0;
|
uint32_t limit = 0;
|
||||||
char *path;
|
char *path;
|
||||||
char *p;
|
|
||||||
switch_input_args_t args = { 0 };
|
switch_input_args_t args = { 0 };
|
||||||
|
switch_file_handle_t fh = { 0 };
|
||||||
|
int argc;
|
||||||
|
char *mydata, *argv[4] = { 0 };
|
||||||
|
char *l = NULL;
|
||||||
|
|
||||||
channel = switch_core_session_get_channel(session);
|
channel = switch_core_session_get_channel(session);
|
||||||
assert(channel != NULL);
|
assert(channel != NULL);
|
||||||
|
|
||||||
|
if (data && (mydata = switch_core_session_strdup(session, data))) {
|
||||||
|
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||||
|
} else {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No file specified.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
path = argv[0];
|
||||||
|
l = argv[1];
|
||||||
|
|
||||||
path = switch_core_session_strdup(session, data);
|
if (l) {
|
||||||
if ((p = strchr(path, '+'))) {
|
if (*l == '+') {
|
||||||
char *q = p - 1;
|
l++;
|
||||||
while(q && *q == ' ') {
|
if (l) {
|
||||||
*q = '\0';
|
limit = atoi(l);
|
||||||
q--;
|
if (limit < 0) {
|
||||||
|
limit = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (argv[2]) {
|
||||||
|
fh.thresh = atoi(argv[2]);
|
||||||
|
if (fh.thresh < 0) {
|
||||||
|
fh.thresh = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argv[3]) {
|
||||||
|
fh.silence_hits = atoi(argv[3]);
|
||||||
|
if (fh.silence_hits < 0) {
|
||||||
|
fh.silence_hits = 0;
|
||||||
}
|
}
|
||||||
*p++ = '\0';
|
|
||||||
limit = atoi(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
args.input_callback = on_dtmf;
|
args.input_callback = on_dtmf;
|
||||||
status = switch_ivr_record_file(session, NULL, path, &args, limit);
|
status = switch_ivr_record_file(session, &fh, path, &args, limit);
|
||||||
|
|
||||||
if (!switch_channel_ready(channel) || (status != SWITCH_STATUS_SUCCESS && !SWITCH_STATUS_IS_BREAK(status))) {
|
if (!switch_channel_ready(channel) || (status != SWITCH_STATUS_SUCCESS && !SWITCH_STATUS_IS_BREAK(status))) {
|
||||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||||
|
|
Loading…
Reference in New Issue