SMBF_SPY_VIDEO_STREAM = (1 << 22),
SMBF_SPY_VIDEO_STREAM_BLEG = (1 << 23),
SMBF_READ_VIDEO_PATCH = (1 << 24),
- SMBF_READ_TEXT_STREAM = (1 << 25)
+ SMBF_READ_TEXT_STREAM = (1 << 25),
+ SMBF_FIRST = (1 << 26)
} switch_media_bug_flag_enum_t;
typedef uint32_t switch_media_bug_flag_t;
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2018, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2019, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
fst_requires(fst_core > 1); \
fst_requires_module("mod_dptools"); \
switch_channel_set_variable(fst_channel, "detect_speech_result", ""); \
- fst_requires(switch_ivr_displace_session(fst_session, input_filename, 0, "mr") == SWITCH_STATUS_SUCCESS); \
+ fst_requires(switch_ivr_displace_session(fst_session, input_filename, 0, "mrf") == SWITCH_STATUS_SUCCESS); \
args = switch_core_session_sprintf(fst_session, "%s detect:%s %s", prompt_filename, recognizer, grammar); \
fst_requires(switch_core_session_execute_application(fst_session, "play_and_detect_speech", args) == SWITCH_STATUS_SUCCESS); \
fst_asr_result = switch_channel_get_variable(fst_channel, "detect_speech_result"); \
char *args = NULL; \
fst_asr_result = NULL; \
fst_requires(fst_core > 1); \
- fst_requires(switch_ivr_displace_session(fst_session, input_filename, 0, "mr") == SWITCH_STATUS_SUCCESS); \
+ fst_requires(switch_ivr_displace_session(fst_session, input_filename, 0, "mrf") == SWITCH_STATUS_SUCCESS); \
switch_status_t status = switch_ivr_play_and_detect_speech(fst_session, prompt_filename, recognizer, grammar, (char **)&fst_asr_result, 0, input_args); \
fst_check(fst_asr_result != NULL); \
}
session->bugs = bug;
added = 1;
}
-
+
+ if (!added && switch_test_flag(bug, SMBF_FIRST)) {
+ bug->next = session->bugs;
+ session->bugs = bug;
+ added = 1;
+ }
+
for(bp = session->bugs; bp; bp = bp->next) {
if (bp->ready && !switch_test_flag(bp, SMBF_TAP_NATIVE_READ) && !switch_test_flag(bp, SMBF_TAP_NATIVE_WRITE)) {
tap_only = 0;
displace_helper_t *dh;
const char *p;
switch_bool_t hangup_on_error = SWITCH_FALSE;
+ switch_media_bug_flag_enum_t bug_flags = 0;
switch_codec_implementation_t read_impl = { 0 };
switch_core_session_get_read_impl(session, &read_impl);
dh->loop++;
}
+ if (flags && strchr(flags, 'f')) {
+ bug_flags |= SMBF_FIRST;
+ }
+
if (flags && strchr(flags, 'r')) {
if (strchr(flags, 'w')) { // r&w mode, both sides can hear the same file
int len = dh->fh.samplerate / 10 * 2 * dh->fh.channels; // init with 100ms
}
status = switch_core_media_bug_add(session, "displace", file,
- read_displace_callback, dh, to, SMBF_WRITE_REPLACE | SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug);
+ read_displace_callback, dh, to, bug_flags | SMBF_WRITE_REPLACE | SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug);
} else {
status = switch_core_media_bug_add(session, "displace", file,
- write_displace_callback, dh, to, SMBF_WRITE_REPLACE | SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug);
+ write_displace_callback, dh, to, bug_flags | SMBF_WRITE_REPLACE | SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug);
}
if (status != SWITCH_STATUS_SUCCESS) {