mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 01:26:58 +00:00
[core] Update switch_ivr_record_session_event() to check event vars for RECORD_STEREO, etc
This commit is contained in:
committed by
Andrey Volk
parent
a7fa9bfedc
commit
60faf1a1b1
@@ -117,6 +117,45 @@ FST_CORE_BEGIN("./conf_async")
|
||||
fst_xcheck(duration_ms > 3500 && duration_ms < 3700, "Expect recording to be between 3500 and 3700 ms");
|
||||
}
|
||||
FST_SESSION_END()
|
||||
|
||||
FST_SESSION_BEGIN(session_record_event_vars)
|
||||
{
|
||||
const char *record_filename = switch_core_session_sprintf(fst_session, "%s%s%s.wav", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(fst_session));
|
||||
switch_event_t *rec_vars = NULL;
|
||||
switch_status_t status;
|
||||
|
||||
switch_event_create_subclass(&rec_vars, SWITCH_EVENT_CLONE, SWITCH_EVENT_SUBCLASS_ANY);
|
||||
fst_requires(rec_vars != NULL);
|
||||
|
||||
// record READ stream only- should be complete silence which will trigger the initial timeout.
|
||||
// Min seconds set to 2, which will cause the recording to be discarded.
|
||||
// Expect the record_start_test_pass and record_stop_test_pass variables set to true
|
||||
switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "execute_on_record_start", "set record_start_test_pass=true");
|
||||
switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "execute_on_record_stop", "set record_stop_test_pass=true");
|
||||
switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, SWITCH_RECORD_POST_PROCESS_EXEC_APP_VARIABLE, "set record_post_process_test_pass=true");
|
||||
switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "RECORD_READ_ONLY", "true");
|
||||
switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "RECORD_INITIAL_TIMEOUT_MS", "500");
|
||||
switch_event_add_header_string(rec_vars, SWITCH_STACK_BOTTOM, "RECORD_MIN_SEC", "2");
|
||||
|
||||
status = switch_ivr_record_session_event(fst_session, record_filename, 0, NULL, rec_vars);
|
||||
fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_record_session() to return SWITCH_STATUS_SUCCESS");
|
||||
|
||||
status = switch_ivr_play_file(fst_session, NULL, "tone_stream://%(400,200,400,450);%(400,2000,400,450)", NULL);
|
||||
fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_play_file() to return SWITCH_STATUS_SUCCESS");
|
||||
|
||||
status = switch_ivr_record_session_pause(fst_session, record_filename, SWITCH_TRUE);
|
||||
fst_xcheck(status != SWITCH_STATUS_SUCCESS, "Expect switch_ivr_record_session_pause(SWITCH_TRUE) not to return SWITCH_STATUS_SUCCESS because the recording has already stopped");
|
||||
|
||||
fst_xcheck(switch_file_exists(record_filename, fst_pool) != SWITCH_STATUS_SUCCESS, "Expect recording file not to exist since it was less than 2 seconds in duration");
|
||||
|
||||
fst_xcheck(switch_channel_var_true(fst_channel, "record_start_test_pass"), "Expect record_start_test_pass channel variable set to true");
|
||||
fst_xcheck(switch_channel_var_true(fst_channel, "record_stop_test_pass"), "Expect record_stop_test_pass channel variable set to true");
|
||||
fst_xcheck(switch_channel_var_true(fst_channel, "record_post_process_test_pass"), "Expect record_post_process_test_pass channel variable set to true");
|
||||
|
||||
unlink(record_filename);
|
||||
switch_event_destroy(&rec_vars);
|
||||
}
|
||||
FST_SESSION_END()
|
||||
}
|
||||
FST_SUITE_END()
|
||||
}
|
||||
|
Reference in New Issue
Block a user