FST_SESSION_BEGIN(session_external_id)
{
+ switch_core_session_t *session;
fst_check(switch_core_session_set_external_id(fst_session, switch_core_session_get_uuid(fst_session)) == SWITCH_STATUS_SUCCESS);
fst_check_string_equals(switch_core_session_get_external_id(fst_session), switch_core_session_get_uuid(fst_session));
fst_check(switch_core_session_set_external_id(fst_session, "foo") == SWITCH_STATUS_SUCCESS);
- switch_core_session_t *session = switch_core_session_locate("foo");
+ session = switch_core_session_locate("foo");
fst_requires(session);
fst_check_string_equals(switch_core_session_get_uuid(session), switch_core_session_get_uuid(fst_session));
fst_check_string_equals(switch_core_session_get_external_id(session), "foo");
if (event->event_id == SWITCH_EVENT_DETECTED_SPEECH) {
const char *speech_type = switch_event_get_header(event, "Speech-Type");
+ char *body;
if (zstr(speech_type) || strcmp(speech_type, "detected-partial-speech")) {
return status;
(*count)++;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "partial events count: %d\n", *count);
- char *body = switch_event_get_body(event);
+ body = switch_event_get_body(event);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "body=[%s]\n", body);
}
} else if (input_type == SWITCH_INPUT_TYPE_DTMF) {
{
FST_SETUP_BEGIN()
{
+ if (0) {
+ partial_play_and_collect_input_callback(NULL, NULL, 0, NULL, 0);
+ }
fst_requires_module("mod_tone_stream");
fst_requires_module("mod_sndfile");
fst_requires_module("mod_dptools");
FST_SESSION_BEGIN(session_record_pause)
{
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));
-
+ const char *duration_ms_str;
+ int duration_ms;
switch_status_t status;
status = switch_ivr_record_session_event(fst_session, record_filename, 0, NULL, NULL);
fst_xcheck(status == SWITCH_STATUS_SUCCESS, "Expect switch_ivr_record_session() to return SWITCH_STATUS_SUCCESS");
unlink(record_filename);
- const char *duration_ms_str = switch_channel_get_variable(fst_channel, "record_ms");
+ duration_ms_str = switch_channel_get_variable(fst_channel, "record_ms");
fst_requires(duration_ms_str != NULL);
- int duration_ms = atoi(duration_ms_str);
+ duration_ms = atoi(duration_ms_str);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fst_session), SWITCH_LOG_NOTICE, "Recording duration is %s ms\n", duration_ms_str);
fst_xcheck(duration_ms > 3500 && duration_ms < 3700, "Expect recording to be between 3500 and 3700 ms");
}
static void on_record_start(switch_event_t *event)
{
char *str = NULL;
+ const char *uuid = switch_event_get_header(event, "Unique-ID");
switch_event_serialize(event, &str, SWITCH_FALSE);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s", str);
switch_safe_free(str);
- const char *uuid = switch_event_get_header(event, "Unique-ID");
if (uuid) {
switch_core_session_t *session = switch_core_session_locate(uuid);
if (session) {
static void on_record_stop(switch_event_t *event)
{
char *str = NULL;
+ const char *uuid = switch_event_get_header(event, "Unique-ID");
switch_event_serialize(event, &str, SWITCH_FALSE);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s", str);
switch_safe_free(str);
- const char *uuid = switch_event_get_header(event, "Unique-ID");
if (uuid) {
switch_core_session_t *session = switch_core_session_locate(uuid);
if (session) {
if (event->event_id == SWITCH_EVENT_DETECTED_SPEECH) {
const char *speech_type = switch_event_get_header(event, "Speech-Type");
+ char *body = switch_event_get_body(event);
if (zstr(speech_type) || strcmp(speech_type, "detected-partial-speech")) {
return status;
(*count)++;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "partial events count: %d\n", *count);
-
- char *body = switch_event_get_body(event);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "body=[%s]\n", body);
}
} else if (input_type == SWITCH_INPUT_TYPE_DTMF) {
char *speech_grammar_args = switch_core_session_sprintf(fst_session, "{start-input-timers=false,no-input-timeout=%d,vad-silence-ms=%d,speech-timeout=%d,language=en-US,partial=true}default",
no_input_timeout, speech_complete_timeout, speech_recognition_timeout);
switch_status_t status;
+ switch_input_args_t collect_input_args = { 0 };
+ switch_input_args_t *args = NULL;
+ int count = 0;
switch_ivr_displace_session(fst_session, "file_string://silence_stream://500,0!tone_stream://%%(2000,0,350,440)", 0, "r");
terminator_collected = 0;
if (recognition_result) cJSON_Delete(recognition_result);
recognition_result = NULL;
- switch_input_args_t collect_input_args = { 0 };
- switch_input_args_t *args = NULL;
- int count = 0;
-
args = &collect_input_args;
args->input_callback = partial_play_and_collect_input_callback;
args->buf = &count;
FST_CORE_BEGIN("./conf")
{
- switch_core_new_memory_pool(&pool);
- switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, pool);
- switch_thread_cond_create(&cond, pool);
-
FST_SUITE_BEGIN(switch_log)
{
+ switch_core_new_memory_pool(&pool);
+ switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, pool);
+ switch_thread_cond_create(&cond, pool);
+
FST_SETUP_BEGIN()
{
json_format.custom_field_prefix = NULL;