mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-24 12:14:13 +00:00
[Unit-tests] Place module tests into their module's Makefile.am, fix tests, add missing Makefile.am to mod_png, implement recursive make check.
This commit is contained in:
1 parent
5e83ef7e7b
commit
751d5ff55b
20 files changed
+186
-89
No files matched your search
@@ -23,13 +23,15 @@ mod_av_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm -lz
|
||||
|
||||
|
||||
noinst_PROGRAMS = test/test_mod_av test/test_avformat
|
||||
AM_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS)
|
||||
AM_LDFLAGS = $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(RESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS)
|
||||
TESTS = $(noinst_PROGRAMS)
|
||||
|
||||
test_test_mod_av_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS)
|
||||
test_test_mod_av_LDFLAGS = $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(RESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS)
|
||||
test_test_mod_av_LDADD = libavmod.la $(switch_builddir)/libfreeswitch.la
|
||||
test_test_avformat_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS)
|
||||
test_test_avformat_LDFLAGS = $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(RESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS)
|
||||
test_test_avformat_LDADD = libavmod.la $(switch_builddir)/libfreeswitch.la
|
||||
|
||||
TESTS = $(noinst_PROGRAMS)
|
||||
|
||||
else
|
||||
install: error
|
||||
all: error
|
||||
|
||||
@@ -44,6 +44,7 @@ FST_CORE_BEGIN("conf")
|
||||
|
||||
FST_TEST_BEGIN(avformat_test_colorspace_RGB)
|
||||
{
|
||||
char path[1024];
|
||||
switch_status_t status;
|
||||
switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 1);
|
||||
switch_file_handle_t fh = { 0 };
|
||||
@@ -57,7 +58,8 @@ FST_CORE_BEGIN("conf")
|
||||
|
||||
fst_requires(img);
|
||||
|
||||
status = switch_core_file_open(&fh, "{colorspace=0}./test_RGB.mp4", 1, 8000, flags, fst_pool);
|
||||
sprintf(path, "%s%s%s%s", "{colorspace=0}", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../test_RGB.mp4");
|
||||
status = switch_core_file_open(&fh, path, 1, 8000, flags, fst_pool);
|
||||
fst_requires(status == SWITCH_STATUS_SUCCESS);
|
||||
fst_requires(switch_test_flag(&fh, SWITCH_FILE_OPEN));
|
||||
|
||||
@@ -70,7 +72,8 @@ FST_CORE_BEGIN("conf")
|
||||
status = switch_core_file_write_video(&fh, &frame);
|
||||
fst_check(status == SWITCH_STATUS_SUCCESS);
|
||||
|
||||
ccimg = switch_img_read_png("./cluecon.png", SWITCH_IMG_FMT_ARGB);
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../cluecon.png");
|
||||
ccimg = switch_img_read_png(path, SWITCH_IMG_FMT_ARGB);
|
||||
fst_requires(ccimg);
|
||||
|
||||
color.a = 255;
|
||||
@@ -101,6 +104,7 @@ FST_CORE_BEGIN("conf")
|
||||
|
||||
FST_TEST_BEGIN(avformat_test_colorspace_BT7)
|
||||
{
|
||||
char path[1024];
|
||||
switch_status_t status;
|
||||
switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 1);
|
||||
switch_file_handle_t fh = { 0 };
|
||||
@@ -114,7 +118,8 @@ FST_CORE_BEGIN("conf")
|
||||
|
||||
fst_requires(img);
|
||||
|
||||
status = switch_core_file_open(&fh, "{colorspace=1}./test_BT7.mp4", 1, 8000, flags, fst_pool);
|
||||
sprintf(path, "%s%s%s%s", "{colorspace=1}", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../test_BT7.mp4");
|
||||
status = switch_core_file_open(&fh, path, 1, 8000, flags, fst_pool);
|
||||
fst_requires(status == SWITCH_STATUS_SUCCESS);
|
||||
fst_requires(switch_test_flag(&fh, SWITCH_FILE_OPEN));
|
||||
|
||||
@@ -127,7 +132,8 @@ FST_CORE_BEGIN("conf")
|
||||
status = switch_core_file_write_video(&fh, &frame);
|
||||
fst_check(status == SWITCH_STATUS_SUCCESS);
|
||||
|
||||
ccimg = switch_img_read_png("./cluecon.png", SWITCH_IMG_FMT_ARGB);
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../cluecon.png");
|
||||
ccimg = switch_img_read_png(path, SWITCH_IMG_FMT_ARGB);
|
||||
fst_requires(ccimg);
|
||||
|
||||
color.a = 255;
|
||||
|
||||
@@ -24,12 +24,12 @@ libmodconference_la_CFLAGS = $(AM_CFLAGS) -I.
|
||||
noinst_PROGRAMS = test/test_image test/test_member
|
||||
|
||||
test_test_image_SOURCES = test/test_image.c
|
||||
test_test_image_CFLAGS = $(AM_CFLAGS) -I.
|
||||
test_test_image_CFLAGS = $(AM_CFLAGS) -I. -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\"
|
||||
test_test_image_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
|
||||
test_test_image_LDADD = libmodconference.la
|
||||
|
||||
test_test_member_SOURCES = test/test_member.c
|
||||
test_test_member_CFLAGS = $(AM_CFLAGS) -I.
|
||||
test_test_member_CFLAGS = $(AM_CFLAGS) -I. -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\"
|
||||
test_test_member_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
|
||||
test_test_member_LDADD = libmodconference.la
|
||||
|
||||
|
||||
@@ -50,32 +50,39 @@ FST_CORE_BEGIN("./conf")
|
||||
|
||||
FST_TEST_BEGIN(scale_test)
|
||||
{
|
||||
switch_image_t *img = switch_img_read_png("images/signalwire.png", SWITCH_IMG_FMT_I420);
|
||||
char path[4096];
|
||||
switch_image_t *img;
|
||||
int i;
|
||||
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire.png");
|
||||
img = switch_img_read_png(path, SWITCH_IMG_FMT_I420);
|
||||
|
||||
for(i = 2; i <= 10; i += 2) {
|
||||
switch_image_t *scaled_img = NULL;
|
||||
char name[1024];
|
||||
|
||||
switch_snprintf(name, sizeof(name), "images/signalwire-scaled-I420-%d.png", i);
|
||||
switch_snprintf(name, sizeof(name), "../images/signalwire-scaled-I420-%d.png", i);
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, name);
|
||||
switch_img_scale(img, &scaled_img, img->d_w / i, img->d_h / i);
|
||||
fst_requires(scaled_img);
|
||||
switch_img_write_png(scaled_img, name);
|
||||
switch_img_write_png(scaled_img, path);
|
||||
switch_img_free(&scaled_img);
|
||||
}
|
||||
|
||||
switch_img_free(&img);
|
||||
|
||||
img = switch_img_read_png("images/signalwire.png", SWITCH_IMG_FMT_ARGB);
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire.png");
|
||||
img = switch_img_read_png(path, SWITCH_IMG_FMT_ARGB);
|
||||
|
||||
for(i = 2; i <= 10; i += 2) {
|
||||
switch_image_t *scaled_img = NULL;
|
||||
char name[1024];
|
||||
|
||||
switch_snprintf(name, sizeof(name), "images/signalwire-scaled-ARGB-%d.png", i);
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, name);
|
||||
switch_img_scale(img, &scaled_img, img->d_w / i, img->d_h / i);
|
||||
fst_requires(scaled_img);
|
||||
switch_img_write_png(scaled_img, name);
|
||||
switch_img_write_png(scaled_img, path);
|
||||
switch_img_free(&scaled_img);
|
||||
}
|
||||
|
||||
@@ -86,7 +93,8 @@ FST_CORE_BEGIN("./conf")
|
||||
|
||||
FST_TEST_BEGIN(scale_test)
|
||||
{
|
||||
switch_image_t *img = switch_img_read_png("images/signalwire-scaled-ARGB-8.png", SWITCH_IMG_FMT_ARGB);
|
||||
char path[1024];
|
||||
switch_image_t *img;
|
||||
char *font_face = "font/AEH.ttf";
|
||||
char *fg = "#000000";
|
||||
char *altfg = "#FFFFFF";
|
||||
@@ -96,10 +104,14 @@ FST_CORE_BEGIN("./conf")
|
||||
const char *txt = "FEESWITCH ROCKS";
|
||||
const char *alttxt = "freeswitch";
|
||||
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire-scaled-ARGB-8.png");
|
||||
img = switch_img_read_png(path, SWITCH_IMG_FMT_ARGB);
|
||||
|
||||
switch_img_txt_handle_create(&txthandle, font_face, fg, bg, font_size, 0, NULL);
|
||||
switch_img_txt_handle_render(txthandle, img, 50, 3, txt, NULL, fg, bg, font_size, 0);
|
||||
switch_img_txt_handle_render(txthandle, img, 60, 15, alttxt, NULL, altfg, "#000000", font_size, 0);
|
||||
switch_img_write_png(img, "images/signalwire-scaled-ARGB-8-txt.png");
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire-scaled-ARGB-8-txt.png");
|
||||
switch_img_write_png(img, path);
|
||||
|
||||
switch_img_free(&img);
|
||||
}
|
||||
|
||||
@@ -52,16 +52,18 @@ FST_CORE_BEGIN("./conf")
|
||||
|
||||
FST_TEST_BEGIN(member_test)
|
||||
{
|
||||
char path[4096];
|
||||
const char *logo = "{position=left-bot,text_x=center,"
|
||||
"center_offset=190,text=#000000:transparent:font/AEH.ttf:50:"
|
||||
"'FREESWITCH ROCKS',alt_text_x=center,alt_center_offset=190,"
|
||||
"alt_text_y=88,alt_text=#ffffff:transparent:font/AEH.ttf:40:"
|
||||
"'freeswitch'}images/signalwire.png";
|
||||
"'freeswitch'}";
|
||||
conference_member_t smember = { 0 };
|
||||
conference_member_t *member = &smember;
|
||||
switch_image_t *img;
|
||||
int i;
|
||||
|
||||
sprintf(path, "%s%s%s%s", logo, SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire.png");
|
||||
switch_mutex_init(&member->write_mutex, SWITCH_MUTEX_NESTED, fst_pool);
|
||||
switch_mutex_init(&member->flag_mutex, SWITCH_MUTEX_NESTED, fst_pool);
|
||||
switch_mutex_init(&member->fnode_mutex, SWITCH_MUTEX_NESTED, fst_pool);
|
||||
@@ -70,17 +72,18 @@ FST_CORE_BEGIN("./conf")
|
||||
switch_mutex_init(&member->read_mutex, SWITCH_MUTEX_NESTED, fst_pool);
|
||||
switch_thread_rwlock_create(&member->rwlock, fst_pool);
|
||||
|
||||
conference_member_set_logo(member, logo);
|
||||
conference_member_set_logo(member, path);
|
||||
img = member->video_logo;
|
||||
|
||||
for(i = 2; i <= 10; i += 2) {
|
||||
switch_image_t *scaled_img = NULL;
|
||||
char name[1024];
|
||||
|
||||
switch_snprintf(name, sizeof(name), "images/logo-signalwire-scaled-%d.png", i);
|
||||
switch_snprintf(name, sizeof(name), "../images/logo-signalwire-scaled-%d.png", i);
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, name);
|
||||
switch_img_scale(img, &scaled_img, img->d_w / i, img->d_h / i);
|
||||
fst_requires(scaled_img);
|
||||
switch_img_write_png(scaled_img, name);
|
||||
switch_img_write_png(scaled_img, path);
|
||||
switch_img_free(&scaled_img);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,22 @@
|
||||
include $(top_srcdir)/build/modmake.rulesam
|
||||
MODNAME=mod_http_cache
|
||||
|
||||
noinst_LTLIBRARIES = libhttpcachemod.la
|
||||
libhttpcachemod_la_SOURCES = mod_http_cache.c common.c aws.c azure.c
|
||||
|
||||
mod_LTLIBRARIES = mod_http_cache.la
|
||||
mod_http_cache_la_SOURCES = mod_http_cache.c common.c aws.c azure.c
|
||||
mod_http_cache_la_SOURCES =
|
||||
mod_http_cache_la_CFLAGS = $(AM_CFLAGS)
|
||||
mod_http_cache_la_CPPFLAGS = $(CURL_CFLAGS) $(AM_CPPFLAGS)
|
||||
mod_http_cache_la_LIBADD = $(switch_builddir)/libfreeswitch.la
|
||||
mod_http_cache_la_LIBADD = $(switch_builddir)/libfreeswitch.la libhttpcachemod.la
|
||||
mod_http_cache_la_LDFLAGS = $(CURL_LIBS) -avoid-version -module -no-undefined -shared
|
||||
|
||||
SUBDIRS=. test
|
||||
noinst_PROGRAMS = test/test_aws
|
||||
|
||||
test_test_aws_SOURCES = test/test_aws.c
|
||||
test_test_aws_CFLAGS = $(AM_CFLAGS) -I. -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\"
|
||||
test_test_aws_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
|
||||
test_test_aws_LDADD = libhttpcachemod.la
|
||||
|
||||
TESTS = $(noinst_PROGRAMS)
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
noinst_PROGRAMS = test_aws
|
||||
AM_CFLAGS = $(SWITCH_AM_CFLAGS)
|
||||
AM_LDFLAGS = $(switch_builddir)/libfreeswitch.la -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) ../mod_http_cache.la
|
||||
TESTS = $(noinst_PROGRAMS)
|
||||
@@ -10,5 +10,12 @@ mod_test_la_SOURCES =
|
||||
mod_test_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SOFIALA) libtestmod.la
|
||||
mod_test_la_LDFLAGS = -avoid-version -module -no-undefined -shared
|
||||
|
||||
SUBDIRS=. test
|
||||
noinst_PROGRAMS = test/test_asr
|
||||
|
||||
test_test_asr_SOURCES = test/test_asr.c
|
||||
test_test_asr_CFLAGS = $(AM_CFLAGS) -I. -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\"
|
||||
test_test_asr_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
|
||||
test_test_asr_LDADD = libtestmod.la
|
||||
|
||||
TESTS = $(noinst_PROGRAMS)
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
include $(top_srcdir)/build/modmake.rulesam
|
||||
noinst_PROGRAMS = test_asr
|
||||
test_asr_CFLAGS = $(AM_CFLAGS) -I../
|
||||
test_asr_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
|
||||
test_asr_LDADD = ../libtestmod.la
|
||||
TESTS = $(noinst_PROGRAMS)
|
||||
@@ -73,12 +73,14 @@ FST_TEARDOWN_END()
|
||||
|
||||
FST_TEST_BEGIN(core_asr)
|
||||
{
|
||||
char path[1024];
|
||||
const char* session_id = "123435";
|
||||
char *grammar = switch_core_sprintf(fst_pool, "{start-input-timers=true,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}default", session_id);
|
||||
fst_test_core_asr_open("test");
|
||||
sprintf(path, "%s%s%s%s", "file_string://silence_stream://3000,0!", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/agent.wav!silence_stream://3000,0");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"file_string://silence_stream://3000,0!sounds/agent.wav!silence_stream://3000,0");
|
||||
path);
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||
fst_test_core_asr_resume();
|
||||
fst_test_core_asr(
|
||||
@@ -86,9 +88,10 @@ FST_TEST_BEGIN(core_asr)
|
||||
"silence_stream://30000,0");
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "no_input");
|
||||
fst_test_core_asr_resume();
|
||||
sprintf(path, "%s%s%s%s", "file_string://", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/agent.wav!silence_stream://3000,0");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"file_string://sounds/agent.wav!silence_stream://3000,0");
|
||||
path);
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||
fst_test_core_asr_resume();
|
||||
fst_test_core_asr(
|
||||
@@ -96,22 +99,24 @@ FST_TEST_BEGIN(core_asr)
|
||||
"silence_stream://30000,0");
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "no_input");
|
||||
fst_test_core_asr_resume();
|
||||
sprintf(path, "%s%s%s%s", "file_string://", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/agent.wav!silence_stream://3000,0");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"file_string://sounds/agent.wav!silence_stream://3000,0");
|
||||
path);
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||
fst_test_core_asr_pause();
|
||||
fst_test_core_asr_resume();
|
||||
sprintf(path, "%s%s%s%s", "file_string://", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/agent.wav!silence_stream://3000,0");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"file_string://sounds/agent.wav!silence_stream://3000,0");
|
||||
path);
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||
fst_test_core_asr_close();
|
||||
|
||||
fst_test_core_asr_open("test");
|
||||
sprintf(path, "%s%s%s%s", "file_string://silence_stream://1000,0!", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/ivr-please_state_your_name_and_reason_for_calling.wav!silence_stream://3000,0");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"file_string://silence_stream://1000,0!sounds/ivr-please_state_your_name_and_reason_for_calling.wav!silence_stream://3000,0");
|
||||
path);
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||
fst_test_core_asr_close();
|
||||
}
|
||||
@@ -119,35 +124,40 @@ FST_TEST_END()
|
||||
|
||||
FST_TEST_BEGIN(core_asr_auto_resume)
|
||||
{
|
||||
char path[1024];
|
||||
const char* session_id = "123435";
|
||||
char *grammar = switch_core_sprintf(fst_pool, "{start-input-timers=true,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}default", session_id);
|
||||
fst_test_core_asr_open("test");
|
||||
switch_set_flag(&ah, SWITCH_ASR_FLAG_AUTO_RESUME);
|
||||
sprintf(path, "%s%s%s%s", "file_string://silence_stream://3000,0!", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/agent.wav!silence_stream://3000,0");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"file_string://silence_stream://3000,0!sounds/agent.wav!silence_stream://3000,0");
|
||||
path);
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"silence_stream://30000,0");
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "no_input");
|
||||
sprintf(path, "%s%s%s%s", "file_string://", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/agent.wav!silence_stream://3000,0");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"file_string://sounds/agent.wav!silence_stream://3000,0");
|
||||
path);
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"silence_stream://30000,0");
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "no_input");
|
||||
fst_test_core_asr_resume();
|
||||
sprintf(path, "%s%s%s%s", "file_string://", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/agent.wav!silence_stream://3000,0");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"file_string://sounds/agent.wav!silence_stream://3000,0");
|
||||
path);
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||
fst_test_core_asr_resume();
|
||||
sprintf(path, "%s%s%s%s", "file_string://silence_stream://1000,0!", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/ivr-please_state_your_name_and_reason_for_calling.wav!silence_stream://3000,0");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"file_string://silence_stream://1000,0!sounds/ivr-please_state_your_name_and_reason_for_calling.wav!silence_stream://3000,0");
|
||||
path);
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||
fst_test_core_asr_close();
|
||||
}
|
||||
@@ -155,21 +165,24 @@ FST_TEST_END()
|
||||
|
||||
FST_TEST_BEGIN(core_asr_abuse)
|
||||
{
|
||||
char path[1024];
|
||||
const char* session_id = "5351514";
|
||||
char *grammar = switch_core_sprintf(fst_pool, "{start-input-timers=true,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}default", session_id);
|
||||
fst_test_core_asr_open("test");
|
||||
sprintf(path, "%s%s%s%s", "file_string://silence_stream://3000,0!", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/agent.wav!silence_stream://3000,0");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"file_string://silence_stream://3000,0!sounds/agent.wav!silence_stream://3000,0");
|
||||
path);
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||
fst_test_core_asr_resume();
|
||||
fst_test_core_asr_resume();
|
||||
fst_test_core_asr_resume();
|
||||
fst_test_core_asr_pause();
|
||||
fst_test_core_asr_resume();
|
||||
sprintf(path, "%s%s%s%s", "file_string://", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/agent.wav!silence_stream://3000,0");
|
||||
fst_test_core_asr(
|
||||
grammar,
|
||||
"file_string://sounds/agent.wav!silence_stream://3000,0");
|
||||
path);
|
||||
fst_check_string_equals(get_query_result_text(fst_pool, fst_asr_result), "agent");
|
||||
fst_test_core_asr_resume();
|
||||
|
||||
@@ -181,24 +194,30 @@ FST_TEST_END()
|
||||
|
||||
FST_SESSION_BEGIN(play_and_detect_1)
|
||||
{
|
||||
char path[1024];
|
||||
char path2[1024];
|
||||
const char *result_text = NULL;
|
||||
char *grammar = switch_core_session_sprintf(fst_session, "{start-input-timers=false,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}default", switch_core_session_get_uuid(fst_session));
|
||||
fst_play_and_detect_speech_test_begin();
|
||||
|
||||
/* initial welcome and request */
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/ivr-please_state_your_name_and_reason_for_calling.wav");
|
||||
sprintf(path2, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/agent.wav");
|
||||
fst_play_and_detect_speech_app_test("test",
|
||||
grammar,
|
||||
"sounds/ivr-please_state_your_name_and_reason_for_calling.wav",
|
||||
"sounds/agent.wav");
|
||||
path,
|
||||
path2);
|
||||
result_text = get_query_result_text(fst_pool, fst_asr_result);
|
||||
fst_requires(result_text != NULL);
|
||||
fst_check_string_equals(result_text, "agent");
|
||||
|
||||
/* follow up request */
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/ivr-please_state_your_name_and_reason_for_calling.wav");
|
||||
sprintf(path2, "%s%s%s%s", "file_string://1000,0!", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/agent.wav");
|
||||
fst_play_and_detect_speech_app_test("test",
|
||||
grammar,
|
||||
"sounds/ivr-please_state_your_name_and_reason_for_calling.wav",
|
||||
"file_string://1000,0!sounds/agent.wav");
|
||||
path,
|
||||
path2);
|
||||
result_text = get_query_result_text(fst_pool, fst_asr_result);
|
||||
fst_requires(result_text != NULL);
|
||||
fst_check_string_equals(result_text, "agent");
|
||||
@@ -209,23 +228,28 @@ FST_SESSION_END()
|
||||
|
||||
FST_SESSION_BEGIN(play_and_detect_no_input_follow_up)
|
||||
{
|
||||
char path[1024];
|
||||
char path2[1024];
|
||||
const char *result_text = NULL;
|
||||
char *grammar = switch_core_session_sprintf(fst_session, "{start-input-timers=false,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}", switch_core_session_get_uuid(fst_session));
|
||||
|
||||
switch_ivr_schedule_hangup(switch_epoch_time_now(NULL) + 60, switch_core_session_get_uuid(fst_session), SWITCH_CAUSE_NORMAL_CLEARING, SWITCH_FALSE);
|
||||
fst_play_and_detect_speech_test_begin();
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/ivr-please_state_your_name_and_reason_for_calling.wav");
|
||||
sprintf(path2, "%s%s%s%s", "file_string://silence_stream://4000,0!", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/agent.wav");
|
||||
fst_play_and_detect_speech_app_test("test",
|
||||
grammar,
|
||||
"sounds/ivr-please_state_your_name_and_reason_for_calling.wav",
|
||||
"file_string://silence_stream://4000,0!sounds/agent.wav");
|
||||
path,
|
||||
path2);
|
||||
result_text = get_query_result_text(fst_pool, fst_asr_result);
|
||||
fst_requires(result_text != NULL);
|
||||
fst_check_string_equals(result_text, "agent");
|
||||
|
||||
/* follow up request - no input */
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/ivr-please_state_your_name_and_reason_for_calling.wav");
|
||||
fst_play_and_detect_speech_app_test("test",
|
||||
grammar,
|
||||
"sounds/ivr-please_state_your_name_and_reason_for_calling.wav",
|
||||
path,
|
||||
"silence_stream://10000,0");
|
||||
result_text = get_query_result_text(fst_pool, fst_asr_result);
|
||||
fst_requires(result_text != NULL);
|
||||
@@ -237,15 +261,17 @@ FST_SESSION_END()
|
||||
|
||||
FST_SESSION_BEGIN(play_and_detect_no_input)
|
||||
{
|
||||
char path[1024];
|
||||
const char *result_text = NULL;
|
||||
|
||||
switch_ivr_schedule_hangup(switch_epoch_time_now(NULL) + 60, switch_core_session_get_uuid(fst_session), SWITCH_CAUSE_NORMAL_CLEARING, SWITCH_FALSE);
|
||||
fst_play_and_detect_speech_test_begin();
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/ivr-please_state_your_name_and_reason_for_calling.wav");
|
||||
fst_play_and_detect_speech_app_test("test",
|
||||
switch_core_session_sprintf(fst_session,
|
||||
"{start-input-timers=false,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}default",
|
||||
switch_core_session_get_uuid(fst_session)),
|
||||
"sounds/ivr-please_state_your_name_and_reason_for_calling.wav",
|
||||
path,
|
||||
"silence_stream://10000,0");
|
||||
result_text = get_query_result_text(fst_pool, fst_asr_result);
|
||||
fst_requires(result_text != NULL);
|
||||
@@ -257,16 +283,17 @@ FST_SESSION_END()
|
||||
|
||||
FST_SESSION_BEGIN(play_and_detect_start_input_timers)
|
||||
{
|
||||
char path[1024];
|
||||
const char *result_text = NULL;
|
||||
|
||||
switch_ivr_schedule_hangup(switch_epoch_time_now(NULL) + 60, switch_core_session_get_uuid(fst_session), SWITCH_CAUSE_NORMAL_CLEARING, SWITCH_FALSE);
|
||||
fst_play_and_detect_speech_test_begin();
|
||||
|
||||
sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "sounds/ivr-please_state_your_name_and_reason_for_calling.wav");
|
||||
fst_play_and_detect_speech_app_test("test",
|
||||
switch_core_session_sprintf(fst_session,
|
||||
"{start-input-timers=true,no-input-timeout=5000,speech-timeout=10000,channel-uuid=%s}default",
|
||||
switch_core_session_get_uuid(fst_session)),
|
||||
"sounds/ivr-please_state_your_name_and_reason_for_calling.wav",
|
||||
path,
|
||||
"silence_stream://10000,0");
|
||||
result_text = get_query_result_text(fst_pool, fst_asr_result);
|
||||
fst_requires(result_text != NULL);
|
||||
@@ -282,7 +309,7 @@ FST_TEST_BEGIN(unload_test)
|
||||
{
|
||||
const char *err = NULL;
|
||||
switch_sleep(1000000);
|
||||
fst_check(switch_loadable_module_unload_module((char *)"../.libs", (char *)"mod_test", SWITCH_FALSE, &err) == SWITCH_STATUS_SUCCESS);
|
||||
fst_check(switch_loadable_module_unload_module(SWITCH_GLOBAL_dirs.mod_dir, (char *)"mod_test", SWITCH_FALSE, &err) == SWITCH_STATUS_SUCCESS);
|
||||
}
|
||||
FST_TEST_END()
|
||||
|
||||
|
||||
Reference in new issue
Block a user