add record_min_sec chan var
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15271 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
7041d7f412
commit
223a4d53cf
|
@ -425,6 +425,7 @@ struct record_helper {
|
||||||
char *file;
|
char *file;
|
||||||
switch_file_handle_t *fh;
|
switch_file_handle_t *fh;
|
||||||
uint32_t packet_len;
|
uint32_t packet_len;
|
||||||
|
int min_sec;
|
||||||
};
|
};
|
||||||
|
|
||||||
static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
|
static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
|
||||||
|
@ -473,7 +474,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
|
||||||
|
|
||||||
|
|
||||||
switch_core_file_close(rh->fh);
|
switch_core_file_close(rh->fh);
|
||||||
if (rh->fh->samples_out < read_impl.samples_per_second * 3) {
|
if (rh->fh->samples_out < read_impl.samples_per_second * rh->min_sec) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file);
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file);
|
||||||
switch_file_remove(rh->file, switch_core_session_get_pool(session));
|
switch_file_remove(rh->file, switch_core_session_get_pool(session));
|
||||||
}
|
}
|
||||||
|
@ -1013,6 +1014,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
|
||||||
switch_channel_set_variable(channel, "RECORD_DATE", NULL);
|
switch_channel_set_variable(channel, "RECORD_DATE", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rh->min_sec = 3;
|
||||||
|
|
||||||
|
if ((p = switch_channel_get_variable(channel, "RECORD_MIN_SEC"))) {
|
||||||
|
int tmp = atoi(p);
|
||||||
|
if (tmp > 0) {
|
||||||
|
rh->min_sec = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (limit) {
|
if (limit) {
|
||||||
to = switch_epoch_time_now(NULL) + limit;
|
to = switch_epoch_time_now(NULL) + limit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue