RTS API Documentation
1.10.11
|
Go to the source code of this file.
Functions | |
static char * | fst_getenv_default (const char *env, char *default_value, switch_bool_t required) |
static switch_status_t | fst_init_core_and_modload (const char *confdir, const char *basedir, int minimal, switch_core_flag_t flags) |
Variables | |
int | fst_tag_children = 0 |
int | fst_tag_body = 0 |
#define FST_BEGIN | ( | ) |
Run test without loading FS core
Definition at line 256 of file switch_test.h.
#define fst_check fct_chk |
test boolean expression - continue test execution on failure
Definition at line 159 of file switch_test.h.
#define fst_check_double_range | ( | actual, | |
expected, | |||
precision | |||
) |
Check if double-precision number is in range
Definition at line 244 of file switch_test.h.
#define fst_check_duration | ( | duration_ms, | |
precision_ms | |||
) |
Check duration relative to test start, last marked time, or last check.
Definition at line 217 of file switch_test.h.
#define fst_check_extension_apps | ( | expected, | |
extension | |||
) |
Compare extension dialplan apps and args with expected apps and args
expected | NULL terminated string array of app arg and names. const char *expected[] = { "playback", "https://example.com/foo.wav", "park", "", NULL }; |
extension | the switch_caller_extension_t to check |
Definition at line 780 of file switch_test.h.
#define fst_check_int_equals fct_chk_eq_int |
test integers for equality - continue test execution on failure
Definition at line 164 of file switch_test.h.
#define fst_check_int_range | ( | actual, | |
expected, | |||
precision | |||
) |
Check if integer is in range
Definition at line 232 of file switch_test.h.
#define fst_check_string_does_not_have fct_chk_excl_str |
Test string for exclusion of substring
Definition at line 194 of file switch_test.h.
#define fst_check_string_ends_with fct_chk_endswith_str |
Test string for matching suffix
Definition at line 184 of file switch_test.h.
#define fst_check_string_equals fct_chk_eq_str |
test string for equality - continue test execution on failure
Definition at line 169 of file switch_test.h.
#define fst_check_string_has fct_chk_incl_str |
Test string for substring
Definition at line 189 of file switch_test.h.
#define fst_check_string_not_equals fct_chk_neq_str |
test string for inequality - continue test execution on failure
Definition at line 174 of file switch_test.h.
#define fst_check_string_starts_with fct_chk_startswith_str |
Test string for matching prefix
Definition at line 179 of file switch_test.h.
#define FST_CORE_BEGIN | ( | confdir | ) | FST_CORE_EX_BEGIN(confdir, 0) |
Definition at line 315 of file switch_test.h.
#define FST_CORE_DB_BEGIN | ( | confdir | ) | FST_CORE_EX_BEGIN(confdir, SCF_USE_SQL) |
Definition at line 316 of file switch_test.h.
#define FST_CORE_END | ( | ) |
Define the end of a freeswitch core test driver.
Definition at line 305 of file switch_test.h.
#define FST_CORE_EX_BEGIN | ( | confdir, | |
flags | |||
) |
Define the beginning of a freeswitch core test driver. Only one per test application allowed.
confdir | directory containing freeswitch.xml configuration |
Definition at line 284 of file switch_test.h.
#define FST_END | ( | ) |
Definition at line 271 of file switch_test.h.
#define fst_fail | ( | error_msg | ) | (fct_xchk(0, "%s", error_msg)) |
Fail a test
Definition at line 211 of file switch_test.h.
#define fst_getenv | ( | env, | |
default_value | |||
) | char *env = fst_getenv_default(#env, (char *)default_value, SWITCH_FALSE); |
Get environment variable and save to var
Definition at line 57 of file switch_test.h.
#define fst_getenv_required | ( | env | ) | char *env = fst_getenv_default(#env, NULL, SWITCH_TRUE); |
Get mandatory environment variable and save to var. Exit with error if missing.
Definition at line 63 of file switch_test.h.
#define FST_MINCORE_BEGIN | ( | confdir | ) |
Minimal FS core load
Definition at line 321 of file switch_test.h.
#define FST_MINCORE_END FST_CORE_END |
Definition at line 338 of file switch_test.h.
#define FST_MODULE_BEGIN | ( | modname, | |
suite | |||
) |
Define the beginning of a FreeSWITCH module test suite. Loads the module for test.
modname | name of module to load. |
suite | the name of this test suite |
Definition at line 355 of file switch_test.h.
#define FST_MODULE_END | ( | ) |
Define the end of a FreeSWITCH module test suite.
Definition at line 379 of file switch_test.h.
#define fst_parse_json_file | ( | varname, | |
file | |||
) |
Parse JSON file and save to varname
Test Requires: JSON file can be opened and parsed
Test Output: varname points at cJSON object
varname | name of var to store the resulting cJSON object |
file | name of file to parse |
Definition at line 874 of file switch_test.h.
#define fst_play_and_detect_speech_app_test | ( | recognizer, | |
grammar, | |||
prompt_filename, | |||
input_filename | |||
) |
Use play_and_detect_speech APP to test recognizer
Test Requires: switch_ivr_displace_session(input_filename) == SWITCH_STATUS_SUCCESS switch_core_session_execute_application(play_and_detect_speech) == SWITCH_STATUS_SUCCESS mod_dptools is loaded
Test Checks: fst_asr_result != NULL after recognition completes
Test Output: fst_asr_result has the result from detect_speech_result channel variable.
recognizer | name of recognizer |
grammar | recognizer grammar |
prompt_filename | name of prompt to play |
input_filename | name of file containing input audio for the recognizer |
Definition at line 726 of file switch_test.h.
#define fst_play_and_detect_speech_test | ( | recognizer, | |
grammar, | |||
prompt_filename, | |||
input_filename, | |||
input_args | |||
) |
Use play_and_detect_speech core function to test recognizer
Test Requires: switch_ivr_displace_session(input_filename) == SWITCH_STATUS_SUCCESS
Test Checks: fst_asr_result != NULL after recognition completes
Test Output: fst_asr_result has the result from detect_speech_result channel variable.
recognizer | name of recognizer |
grammar | recognizer grammar |
prompt_filename | name of prompt to play |
input_filename | name of file containing input audio for the recognizer |
input_args | input callback args |
Definition at line 757 of file switch_test.h.
#define fst_play_and_detect_speech_test_begin | ( | ) |
Define beginning of play_and_detect_speech recognizer test
Defined vars: const char *fst_asr_result; Result of last recognition. Allocated from test memory pool.
Definition at line 702 of file switch_test.h.
#define fst_play_and_detect_speech_test_end | ( | ) | } |
Define end of play_and_detect_speech recognizer test
Definition at line 770 of file switch_test.h.
#define fst_requires fct_req |
check for test requirement - execute teardown on failure
Definition at line 149 of file switch_test.h.
#define fst_requires_module | ( | modname | ) | fct_req(switch_loadable_module_exists(modname) == SWITCH_STATUS_SUCCESS) |
check for required module - execute teardown on failure
Definition at line 154 of file switch_test.h.
#define fst_sched_recv_dtmf | ( | when, | |
digits | |||
) |
Inject DTMF into the session to be detected.
Test Requires: switch_api_execute(sched_api) == SWITCH_STATUS_SUCCESS mod_commands is loaded
when | string describing when to send dtmf |
digits | to send |
Definition at line 815 of file switch_test.h.
#define FST_SESSION_BEGIN | ( | name | ) | FST_SESSION_BEGIN_RATE(name, 8000) |
Define a session test in a test suite. This can be used to test IVR functions. See FST_SESSION_BEGIN_RATE_VIDEO
Definition at line 533 of file switch_test.h.
#define FST_SESSION_BEGIN_RATE | ( | name, | |
rate | |||
) | FST_SESSION_BEGIN_RATE_VIDEO(name, rate, "") |
Definition at line 534 of file switch_test.h.
#define FST_SESSION_BEGIN_RATE_VIDEO | ( | name, | |
rate, | |||
video_codec | |||
) |
Define a session test in a test suite. This can be used to test IVR functions.
Records session audio to /tmp/name.wav where name is the name of the test.
Required modules: mod_loopback - for null endpoint mod_sndfile - for wav file support
Defined vars: switch_memory_pool_t *fst_pool; A memory pool that is torn down on test completion switch_core_timer_t *fst_timer; A 8kHz, 20ms soft timer (160 samples per frame) switch_core_session_t *fst_session; The outbound null session. L16, 1 channel, 8kHz. switch_core_session_t *fst_session_pool; The outbound null session's pool. switch_channel_t *fst_channel; The outbound null session's channel.
name | the name of this test |
rate | the rate of the channel |
video_codec | the rate of the channel |
Definition at line 490 of file switch_test.h.
#define FST_SESSION_END | ( | ) |
Define the end of a session test in a test suite. Hangs up session under test.
Definition at line 542 of file switch_test.h.
#define fst_session_park | ( | session | ) |
Park FreeSWITCH session. This is handy when wanting to use switch_core_session_execute_async() on the test session.
session | to park |
Definition at line 142 of file switch_test.h.
#define FST_SETUP_BEGIN | ( | ) |
Define the test suite setup. This is run before each test or session test.
Definition at line 407 of file switch_test.h.
#define FST_SETUP_END FCT_SETUP_END |
Define the end of test suite setup.
Definition at line 419 of file switch_test.h.
#define FST_SUITE_BEGIN | ( | suite | ) |
Define the beginning of a test suite not associated with a module.
suite | the name of this test suite |
Definition at line 394 of file switch_test.h.
#define FST_SUITE_END FCT_FIXTURE_SUITE_END |
Define the end of a test suite.
Definition at line 401 of file switch_test.h.
#define FST_TEARDOWN_BEGIN | ( | ) |
Define the test suite teardown. This is run after each test or session test.
Definition at line 425 of file switch_test.h.
#define FST_TEARDOWN_END FCT_TEARDOWN_END |
Define the test suite teardown end.
Definition at line 437 of file switch_test.h.
#define FST_TEST_BEGIN | ( | name | ) |
Define a test in a test suite. Defined vars: switch_memory_pool_t *fst_pool; A memory pool that is torn down on test completion switch_core_timer_t *fst_timer; A 8kHz, 20ms soft timer (160 samples per frame)
name | the name of this test |
Definition at line 446 of file switch_test.h.
#define fst_test_core_asr | ( | grammar, | |
input_filename | |||
) |
Execute test on opened recognizer. Reads audio from input file and passes it to the recognizer.
Test Requires: switch_core_asr_load_grammar(grammar) == SWITCH_STATUS_SUCCESS switch_core_file_open(input_filename) == SWITCH_STATUS_SUCCESS switch_core_file_close() == SWITCH_STATUS_SUCCESS
Test Checks: Got result from recognizer.
Test Output: fst_asr_result has the xmlstr from switch_core_file_get_results()
grammar | recognizer grammar |
input_filename | name of file containing audio to send to recognizer. |
Definition at line 608 of file switch_test.h.
#define fst_test_core_asr_close | ( | ) |
Close an open recognizer
Test Requires: switch_core_asr_close(&ah, flags) == SWITCH_STATUS_SUCCESS
Definition at line 685 of file switch_test.h.
#define fst_test_core_asr_open | ( | recognizer | ) |
Open core ASR for a recognizer module. Opens for L16, 1 channel, 8KHz.
Test Requires: switch_core_asr_open() == SWITCH_STATUS_SUCCESS
Defined vars: switch_asr_handle_t ah; Core ASR handle switch_asr_flag_t flags; Core ASR flags used to open recognizer. char *fst_asr_result; Result of last recognition. Allocated from test memory pool.
recognizer | name of recognizer to open (like gcloud_dialogflow) |
Definition at line 581 of file switch_test.h.
#define fst_test_core_asr_pause | ( | ) |
Pause an open recognizer.
Test Requires: switch_core_asr_pause(&ah) == SWITCH_STATUS_SUCCESS
Definition at line 661 of file switch_test.h.
#define fst_test_core_asr_resume | ( | ) |
Resumes an open recognizer
Test Requires: switch_core_asr_resume(&ah) == SWITCH_STATUS_SUCCESS
Definition at line 673 of file switch_test.h.
#define FST_TEST_END |
Definition at line 461 of file switch_test.h.
#define fst_time_mark | ( | ) | fst_time_start = switch_time_now(); |
Mark reference for time measure
Definition at line 199 of file switch_test.h.
#define fst_xcheck | ( | expr, | |
error_msg | |||
) | (fct_xchk(expr, "%s", error_msg)) |
Check a test /w error message
Definition at line 205 of file switch_test.h.
#define fst_xml_attr | ( | attr | ) | if (!zstr(attr)) fst_xml_stream.write_function(&fst_xml_stream, " %s=\"%s\"", #attr, attr); |
Definition at line 838 of file switch_test.h.
#define fst_xml_body | ( | body | ) |
Definition at line 850 of file switch_test.h.
#define fst_xml_close_tag | ( | tag_name | ) |
Definition at line 841 of file switch_test.h.
#define fst_xml_end | ( | ) | switch_xml_parse_str_dynamic((char *)fst_xml_stream.data, SWITCH_FALSE); |
Definition at line 858 of file switch_test.h.
#define fst_xml_open_tag | ( | tag_name | ) |
Definition at line 834 of file switch_test.h.
#define fst_xml_start | ( | ) |
Definition at line 828 of file switch_test.h.
#define SWITCH_TEST_BASE_DIR_OVERRIDE "." |
Referenced by fst_init_core_and_modload().
|
static |
Get environment variable and save to var
Definition at line 41 of file switch_test.h.
|
static |
initialize FS core from optional configuration dir
Definition at line 69 of file switch_test.h.
References switch_directories::cache_dir, switch_directories::conf_dir, switch_directories::data_dir, switch_directories::db_dir, switch_directories::fonts_dir, switch_directories::grammar_dir, switch_directories::htdocs_dir, switch_directories::images_dir, switch_directories::localstate_dir, switch_directories::log_dir, switch_directories::recordings_dir, switch_directories::run_dir, SCF_MINIMAL, switch_directories::script_dir, switch_directories::sounds_dir, switch_directories::storage_dir, switch_core_init(), switch_core_init_and_modload(), switch_core_set_globals(), switch_core_set_variable(), switch_getpid(), SWITCH_GLOBAL_dirs, switch_mprintf(), SWITCH_PATH_SEPARATOR, switch_sleep(), SWITCH_STATUS_SUCCESS, SWITCH_TEST_BASE_DIR_OVERRIDE, SWITCH_TRUE, and zstr.
int fst_tag_body = 0 |
Definition at line 832 of file switch_test.h.
int fst_tag_children = 0 |
Definition at line 831 of file switch_test.h.