*/
#define fst_sched_recv_dtmf(when, digits) \
{ \
+ switch_status_t api_result; \
switch_stream_handle_t stream = { 0 }; \
SWITCH_STANDARD_STREAM(stream); \
fst_requires(fst_core > 1); \
fst_requires_module("mod_commands"); \
- switch_status_t api_result = switch_api_execute("sched_api", switch_core_session_sprintf(fst_session, "%s none uuid_recv_dtmf %s %s", when, switch_core_session_get_uuid(fst_session), digits), NULL, &stream); \
+ api_result = switch_api_execute("sched_api", switch_core_session_sprintf(fst_session, "%s none uuid_recv_dtmf %s %s", when, switch_core_session_get_uuid(fst_session), digits), NULL, &stream); \
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(fst_session), SWITCH_LOG_INFO, "Injecting DTMF %s at %s\n", digits, when); \
fst_requires(api_result == SWITCH_STATUS_SUCCESS); \
switch_safe_free(stream.data); \
noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils switch_core switch_console switch_vpx switch_core_file \
switch_ivr_play_say switch_core_codec switch_rtp switch_xml
-noinst_PROGRAMS+= switch_core_video switch_core_db switch_vad switch_core_asr
-AM_LDFLAGS = -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) $(openssl_LIBS)
+noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_core_asr
+
+AM_LDFLAGS += -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) $(openssl_LIBS)
AM_LDFLAGS += $(FREESWITCH_LIBS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS)
-AM_CFLAGS = $(SWITCH_AM_CPPFLAGS)
-AM_CPPFLAGS = $(SWITCH_AM_CPPFLAGS)
if HAVE_FVAD
AM_CFLAGS += -DSWITCH_HAVE_FVAD
*
*/
-#include <stdio.h>
#include <switch.h>
#include <test/switch_test.h>
FST_TEST_BEGIN(benchmark)
{
- switch_stream_handle_t stream = { 0 };
- SWITCH_STANDARD_STREAM(stream);
-
char expected_result[] = {'A', 0x00, 0x01, 0x02, 'B'};
char raw_data[] = {0x00, 0x01, 0x02};
+ switch_stream_handle_t stream = { 0 };
+ SWITCH_STANDARD_STREAM(stream);
stream.write_function(&stream, "%s", "A");
stream.raw_write_function(&stream, (uint8_t *) raw_data, sizeof(raw_data));
if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) == SWITCH_STATUS_SUCCESS) {
switch_cache_db_execute_sql2str(dbh, "SELECT 1", (char *)&res1, 20, NULL);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SELECT 1: %s\n", switch_str_nil(res1));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SELECT 1: %s\n", res1);
switch_cache_db_execute_sql2str(dbh, "SELECT NULL", (char *)&res2, 20, NULL);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SELECT NULL: %s\n", switch_str_nil(res2));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SELECT NULL: %s\n", res2);
}
FST_TEST_BEGIN(data_url_test)
{
+ char *data_url = NULL;
switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 120, 60, 1);
switch_image_t *argb_img = switch_img_alloc(NULL, SWITCH_IMG_FMT_ARGB, 120, 60, 1);
switch_rgb_color_t color = { 0 };
color.r = 255;
// color.g = 255;
// color.b = 255;
- char *data_url = NULL;
switch_img_fill(img, 0, 0, img->d_w, img->d_h, &color);
switch_img_add_text(img->planes[0], img->d_w, 10, 10, "-1234567890");
-#include <stdio.h>
#include <switch.h>
#include <test/switch_test.h>
FST_TEST_BEGIN(benchmark)
{
switch_event_t *event = NULL;
- switch_bool_t verbose = SWITCH_TRUE;
- const char *err = NULL;
switch_time_t start_ts, end_ts;
- int rc = 0, loops = 10, x = 0;
+ int loops = 10, x = 0;
switch_status_t status = SWITCH_STATUS_SUCCESS;
char **index = NULL;
uint64_t micro_total = 0;
-#include <stdio.h>
#include <switch.h>
#include <test/switch_test.h>
FST_TEST_BEGIN(benchmark)
{
- switch_event_t *event = NULL;
- switch_bool_t verbose = SWITCH_TRUE;
- const char *err = NULL;
switch_time_t start_ts, end_ts;
uint64_t micro_total = 0;
double micro_per = 0;
switch_time_t small_start_ts, small_end_ts;
#endif
- int rc = 0, loops = 10;
+ int loops = 10;
switch_status_t status = SWITCH_STATUS_SUCCESS;
char **index = NULL;
switch_hash_t *hash = NULL;
FST_TEST_BEGIN(originate_test_empty_dial_string)
{
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
switch_dial_handle_t *dh;
FST_TEST_BEGIN(originate_test_group_confirm_one_leg)
{
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
switch_dial_handle_t *dh;
FST_TEST_BEGIN(originate_test_group_confirm_no_pre_answer)
{
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
switch_dial_handle_t *dh;
FST_TEST_BEGIN(originate_test_group_confirm_exec_in_pre_answer)
{
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
switch_dial_handle_t *dh;
FST_TEST_BEGIN(originate_test_group_confirm_exec_after_answer_early_ok)
{
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
switch_dial_handle_t *dh;
FST_TEST_BEGIN(originate_test_group_confirm_exec_after_answer_ignore_early_media)
{
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
switch_dial_handle_t *dh;
FST_TEST_BEGIN(originate_test_group_confirm_2_legs)
{
+ const char *name;
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
switch_dial_handle_t *dh;
status = switch_ivr_originate(NULL, &session, &cause, NULL, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, dh);
fst_requires(status == SWITCH_STATUS_SUCCESS);
fst_requires(session);
- const char *name = switch_core_session_get_name(session);
+ name = switch_core_session_get_name(session);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "channel %s\n", name);
fst_check_string_equals(name, "null/test2");
switch_core_session_rwunlock(session);
FST_TEST_BEGIN(originate_test_group_confirm_global_var)
{
+ const char *name;
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
const char *dialstring = "{group_confirm_file='playback silence_stream://1000',group_confirm_key=exec}null/test";
status = switch_ivr_originate(NULL, &session, &cause, dialstring, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
fst_requires(status == SWITCH_STATUS_SUCCESS);
fst_requires(session);
- const char *name = switch_core_session_get_name(session);
+ name = switch_core_session_get_name(session);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "channel %s\n", name);
fst_check_string_equals(name, "null/test");
switch_core_session_rwunlock(session);
FST_TEST_BEGIN(originate_test_group_confirm_local_var)
{
+ const char *name;
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
const char *dialstring = "[group_confirm_file='playback silence_stream://1000',group_confirm_key=exec]null/test1,"
status = switch_ivr_originate(NULL, &session, &cause, dialstring, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
fst_requires(status == SWITCH_STATUS_SUCCESS);
fst_requires(session);
- const char *name = switch_core_session_get_name(session);
+ name = switch_core_session_get_name(session);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "channel %s\n", name);
fst_check_string_equals(name, "null/test2");
switch_core_session_rwunlock(session);
FST_TEST_BEGIN(originate_test_group_confirm_loopback_endpoint_originate)
{
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
const char *dialstring = "[group_confirm_key=exec,group_confirm_file='event a=1']loopback/loopback";
FST_SESSION_BEGIN(originate_test_group_confirm_loopback_endpoint_bridge)
{
- switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
- switch_status_t status;
- switch_call_cause_t cause;
const char *dialstring = "[group_confirm_key=exec,group_confirm_file='event a=1']loopback/loopback";
switch_event_bind("test", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, loopback_group_confirm_event_handler, NULL);
FST_TEST_BEGIN(originate_test_group_confirm_leg_timeout_not_finished)
{
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
switch_dial_handle_t *dh;
FST_TEST_BEGIN(originate_test_group_confirm_leg_timeout_finished)
{
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
switch_dial_handle_t *dh;
FST_TEST_BEGIN(originate_test_group_confirm_timeout_leg)
{
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
switch_dial_handle_t *dh;
FST_TEST_BEGIN(originate_test_group_confirm_timeout_global)
{
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
switch_dial_handle_t *dh;
FST_TEST_BEGIN(originate_test_group_confirm_cancel_timeout_global)
{
switch_core_session_t *session = NULL;
- switch_channel_t *channel = NULL;
switch_status_t status;
switch_call_cause_t cause;
switch_dial_handle_t *dh;
FST_TEARDOWN_END()
FST_TEST_BEGIN(test_rtp)
{
+ switch_rtp_stats_t *stats;
switch_core_new_memory_pool(&pool);
rtp_session = switch_rtp_new(rx_host, rx_port, tx_host, tx_port, TEST_PT, 8000, 20 * 1000, flags, "soft", &err, pool, 0, 0);
switch_rtp_set_ssrc(rtp_session, 0xabcd);
switch_rtp_set_remote_ssrc(rtp_session, 0xcdef);
fst_xcheck(switch_rtp_get_ssrc(rtp_session) == 0xabcd, "get SSRC");
- switch_rtp_stats_t *stats = switch_rtp_get_stats(rtp_session, pool);
+ stats = switch_rtp_get_stats(rtp_session, pool);
fst_requires(stats);
switch_rtp_destroy(&rtp_session);
*
*/
-#include <stdio.h>
#include <switch.h>
#include <test/switch_test.h>
FST_TEST_BEGIN(b64)
{
+ switch_size_t size;
char *str = "ABC";
unsigned char b64_str[6];
char decoded_str[4];
fst_check(status == SWITCH_STATUS_SUCCESS);
fst_check_string_equals((const char *)b64_str, "QUJD");
- switch_size_t size = switch_b64_decode((const char *)b64_str, decoded_str, sizeof(decoded_str));
+ size = switch_b64_decode((const char *)b64_str, decoded_str, sizeof(decoded_str));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "decoded_str: %s\n", decoded_str);
fst_check_string_equals(decoded_str, str);
fst_check(size == 4);
FST_TEST_BEGIN(energy)
{
+ int res;
int16_t *buf = malloc(sizeof(int16_t) * 160);
int duration;
float pos = 0.0;
switch_vad_t *vad = switch_vad_init(8000, 1);
fst_requires(vad);
- int res = switch_vad_set_mode(vad, -1);
+ res = switch_vad_set_mode(vad, -1);
fst_requires(res == 0);
switch_vad_set_param(vad, "silence_ms", 400);
switch_vad_set_param(vad, "voice_ms", 80);
FST_TEST_BEGIN(vp8_test)
{
+ switch_image_t *img;
+ uint8_t buf[SWITCH_DEFAULT_VIDEO_SIZE + 12];
switch_status_t status;
switch_codec_t codec = { 0 };
+ switch_frame_t frame = { 0 };
switch_codec_settings_t codec_settings = {{ 0 }};
+ int packets = 0;
+ switch_status_t encode_status;
// switch_set_string(codec_settings.video.config_profile_name, "conference");
codec_settings.video.width = 1280;
&codec_settings, fst_pool);
fst_check(status == SWITCH_STATUS_SUCCESS);
- switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 1);
+ img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 1);
fst_requires(img);
- uint8_t buf[SWITCH_DEFAULT_VIDEO_SIZE + 12];
- switch_frame_t frame = { 0 };
-
frame.packet = buf;
frame.packetlen = SWITCH_DEFAULT_VIDEO_SIZE + 12;
frame.data = buf + 12;
frame.timestamp = 0;
frame.img = img;
- int packets = 0;
- switch_status_t encode_status;
-
do {
frame.datalen = SWITCH_DEFAULT_VIDEO_SIZE;
encode_status = switch_core_codec_encode_video(&codec, &frame);