From c4add0663c909c62a3f0e71e7266099d671edf4d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 6 Sep 2013 23:28:46 +0500 Subject: [PATCH 01/49] FS-5762 FS-5765 --resolve --- src/mod/endpoints/mod_sofia/sofia_presence.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 17a85a94c8..c706b54028 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -29,6 +29,7 @@ * Bret McDanel * Raymond Chandler * William King + * Emmanuel Schmidbauer * * sofia_presence.c -- SOFIA SIP Endpoint (presence code) * @@ -3304,7 +3305,8 @@ static int broadsoft_sla_gather_state_callback(void *pArg, int argc, char **argv if (strcasecmp(state, "idle") && uuid && (session = switch_core_session_locate(uuid))) { switch_channel_t *channel = switch_core_session_get_channel(session); - if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { + if (switch_channel_test_flag(channel, CF_ORIGINATOR) || switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR) || + switch_channel_inbound_display(channel) || switch_channel_test_flag(channel, CF_SLA_BARGING)) { callee_name = switch_channel_get_variable(channel, "callee_id_name"); callee_number = switch_channel_get_variable(channel, "callee_id_number"); From 58e7db0c6dff7afb8b192baf32372f2a8ba00f31 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Sat, 7 Sep 2013 12:21:33 -0700 Subject: [PATCH 02/49] FS-5763: --resolve add configure check for lzma and newer readhat/sl tinfo stuff --- Makefile.am | 6 +++--- configure.in | 20 +++++++++++++++++--- libs/esl/Makefile | 3 ++- libs/esl/eslmake.rules.in | 2 ++ libs/libedit/configure.ac | 13 ++++++++++--- libs/libedit/examples/Makefile.am | 2 +- libs/libedit/libedit.pc.in | 2 +- src/mod/applications/mod_spandsp/Makefile.am | 2 +- 8 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 libs/esl/eslmake.rules.in diff --git a/Makefile.am b/Makefile.am index 91d949b359..21b83bad2f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -130,7 +130,7 @@ endif if HAVE_LIBEDIT CORE_CFLAGS += -I$(switch_srcdir)/libs/libedit/src -DSWITCH_HAVE_LIBEDIT -CORE_LIBS += libs/libedit/src/.libs/libedit.a +CORE_LIBS += libs/libedit/src/.libs/libedit.a $(TINFO_LIBS) endif if ENABLE_TIMERFD_WRAPPER @@ -324,7 +324,7 @@ fs_cli_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS) -lm if HAVE_LIBEDIT fs_cli_CFLAGS += -DHAVE_EDITLINE -I$(switch_srcdir)/libs/libedit/src -fs_cli_LDADD = libs/libedit/src/.libs/libedit.a +fs_cli_LDADD = libs/libedit/src/.libs/libedit.a $(TINFO_LIBS) endif @@ -373,7 +373,7 @@ freeswitch_LDADD = libfreeswitch.la libs/apr/libapr-1.la if HAVE_LIBEDIT freeswitch_CFLAGS += -Ilibs/libedit/src -DSWITCH_HAVE_LIBEDIT -freeswitch_LDADD += libs/libedit/src/.libs/libedit.a +freeswitch_LDADD += libs/libedit/src/.libs/libedit.a $(TINFO_LIBS) endif if HAVE_ODBC diff --git a/configure.in b/configure.in index ed8c361eac..da0a8bd559 100644 --- a/configure.in +++ b/configure.in @@ -464,6 +464,12 @@ SPANDSP_LA_JBIG="-ljbig" AC_SUBST(SPANDSP_LA_JBIG) fi +AC_CHECK_LIB(lzma, lzma_code, have_liblzma=yes, have_liblzma=no) +if test "x$have_liblzma" = "xyes" ; then +SPANDSP_LA_LZMA="-llzma" +AC_SUBST(SPANDSP_LA_LZMA) +fi + AC_CHECK_LIB(resolv, res_init, have_libresolv=yes, have_libresolv=no) if test "x$have_libresolv" = "xyes" ; then APR_ADDTO(SWITCH_AM_LDFLAGS, -lresolv) @@ -951,9 +957,16 @@ AC_ARG_ENABLE(core-libedit-support, [AS_HELP_STRING([--disable-core-libedit-support], [Compile without libedit Support])], [enable_core_libedit_support="$enableval"], [enable_core_libedit_support="yes"]) if test "$enable_core_libedit_support" = "yes" ; then - AC_CHECK_LIB(ncurses, tgetent,, - [AC_CHECK_LIB(curses, tgetent,, - [AC_MSG_ERROR([libtermcap, libcurses or libncurses are required!])] )] ) + AC_CHECK_LIB(tinfo, tgetent, [have_libtinfo="yes"], [have_libtinfo="no"]) + if test "$have_libtinfo" == "yes" ; then + TINFO_LIBS="-ltinfo" + else + TINFO_LIBS="" + AC_CHECK_LIB(ncurses, tgetent,, + [AC_CHECK_LIB(curses, tgetent,, + [AC_MSG_ERROR([libtermcap, libcurses or libncurses are required!])] )] ) + fi + AC_SUBST(TINFO_LIBS) fi SAC_OPENSSL @@ -1125,6 +1138,7 @@ AC_CONFIG_FILES([Makefile build/getg729.sh build/freeswitch.pc build/modmake.rules + libs/esl/eslmake.rules libs/xmlrpc-c/xmlrpc_config.h libs/xmlrpc-c/config.mk libs/xmlrpc-c/srcdir.mk diff --git a/libs/esl/Makefile b/libs/esl/Makefile index 746f730124..727bf3169f 100644 --- a/libs/esl/Makefile +++ b/libs/esl/Makefile @@ -1,3 +1,4 @@ +include eslmake.rules PWD=$(shell pwd) INCS=-I$(PWD)/src/include LIBEDIT_DIR=../../libs/libedit @@ -7,7 +8,7 @@ PICKY=-O2 CFLAGS=$(BASE_FLAGS) $(PICKY) CXXFLAGS=$(BASE_FLAGS) MYLIB=libesl.a -LIBS=-lncurses -lesl -lpthread -lm +LIBS=-lncurses -lesl -lpthread -lm $(TINFO_LIBS) LDFLAGS=-L. OBJS=src/esl.o src/esl_event.o src/esl_threadmutex.o src/esl_config.o src/esl_json.o src/esl_buffer.o SRC=src/esl.c src/esl_json.c src/esl_event.c src/esl_threadmutex.c src/esl_config.c src/esl_oop.cpp src/esl_json.c src/esl_buffer.c diff --git a/libs/esl/eslmake.rules.in b/libs/esl/eslmake.rules.in new file mode 100644 index 0000000000..0a1fe7f624 --- /dev/null +++ b/libs/esl/eslmake.rules.in @@ -0,0 +1,2 @@ +TINFO_LIBS=@TINFO_LIBS@ + diff --git a/libs/libedit/configure.ac b/libs/libedit/configure.ac index 5bf51d28cf..207bb0f118 100644 --- a/libs/libedit/configure.ac +++ b/libs/libedit/configure.ac @@ -27,9 +27,16 @@ AC_PROG_LN_S AC_PROG_AWK EL_MANTYPE -AC_CHECK_LIB(curses, tgetent,, - [AC_CHECK_LIB(ncurses, tgetent,, - [AC_MSG_ERROR([libtermcap, libcurses or libncurses are required!])] )] ) +AC_CHECK_LIB(tinfo, tgetent, [have_libtinfo="yes"], [have_libtinfo="no"]) +if test "$have_libtinfo" == "yes" ; then + TINFO_LIBS="-ltinfo" +else + TINFO_LIBS="" + AC_CHECK_LIB(ncurses, tgetent,, + [AC_CHECK_LIB(curses, tgetent,, + [AC_MSG_ERROR([libtermcap, libcurses or libncurses are required!])] )] ) +fi +AC_SUBST(TINFO_LIBS) # Checks for header files. AC_FUNC_ALLOCA diff --git a/libs/libedit/examples/Makefile.am b/libs/libedit/examples/Makefile.am index 01f1e9c7eb..ef7e032b9f 100644 --- a/libs/libedit/examples/Makefile.am +++ b/libs/libedit/examples/Makefile.am @@ -1,5 +1,5 @@ -LDADD = $(top_builddir)/src/libedit.la +LDADD = $(top_builddir)/src/libedit.la $(TINFO_LIBS) AM_CFLAGS = -I$(top_srcdir)/src noinst_PROGRAMS = test fileman diff --git a/libs/libedit/libedit.pc.in b/libs/libedit/libedit.pc.in index 4e0f6ffece..ad879c74d6 100644 --- a/libs/libedit/libedit.pc.in +++ b/libs/libedit/libedit.pc.in @@ -7,6 +7,6 @@ Name: libedit Description: command line editor library provides generic line editing, history, and tokenization functions. Version: @VERSION@ Requires: -Libs: -L${libdir} -ledit -lcurses +Libs: -L${libdir} -ledit -lcurses @TINFO_LIBS@ Cflags: -I${includedir} -I${includedir}/editline diff --git a/src/mod/applications/mod_spandsp/Makefile.am b/src/mod/applications/mod_spandsp/Makefile.am index 98b781bd7d..0c78e46367 100644 --- a/src/mod/applications/mod_spandsp/Makefile.am +++ b/src/mod/applications/mod_spandsp/Makefile.am @@ -12,7 +12,7 @@ SPANDSP_LA=$(SPANDSP_BUILDDIR)/src/libspandsp.la mod_LTLIBRARIES = mod_spandsp.la mod_spandsp_la_SOURCES = mod_spandsp.c udptl.c mod_spandsp_fax.c mod_spandsp_dsp.c mod_spandsp_codecs.c mod_spandsp_modem.c mod_spandsp_la_CFLAGS = $(BUILD_CFLAGS) $(AM_CFLAGS) -I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff -I$(SPANDSP_BUILDDIR)/src -I$(TIFF_BUILDDIR)/libtiff -I. -mod_spandsp_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LA) $(TIFF_LA) $(SPANDSP_LA_JBIG) -ljpeg -lz -lutil +mod_spandsp_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LA) $(TIFF_LA) $(SPANDSP_LA_JBIG) $(SPANDSP_LA_LZMA) -ljpeg -lz -lutil mod_spandsp_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(SPANDSP_LA): $(TIFF_LA) $(SPANDSP_DIR) $(SPANDSP_DIR)/.update From b9e307c0cae9dea87ed86b55706ed1265fafbf89 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Sun, 8 Sep 2013 17:19:00 +0800 Subject: [PATCH 03/49] Improved handling of page lengths in the T.85 decoder --- libs/spandsp/src/t85_decode.c | 63 ++++++++++++++++++++++++----------- libs/spandsp/src/v17rx.c | 3 +- libs/spandsp/src/v27ter_rx.c | 5 +++ 3 files changed, 49 insertions(+), 22 deletions(-) diff --git a/libs/spandsp/src/t85_decode.c b/libs/spandsp/src/t85_decode.c index 82bbecf013..dda2a4053d 100644 --- a/libs/spandsp/src/t85_decode.c +++ b/libs/spandsp/src/t85_decode.c @@ -271,11 +271,16 @@ SPAN_DECLARE(bool) t85_analyse_header(uint32_t *width, uint32_t *length, const u return false; *width = pack_32(&data[6]); *length = pack_32(&data[10]); + if ((data[19] & T85_VLENGTH)) + { + /* TODO: scan for a true length, if the initial one just says 0xFFFFFFFF */ + /* There should be an image length sequence terminating the image later on. */ + } return true; } /*- End of function --------------------------------------------------------*/ -static int check_bih(t85_decode_state_t *s) +static int extract_bih(t85_decode_state_t *s) { /* Check that the fixed parameters have the values they are expected to be fixed at - see T.85/Table 1 */ @@ -303,50 +308,68 @@ static int check_bih(t85_decode_state_t *s) return T4_DECODE_INVALID_DATA; } /* P - Number of bit planes */ - if (s->buffer[2] < s->min_bit_planes || s->buffer[2] > s->max_bit_planes) - { - span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. %d bit planes. Should be %d to %d.\n", s->buffer[2], s->min_bit_planes, s->max_bit_planes); - s->end_of_data = 2; - return T4_DECODE_INVALID_DATA; - } s->bit_planes = s->buffer[2]; s->current_bit_plane = 0; /* Now look at the stuff which actually counts in a T.85 header. */ /* XD - Horizontal image size at layer D */ s->xd = pack_32(&s->buffer[4]); + /* YD - Vertical image size at layer D */ + s->yd = pack_32(&s->buffer[8]); + /* L0 - Rows per stripe, at the lowest resolution */ + s->l0 = pack_32(&s->buffer[12]); + /* MX - Maximum horizontal offset allowed for AT pixel */ + s->mx = s->buffer[16]; + /* Options byte */ + s->options = s->buffer[19]; + + if (s->bit_planes < s->min_bit_planes || s->bit_planes > s->max_bit_planes) + { + span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. %d bit planes. Should be %d to %d.\n", s->bit_planes, s->min_bit_planes, s->max_bit_planes); + s->end_of_data = 2; + return T4_DECODE_INVALID_DATA; + } if (s->xd == 0 || (s->max_xd && s->xd > s->max_xd)) { span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. Width is %" PRIu32 "\n", s->xd); s->end_of_data = 2; return T4_DECODE_INVALID_DATA; } - /* YD - Vertical image size at layer D */ - s->yd = pack_32(&s->buffer[8]); - if (s->yd == 0 || (s->max_yd && s->yd > s->max_yd)) + if (s->yd == 0) { span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. Length is %" PRIu32 "\n", s->yd); s->end_of_data = 2; return T4_DECODE_INVALID_DATA; } - /* L0 - Rows per stripe, at the lowest resolution */ - s->l0 = pack_32(&s->buffer[12]); + if (s->max_yd) + { + if ((s->options & T85_VLENGTH)) + { + if (s->yd > s->max_yd) + s->yd = s->max_yd; + } + else + { + if (s->yd > s->max_yd) + { + span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. Length is %" PRIu32 "\n", s->yd); + s->end_of_data = 2; + return T4_DECODE_INVALID_DATA; + } + } + } if (s->l0 == 0) { span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. L0 is %" PRIu32 "\n", s->l0); s->end_of_data = 2; return T4_DECODE_INVALID_DATA; } - /* MX - Maximum horizontal offset allowed for AT pixel */ - s->mx = s->buffer[16]; if (s->mx > 127) { span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. MX is %d\n", s->mx); s->end_of_data = 2; return T4_DECODE_INVALID_DATA; } - /* Options byte */ - s->options = s->buffer[19]; - if ((s->options & 0x97)) + if ((s->options & ~(T85_LRLTWO | T85_VLENGTH | T85_TPBON))) { span_log(&s->logging, SPAN_LOG_FLOW, "BIH invalid. Options are 0x%X\n", s->options); s->end_of_data = 2; @@ -413,7 +436,7 @@ SPAN_DECLARE(int) t85_decode_put(t85_decode_state_t *s, const uint8_t data[], si cnt = i; if (s->bie_len < 20) return T4_DECODE_MORE_DATA; - if ((ret = check_bih(s)) != T4_DECODE_OK) + if ((ret = extract_bih(s)) != T4_DECODE_OK) return ret; /* Set up the two/three row buffer */ bytes_per_row = (s->xd + 7) >> 3; @@ -690,8 +713,8 @@ SPAN_DECLARE(int) t85_decode_put(t85_decode_state_t *s, const uint8_t data[], si cnt += decode_pscd(s, data + cnt, len - cnt); if (s->interrupt) return T4_DECODE_INTERRUPT; - /* We should only have stopped processing PSCD if - we ran out of data, or hit a T82_ESC */ + /* We should only have stopped processing PSCD if we ran out of data, + or hit a T82_ESC */ if (cnt < len && data[cnt] != T82_ESC) { s->end_of_data = 2; diff --git a/libs/spandsp/src/v17rx.c b/libs/spandsp/src/v17rx.c index bfc701a597..85d72d0ed6 100644 --- a/libs/spandsp/src/v17rx.c +++ b/libs/spandsp/src/v17rx.c @@ -905,12 +905,11 @@ static void process_half_baud(v17_rx_state_t *s, const complexf_t *sample) tune_equalizer(s, &z, target); if (++s->training_count >= V17_TRAINING_SEG_2_LEN - 48) { + s->training_error = FP_SCALE(0.0f); #if defined(SPANDSP_USE_FIXED_POINTx) - s->training_error = 0; s->carrier_track_i = 100; s->carrier_track_p = 500000; #else - s->training_error = 0.0f; s->carrier_track_i = 100.0f; s->carrier_track_p = 500000.0f; #endif diff --git a/libs/spandsp/src/v27ter_rx.c b/libs/spandsp/src/v27ter_rx.c index 228c5e4d77..3451d66026 100644 --- a/libs/spandsp/src/v27ter_rx.c +++ b/libs/spandsp/src/v27ter_rx.c @@ -178,8 +178,13 @@ SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexi16_t * SPAN_DECLARE(int) v27ter_rx_equalizer_state(v27ter_rx_state_t *s, complexf_t **coeffs) #endif { +#if defined(SPANDSP_USE_FIXED_POINT) + *coeffs = NULL; + return 0; +#else *coeffs = s->eq_coeff; return V27TER_EQUALIZER_LEN; +#endif } /*- End of function --------------------------------------------------------*/ From a48bfafddd379c24ae7e933c4dc34c3b182db110 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Mon, 9 Sep 2013 02:06:17 -0400 Subject: [PATCH 04/49] Fix log line in ftmod_analog.c --- libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index 9e6943e51f..e342c827d1 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -942,7 +942,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) ftdm_channel_lock(closed_chan); if (ftdmchan->type == FTDM_CHAN_TYPE_FXO && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Going onhook"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Going onhook\n"); ftdm_channel_command(ftdmchan, FTDM_COMMAND_ONHOOK, NULL); } From 7b03cb511cfcce44843660c336433c2faf59c166 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 9 Sep 2013 20:08:43 +0500 Subject: [PATCH 05/49] FS-5717 --resolve --- src/mod/endpoints/mod_sofia/sofia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index f91c81abc5..f29156cbae 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -858,7 +858,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro const char *name_var = "callee_id_name"; const char *num_var = "callee_id_number"; - if (switch_true(switch_channel_get_variable(channel, SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE))) { + if (switch_true(switch_channel_get_variable(channel, SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE)) || sofia_test_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE)) { return; } From 9074a1245564d19145e4d104f34d7286210bef22 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 10 Sep 2013 00:59:55 +0800 Subject: [PATCH 06/49] FS-5769 --resolve --- src/switch_core.c | 8 ++++---- src/switch_loadable_module.c | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/switch_core.c b/src/switch_core.c index 7782265dc3..2f6cd7b023 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -28,7 +28,7 @@ * Paul D. Tinsley * Marcel Barbulescu * Joseph Sullivan - * + * Seven Du * * switch_core.c -- Main Core Library * @@ -1691,13 +1691,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc } switch_log_init(runtime.memory_pool, runtime.colorize_console); - - if (flags & SCF_MINIMAL) return SWITCH_STATUS_SUCCESS; runtime.tipping_point = 0; runtime.timer_affinity = -1; runtime.microseconds_per_tick = 20000; + if (flags & SCF_MINIMAL) return SWITCH_STATUS_SUCCESS; + switch_load_core_config("switch.conf"); switch_core_state_machine_init(runtime.memory_pool); @@ -1970,7 +1970,7 @@ static void switch_load_core_config(const char *file) if (!runtime.events_use_dispatch) { runtime.events_use_dispatch = 1; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Implicitly setting events-use-dispatch based on usage of this initial-event-threads parameter.\n"); } diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 833d7f0b46..9b5d7d62ec 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -24,7 +24,7 @@ * Contributor(s): * * Anthony Minessale II - * + * Seven Du * * switch_loadable_module.c -- Loadable Modules * @@ -1732,10 +1732,11 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo switch_core_hash_init_nocase(&loadable_modules.dialplan_hash, loadable_modules.pool); switch_mutex_init(&loadable_modules.mutex, SWITCH_MUTEX_NESTED, loadable_modules.pool); + if (!autoload) return SWITCH_STATUS_SUCCESS; + switch_loadable_module_load_module("", "CORE_SOFTTIMER_MODULE", SWITCH_FALSE, &err); switch_loadable_module_load_module("", "CORE_PCM_MODULE", SWITCH_FALSE, &err); - if (!autoload) return SWITCH_STATUS_SUCCESS; if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) { switch_xml_t mods, ld; From 054225b80adcfb9040d4289d2be9a02d5521bcc9 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Tue, 10 Sep 2013 01:52:21 +0800 Subject: [PATCH 07/49] refactor to use the new switch_core_session_refresh_video function --- .../applications/mod_conference/mod_conference.c | 8 ++------ src/mod/applications/mod_fsv/mod_fsv.c | 14 ++------------ 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 6007fb2047..111e4ef917 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -32,6 +32,7 @@ * David Weekly * Joao Mesquita * Raymond Chandler + * Seven Du * * mod_conference.c -- Software Conference Bridge * @@ -1869,7 +1870,6 @@ static void *SWITCH_THREAD_FUNC conference_video_bridge_thread_run(switch_thread switch_status_t status; switch_frame_t *read_frame; conference_obj_t *conference = vh->member_a->conference; - switch_core_session_message_t msg = { 0 }; switch_thread_rwlock_rdlock(conference->rwlock); switch_thread_rwlock_rdlock(vh->member_a->rwlock); @@ -1882,16 +1882,12 @@ static void *SWITCH_THREAD_FUNC conference_video_bridge_thread_run(switch_thread switch_core_session_read_lock(session_a); switch_core_session_read_lock(session_b); - /* Tell the channel to request a fresh vid frame */ - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ; - vh->up = 1; while (vh->up == 1 && switch_test_flag(vh->member_a, MFLAG_RUNNING) && switch_test_flag(vh->member_b, MFLAG_RUNNING) && switch_channel_ready(channel_a) && switch_channel_ready(channel_b)) { if (switch_channel_test_flag(channel_a, CF_VIDEO_REFRESH_REQ)) { - switch_core_session_receive_message(session_b, &msg); + switch_core_session_refresh_video(session_b); switch_channel_clear_flag(channel_a, CF_VIDEO_REFRESH_REQ); } diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index 3a90df2eb6..67acca7a7a 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -114,17 +114,12 @@ SWITCH_STANDARD_APP(record_fsv_function) switch_codec_implementation_t read_impl = { 0 }; switch_dtmf_t dtmf = { 0 }; int count = 0, sanity = 30; - switch_core_session_message_t msg = { 0 }; switch_channel_set_flag(channel, CF_VIDEO_PASSIVE); - /* Tell the channel to request a fresh vid frame */ - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ; - switch_core_session_get_read_impl(session, &read_impl); switch_channel_answer(channel); - switch_core_session_receive_message(session, &msg); + switch_core_session_refresh_video(session); switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, ""); @@ -310,15 +305,10 @@ SWITCH_STANDARD_APP(play_fsv_function) switch_dtmf_t dtmf = { 0 }; switch_frame_t *read_frame; switch_codec_implementation_t read_impl = { 0 }; - switch_core_session_message_t msg = { 0 }; switch_channel_set_flag(channel, CF_VIDEO_PASSIVE); - /* Tell the channel to request a fresh vid frame */ - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ; - - switch_core_session_receive_message(session, &msg); + switch_core_session_refresh_video(session); switch_core_session_get_read_impl(session, &read_impl); From 149acf0c115585220bdab0d42d4e42c4fbcdb2f0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 9 Sep 2013 22:53:45 +0500 Subject: [PATCH 08/49] oops --- src/mod/endpoints/mod_sofia/sofia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index f29156cbae..83080a3890 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -858,7 +858,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro const char *name_var = "callee_id_name"; const char *num_var = "callee_id_number"; - if (switch_true(switch_channel_get_variable(channel, SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE)) || sofia_test_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE)) { + if (switch_true(switch_channel_get_variable(channel, SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE)) || !sofia_test_pflag(profile, PFLAG_SEND_DISPLAY_UPDATE)) { return; } From 53307c8f359fbee0ca2713aaa0f81efdc27c6db0 Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 9 Sep 2013 13:37:48 -0500 Subject: [PATCH 09/49] regression from FS-5614 on forward --- .../mod_voicemail/mod_voicemail.c | 113 ++++++++++-------- 1 file changed, 60 insertions(+), 53 deletions(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index bf355d043b..a87e849001 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1671,8 +1671,9 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t char *new_file_path = NULL; char vm_cc[256] = ""; char macro_buf[80] = ""; + int ok = 0; - switch_xml_t xml_root, x_domain, x_param, x_params, x_user = NULL; + switch_xml_t x_param, x_params, x_user = NULL; switch_event_t *my_params = NULL; switch_bool_t vm_enabled = SWITCH_TRUE; @@ -1704,62 +1705,68 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t new_file_path = cbt->file_path; } - get_exten: + while (!ok) { - switch_snprintf(macro_buf, sizeof(macro_buf), "phrase:%s:%s", VM_FORWARD_MESSAGE_ENTER_EXTENSION_MACRO, profile->terminator_key); - vm_cc[0] = '\0'; - - TRY_CODE(switch_ivr_read - (session, 0, sizeof(vm_cc), macro_buf, NULL, vm_cc, sizeof(vm_cc), profile->digit_timeout, profile->terminator_key, 0)); - - cmd = switch_core_session_sprintf(session, "%s@%s@%s %s %s '%s'", vm_cc, cbt->domain, profile->name, - new_file_path, cbt->cid_number, cbt->cid_name); - - switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); - switch_assert(my_params); - - if (switch_xml_locate_domain(cbt->domain, my_params, &xml_root, &x_domain) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Failed to forward message - Cannot locate domain %s\n", cbt->domain); - TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL)); - goto get_exten; - } else if (switch_xml_locate_user_in_domain(vm_cc, x_domain, &x_user, NULL) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Failed to forward message - Cannot locate user %s@%s\n", vm_cc, cbt->domain); - TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL)); - goto get_exten; - } else { - x_params = switch_xml_child(x_user, "params"); - - for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) { - const char *var = switch_xml_attr_soft(x_param, "name"); - const char *val = switch_xml_attr_soft(x_param, "value"); - if (zstr(var) || zstr(val)) { - continue; /* Ignore empty entires */ - } - - if (!strcasecmp(var, "vm-enabled")) { - vm_enabled = !switch_false(val); - } + if (x_user) { + switch_xml_free(x_user); } - if (!vm_enabled) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Failed to forward message - Voicemail is disabled for user %s@%s\n", vm_cc, cbt->domain); - TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL)); - goto get_exten; - } else { - if (voicemail_inject(cmd, session) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Forwarded message to %s\n", vm_cc); - TRY_CODE(switch_ivr_phrase_macro(session, VM_ACK_MACRO, "saved", NULL, NULL)); - cbt->move = VM_MOVE_SAME; - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to forward message to %s\n", vm_cc); - TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL)); - goto get_exten; - } - } - } + switch_snprintf(macro_buf, sizeof(macro_buf), "phrase:%s:%s", VM_FORWARD_MESSAGE_ENTER_EXTENSION_MACRO, profile->terminator_key); + vm_cc[0] = '\0'; + + TRY_CODE(switch_ivr_read + (session, 0, sizeof(vm_cc), macro_buf, NULL, vm_cc, sizeof(vm_cc), profile->digit_timeout, profile->terminator_key, 0)); + + cmd = switch_core_session_sprintf(session, "%s@%s@%s %s %s '%s'", vm_cc, cbt->domain, profile->name, + new_file_path, cbt->cid_number, cbt->cid_name); + + switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); + switch_assert(my_params); + + status = switch_xml_locate_user_merged("id", vm_cc, cbt->domain, NULL, &x_user, my_params); + switch_event_destroy(&my_params); - switch_xml_free(xml_root); - switch_event_destroy(&my_params); + if (status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "Failed to forward message - Cannot locate user %s@%s\n", vm_cc, cbt->domain); + TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL)); + continue; + } else { + x_params = switch_xml_child(x_user, "params"); + + for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) { + const char *var = switch_xml_attr_soft(x_param, "name"); + const char *val = switch_xml_attr_soft(x_param, "value"); + if (zstr(var) || zstr(val)) { + continue; /* Ignore empty entires */ + } + + if (!strcasecmp(var, "vm-enabled")) { + vm_enabled = !switch_false(val); + } + } + + if (!vm_enabled) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Failed to forward message - Voicemail is disabled for user %s@%s\n", vm_cc, cbt->domain); + TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL)); + continue; + } else { + if (voicemail_inject(cmd, session) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Forwarded message to %s\n", vm_cc); + TRY_CODE(switch_ivr_phrase_macro(session, VM_ACK_MACRO, "saved", NULL, NULL)); + cbt->move = VM_MOVE_SAME; + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to forward message to %s\n", vm_cc); + TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL)); + continue; + } + } + } + + switch_xml_free(x_user); + break; + } + } else if (!strcmp(input, profile->delete_file_key) || (!strcmp(input, profile->email_key) && !zstr(cbt->email))) { char *sql = switch_mprintf("update voicemail_msgs set flags='delete' where uuid='%s'", cbt->uuid); vm_execute_sql(profile, sql, profile->mutex); From 6a842ab21d1c179a2141e057ef9ab9e751655a16 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Mon, 9 Sep 2013 16:22:49 -0400 Subject: [PATCH 10/49] mod_rayo: fix record complete URI when recording to HTTP --- .../mod_rayo/rayo_record_component.c | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/mod/event_handlers/mod_rayo/rayo_record_component.c b/src/mod/event_handlers/mod_rayo/rayo_record_component.c index 601d8cb3aa..f6b4db06aa 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_record_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_record_component.c @@ -85,22 +85,23 @@ static void complete_record(struct rayo_component *component, const char *reason { switch_core_session_t *session = NULL; const char *uuid = component->parent->id; - char *uri = switch_mprintf("file://%s", RECORD_COMPONENT(component)->local_file_path); + const char *uri = RECORD_COMPONENT(component)->local_file_path; iks *recording; switch_size_t file_size = 0; -/* TODO this doesn't work with HTTP */ + + /* TODO this doesn't work with HTTP, improve core RECORD_STOP event so that file size and duration is reported */ #if 0 switch_file_t *file; - if (switch_file_open(&file, RECORD_COMPONENT(component)->local_file_path, SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD, RAYO_POOL(component)) == SWITCH_STATUS_SUCCESS) { + if (switch_file_open(&file, uri, SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD, RAYO_POOL(component)) == SWITCH_STATUS_SUCCESS) { file_size = switch_file_get_size(file); switch_file_close(file); } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_INFO, "Failed to open %s.\n", RECORD_COMPONENT(component)->local_file_path); + switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_INFO, "Failed to open %s.\n", uri); } #endif - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "Recording %s done.\n", RECORD_COMPONENT(component)->local_file_path); + switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "Recording %s done.\n", uri); if (RECORD_COMPONENT(component)->stop_beep && (session = switch_core_session_locate(uuid))) { switch_ivr_displace_session(session, RECORD_BEEP, 0, ""); @@ -110,15 +111,19 @@ static void complete_record(struct rayo_component *component, const char *reason /* send complete event to client */ recording = iks_new("recording"); iks_insert_attrib(recording, "xmlns", RAYO_RECORD_COMPLETE_NS); - iks_insert_attrib(recording, "uri", uri); + if (strlen(uri) > strlen(SWITCH_PATH_SEPARATOR) && !strncmp(uri, SWITCH_PATH_SEPARATOR, strlen(SWITCH_PATH_SEPARATOR))) { + /* convert absolute path to file:// URI */ + iks_insert_attrib_printf(recording, "uri", "file://%s", uri); + } else { + /* is already a URI (hopefully) */ + iks_insert_attrib(recording, "uri", uri); + } iks_insert_attrib_printf(recording, "duration", "%i", RECORD_COMPONENT(component)->duration_ms); iks_insert_attrib_printf(recording, "size", "%"SWITCH_SIZE_T_FMT, file_size); rayo_component_send_complete_with_metadata(component, reason, reason_namespace, recording, 1); iks_delete(recording); RAYO_UNLOCK(component); - - switch_safe_free(uri); } /** From 98a092b37d5b52be21b9c7ce6c63b1403eda40c1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 10 Sep 2013 03:03:04 +0500 Subject: [PATCH 11/49] FS-5766 --resolve --- src/switch_core_media.c | 41 ++++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index eccb0774ff..a2ddecd026 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -3238,6 +3238,8 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session int changed = 0; switch_rtp_engine_t *a_engine;//, *v_engine; switch_media_handle_t *smh; + switch_core_session_t *b_session = NULL; + switch_channel_t *b_channel = NULL; switch_assert(session); @@ -3248,23 +3250,32 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session a_engine = &smh->engines[SWITCH_MEDIA_TYPE_AUDIO]; //v_engine = &smh->engines[SWITCH_MEDIA_TYPE_VIDEO]; - if (switch_channel_test_flag(session->channel, CF_SLA_BARGE) || switch_channel_test_flag(session->channel, CF_SLA_BARGING)) { - switch_channel_mark_hold(session->channel, sendonly); - return 0; + + if (switch_core_session_get_partner(session, &b_session) == SWITCH_STATUS_SUCCESS) { + b_channel = switch_core_session_get_channel(b_session); } if (sendonly && switch_channel_test_flag(session->channel, CF_ANSWERED)) { if (!switch_channel_test_flag(session->channel, CF_PROTO_HOLD)) { const char *stream; const char *msg = "hold"; - const char *info = switch_channel_get_variable(session->channel, "presence_call_info"); + const char *info; + + if ((switch_channel_test_flag(session->channel, CF_SLA_BARGE) || switch_channel_test_flag(session->channel, CF_SLA_BARGING)) && + (!b_channel || switch_channel_test_flag(b_channel, CF_BROADCAST))) { + switch_channel_mark_hold(session->channel, sendonly); + switch_channel_set_flag(session->channel, CF_PROTO_HOLD); + changed = 0; + goto end; + } + + info = switch_channel_get_variable(session->channel, "presence_call_info"); if (info) { if (switch_stristr("private", info)) { msg = "hold-private"; } } - switch_channel_set_flag(session->channel, CF_PROTO_HOLD); switch_channel_mark_hold(session->channel, SWITCH_TRUE); @@ -3279,7 +3290,8 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session stream = "local_stream://moh"; } - if (stream && strcasecmp(stream, "silence")) { + + if (stream && strcasecmp(stream, "silence") && (!b_channel || !switch_channel_test_flag(b_channel, CF_BROADCAST))) { if (!strcasecmp(stream, "indicate_hold")) { switch_channel_set_flag(session->channel, CF_SUSPEND); switch_channel_set_flag(session->channel, CF_HOLD); @@ -3290,6 +3302,7 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session switch_yield(250000); } } + } } else { if (switch_channel_test_flag(session->channel, CF_HOLD_LOCK)) { @@ -3301,9 +3314,6 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session switch_channel_clear_flag(session->channel, CF_HOLD_LOCK); if (switch_channel_test_flag(session->channel, CF_PROTO_HOLD)) { - const char *uuid; - switch_core_session_t *b_session; - switch_yield(250000); if (a_engine->max_missed_packets) { @@ -3311,9 +3321,7 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session switch_rtp_set_max_missed_packets(a_engine->rtp_session, a_engine->max_missed_packets); } - if ((uuid = switch_channel_get_partner_uuid(session->channel)) && (b_session = switch_core_session_locate(uuid))) { - switch_channel_t *b_channel = switch_core_session_get_channel(b_session); - + if (b_channel) { if (switch_channel_test_flag(session->channel, CF_HOLD)) { switch_ivr_unhold(b_session); switch_channel_clear_flag(session->channel, CF_SUSPEND); @@ -3322,7 +3330,6 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session switch_channel_stop_broadcast(b_channel); switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_FALSE, 5000, NULL); } - switch_core_session_rwunlock(b_session); } switch_channel_clear_flag(session->channel, CF_PROTO_HOLD); @@ -3332,6 +3339,14 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session } } + + end: + + if (b_session) { + switch_core_session_rwunlock(b_session); + } + + return changed; } From 050a975d1946048915137cb14c3d9b53058283d4 Mon Sep 17 00:00:00 2001 From: Travis Cross Date: Tue, 10 Sep 2013 15:31:52 +0000 Subject: [PATCH 12/49] Add dependency from mod_rayo to mod_ssml --- debian/control-modules | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control-modules b/debian/control-modules index ec291c71b6..919382ce93 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -493,6 +493,7 @@ Description: mod_radius_cdr Module: event_handlers/mod_rayo Description: mod_rayo Adds mod_rayo. +Depends: freeswitch-mod-ssml (= ${binary:Version}) Module: event_handlers/mod_snmp Description: mod_snmp From a84610b3b045d51ee8cfbda1efbf687a4a42708e Mon Sep 17 00:00:00 2001 From: Ken Rice Date: Tue, 10 Sep 2013 12:15:37 -0500 Subject: [PATCH 13/49] update opus tarball rev --- debian/util.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/util.sh b/debian/util.sh index 9e471ee38b..7825e13d54 100755 --- a/debian/util.sh +++ b/debian/util.sh @@ -107,7 +107,7 @@ getlibs () { getlib http://files.freeswitch.org/downloads/libs/pocketsphinx-0.7.tar.gz getlib http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz getlib http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz - getlib http://files.freeswitch.org/downloads/libs/opus-0.9.0.tar.gz + getlib http://files.freeswitch.org/downloads/libs/opus-1.0.2.tar.gz getlib http://files.freeswitch.org/downloads/libs/openldap-2.4.19.tar.gz getlib http://download.zeromq.org/zeromq-2.1.9.tar.gz \ || getlib http://download.zeromq.org/historic/zeromq-2.1.9.tar.gz From 38cd508a12429951ec6120b39932d69cb949ed6c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 10 Sep 2013 23:14:30 +0500 Subject: [PATCH 14/49] FS-5772 --resolve this is sort of a hack but less painful than reporting bugs to polycom --- src/mod/endpoints/mod_sofia/mod_sofia.c | 3 +++ src/mod/endpoints/mod_sofia/sofia.c | 11 +++++++++++ src/switch_channel.c | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 8efb07193f..2bc0476da7 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -5396,10 +5396,13 @@ SWITCH_STANDARD_APP(sofia_sla_function) private_object_t *tech_pvt; switch_core_session_t *bargee_session; switch_channel_t *channel = switch_core_session_get_channel(session); + if (zstr(data)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: \n"); return; } + + switch_channel_answer(channel); if ((bargee_session = switch_core_session_locate((char *)data))) { if (bargee_session == session) { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 83080a3890..be0cfdde23 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -8782,6 +8782,17 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia } if (!zstr(bridge_uuid) && switch_channel_test_flag(b_channel, CF_LEG_HOLDING)) { + const char *b_call_id = switch_channel_get_variable(b_channel, "sip_call_id"); + + if (b_call_id) { + char *sql = switch_mprintf("update sip_dialogs set call_info_state='idle' where call_id='%q'", b_call_id); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "SQL: %s\n", sql); + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + + switch_channel_presence(b_channel, "unknown", "idle", NULL); + + } + tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, "%sanswer,intercept:%s", codec_str, bridge_uuid); } else { diff --git a/src/switch_channel.c b/src/switch_channel.c index cbae78ba44..771fd75042 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -730,7 +730,7 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel, switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); - if (!switch_channel_up_nosig(channel)) { + if (!strcasecmp(status, "idle") || !switch_channel_up_nosig(channel)) { call_info_state = "idle"; } else if (!strcasecmp(status, "hold-private")) { call_info_state = "held-private"; From ce4cfc97c4a390b5f81d3a63e44f31a9c65e98b9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Sep 2013 02:55:31 +0500 Subject: [PATCH 15/49] FS-5772 improve odds a little more but the phone is broken here --- src/include/switch_types.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 3 +-- src/switch_channel.c | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index f90f1e190e..1b28b5cd84 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1335,6 +1335,7 @@ typedef enum { CF_VIDEO_PASSIVE, CF_NOVIDEO, CF_VIDEO_ECHO, + CF_SLA_INTERCEPT, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index be0cfdde23..ca9ba7ddec 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -8790,9 +8790,8 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); switch_channel_presence(b_channel, "unknown", "idle", NULL); - } - + switch_channel_set_flag(tech_pvt->channel, CF_SLA_INTERCEPT); tech_pvt->caller_profile->destination_number = switch_core_sprintf(tech_pvt->caller_profile->pool, "%sanswer,intercept:%s", codec_str, bridge_uuid); } else { diff --git a/src/switch_channel.c b/src/switch_channel.c index 771fd75042..950fb28257 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -740,7 +740,11 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel, if (channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND) { call_info_state = "progressing"; } else { - call_info_state = "alerting"; + if (switch_channel_test_flag(channel, CF_SLA_INTERCEPT)) { + call_info_state = "idle"; + } else { + call_info_state = "alerting"; + } } } From 8def066077e0b20ab3f0118c4838d402b6578797 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Sep 2013 03:00:58 +0500 Subject: [PATCH 16/49] FS-5774 --resolve --- src/switch_rtp.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index ddebe10168..2cae2d9686 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -72,7 +72,6 @@ static switch_port_t START_PORT = RTP_START_PORT; static switch_port_t END_PORT = RTP_END_PORT; -static switch_port_t NEXT_PORT = RTP_START_PORT; static switch_mutex_t *port_lock = NULL; static void do_flush(switch_rtp_t *rtp_session, int force); @@ -1764,13 +1763,7 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_set_start_port(switch_port_t port) if (port_lock) { switch_mutex_lock(port_lock); } - if (NEXT_PORT == START_PORT) { - NEXT_PORT = port; - } START_PORT = port; - if (NEXT_PORT < START_PORT) { - NEXT_PORT = START_PORT; - } if (port_lock) { switch_mutex_unlock(port_lock); } @@ -1785,9 +1778,6 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_set_end_port(switch_port_t port) switch_mutex_lock(port_lock); } END_PORT = port; - if (NEXT_PORT > END_PORT) { - NEXT_PORT = START_PORT; - } if (port_lock) { switch_mutex_unlock(port_lock); } From 80e5a7cf0a9d9b2945a1542a12c7fb4a5897900a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 Sep 2013 22:58:00 +0500 Subject: [PATCH 17/49] FS-5778 --resolve use switch_core_event_hook_remove_receive_message() to bind to receive_message and case for new SWITCH_MESSAGE_ANSWER_EVENT, SWITCH_MESSAGE_PROGRESS_EVENT, SWITCH_MESSAGE_RING_EVENT --- src/include/switch_types.h | 3 +++ src/switch_channel.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 1b28b5cd84..143328cec4 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -955,6 +955,9 @@ typedef enum { SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE, SWITCH_MESSAGE_INDICATE_STUN_ERROR, SWITCH_MESSAGE_INDICATE_MEDIA_RENEG, + SWITCH_MESSAGE_ANSWER_EVENT, + SWITCH_MESSAGE_PROGRESS_EVENT, + SWITCH_MESSAGE_RING_EVENT, SWITCH_MESSAGE_INVALID } switch_core_session_message_types_t; diff --git a/src/switch_channel.c b/src/switch_channel.c index 950fb28257..ae94061c26 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -3144,6 +3144,16 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan return channel->state; } +static switch_status_t send_ind(switch_channel_t *channel, switch_core_session_message_types_t msg_id, const char *file, const char *func, int line) +{ + switch_core_session_message_t msg = { 0 }; + + msg.message_id = msg_id; + msg.from = channel->name; + return switch_core_session_perform_receive_message(channel->session, &msg, file, func, line); +} + + SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(switch_channel_t *channel, switch_ring_ready_t rv, const char *file, const char *func, int line) @@ -3183,6 +3193,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi switch_channel_set_callstate(channel, CCS_RINGING); + send_ind(channel, SWITCH_MESSAGE_RING_EVENT, file, func, line); + return SWITCH_STATUS_SUCCESS; } @@ -3319,6 +3331,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ switch_channel_set_callstate(channel, CCS_EARLY); + send_ind(channel, SWITCH_MESSAGE_PROGRESS_EVENT, file, func, line); + return SWITCH_STATUS_SUCCESS; } @@ -3598,6 +3612,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan switch_channel_set_callstate(channel, CCS_ACTIVE); + send_ind(channel, SWITCH_MESSAGE_ANSWER_EVENT, file, func, line); + + return SWITCH_STATUS_SUCCESS; } From 98df017ae6c7c6149cfd72201cf0d6a8f3c1c217 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Sep 2013 00:10:28 +0500 Subject: [PATCH 18/49] FS-5780 --resolve --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/nta/nta.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index ae76496397..c6dcc771df 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Thu Sep 5 20:55:45 CDT 2013 +Thu Sep 12 00:10:12 CDT 2013 diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index 68563978cd..a0b7c5ccb6 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -3838,8 +3838,10 @@ int nta_msg_ackbye(nta_agent_t *agent, msg_t *msg) return 0; err: - msg_destroy(amsg); + msg_destroy(bmsg); + msg_destroy(amsg); + return -1; } From bd41ecc3968b03b3894b7da641e25f5c9135cae0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Sep 2013 01:29:32 +0500 Subject: [PATCH 19/49] FS-5779 --resolve --- src/switch_xml.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/switch_xml.c b/src/switch_xml.c index de171a933e..abe0826613 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1639,8 +1639,10 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file(const char *file) write_fd = NULL; if ((fd = open(new_file, O_RDONLY, 0)) > -1) { if ((xml = switch_xml_parse_fd(fd))) { - xml->free_path = new_file; - new_file = NULL; + if (strcmp(file, SWITCH_GLOBAL_filenames.conf_name)) { + xml->free_path = new_file; + new_file = NULL; + } } close(fd); fd = -1; @@ -2742,10 +2744,8 @@ SWITCH_DECLARE(void) switch_xml_free(switch_xml_t xml) } if (xml->free_path) { - if (!switch_stristr("freeswitch.xml.fsxml", xml->free_path)) { - if (unlink(xml->free_path) != 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", xml->free_path); - } + if (unlink(xml->free_path) != 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", xml->free_path); } switch_safe_free(xml->free_path); } From 1d8820dc23ff70273fa9933707f08fca8b18cd2a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Sep 2013 01:35:49 +0500 Subject: [PATCH 20/49] FS-5777 --resolve --- src/mod/applications/mod_fifo/mod_fifo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index d795e8e48b..7c236ef6d2 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -4571,6 +4571,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load) switch_console_set_complete("add fifo count"); switch_console_set_complete("add fifo has_outbound"); switch_console_set_complete("add fifo importance"); + switch_console_set_complete("add fifo reparse"); switch_console_set_complete("add fifo_check_bridge ::console::list_uuid"); start_node_thread(globals.pool); From 1780e2280561abad0e5c6f719d6de3bc90495d0b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Sep 2013 09:27:06 +0500 Subject: [PATCH 21/49] FS-5779 --resolve --- src/switch_xml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_xml.c b/src/switch_xml.c index abe0826613..81ec0609b8 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1639,7 +1639,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file(const char *file) write_fd = NULL; if ((fd = open(new_file, O_RDONLY, 0)) > -1) { if ((xml = switch_xml_parse_fd(fd))) { - if (strcmp(file, SWITCH_GLOBAL_filenames.conf_name)) { + if (strcmp(abs, SWITCH_GLOBAL_filenames.conf_name)) { xml->free_path = new_file; new_file = NULL; } From bb54a4b2e3f99940e98d8b4f4b8aad08f2224c53 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Sep 2013 10:02:44 +0500 Subject: [PATCH 22/49] FS-4819 --resolve we can match the one offered just for the sake of interop since it probably won't hurt anything, if it does we can take further action --- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index db9d8c1f2a..c76fda6637 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -1089,7 +1089,9 @@ static t38_mode_t negotiate_t38(pvt_t *pvt) t38_options->T38FaxTranscodingMMR = 0; t38_options->T38FaxTranscodingJBIG = 0; t38_options->T38FaxRateManagement = "transferredTCF"; - t38_options->T38FaxMaxBuffer = 2000; + if (!t38_options->T38FaxMaxBuffer) { + t38_options->T38FaxMaxBuffer = 2000; + } t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM; if (!zstr(t38_options->T38FaxUdpEC) && (strcasecmp(t38_options->T38FaxUdpEC, "t38UDPRedundancy") == 0 || From 6b6bceb730414a726511005bfaff96a2f6d49e7e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Sep 2013 20:21:41 +0500 Subject: [PATCH 23/49] mitigate zoiper endless loop bug by not sending notify with expires: 0 when zoiper is detected --- src/mod/endpoints/mod_sofia/sofia_presence.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index c706b54028..27e9c6d669 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -3598,6 +3598,8 @@ void sofia_presence_handle_sip_i_subscribe(int status, contact_user = sip->sip_contact->m_url->url_user; } + full_agent = sip_header_as_string(nh->nh_home, (void *) sip->sip_user_agent); + //tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END()); //sip->sip_subscription_state->ss_substate @@ -3785,7 +3787,6 @@ void sofia_presence_handle_sip_i_subscribe(int status, sub_state = nua_substate_active; - full_agent = sip_header_as_string(nh->nh_home, (void *) sip->sip_user_agent); while (ap) { switch_snprintf(accept + strlen(accept), sizeof(accept) - strlen(accept), "%s%s ", ap->ac_type, ap->ac_next ? "," : ""); ap = ap->ac_next; @@ -3925,10 +3926,16 @@ void sofia_presence_handle_sip_i_subscribe(int status, if (mod_sofia_globals.debug_presence > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending NOTIFY with Expires [0] and State [%s]\n", sstr); } - nua_notify(nh, - SIPTAG_EXPIRES_STR("0"), - SIPTAG_SUBSCRIPTION_STATE_STR(sstr), - TAG_END()); + + if (zstr(full_agent) || !switch_stristr("zoiper", full_agent)) { + /* supress endless loop bug with zoiper */ + nua_notify(nh, + SIPTAG_EXPIRES_STR("0"), + SIPTAG_SUBSCRIPTION_STATE_STR(sstr), + TAG_END()); + } + + } } From 3392db98bff6f17fb69e941d71c53f42ea45c7dd Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Sep 2013 20:39:57 +0500 Subject: [PATCH 24/49] FS-5781 --resolve try now --- src/switch_core_media.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index a2ddecd026..a4ccab3805 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -5095,7 +5095,9 @@ static void generate_m(switch_core_session_t *session, char *buf, size_t buflen, if (!cng_type) { //switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d CN/8000\n", cng_type); //} else { - switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=silenceSupp:off - - - -\n"); + if (switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG)) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=silenceSupp:off - - - -\n"); + } } if (append_audio) { @@ -5478,13 +5480,15 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", smh->mparams->te, smh->mparams->te); } } - if (!switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG) && smh->mparams->cng_pt && use_cng) { + + if (switch_media_handle_test_media_flag(smh, SCMF_SUPPRESS_CNG)) { + switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=silenceSupp:off - - - -\n"); + } else if (smh->mparams->cng_pt && use_cng) { switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=rtpmap:%d CN/8000\n", smh->mparams->cng_pt); + if (!a_engine->codec_params.rm_encoding) { smh->mparams->cng_pt = 0; } - } else { - switch_snprintf(buf + strlen(buf), SDPBUFLEN - strlen(buf), "a=silenceSupp:off - - - -\n"); } if (append_audio) { From 6c384012ed5d88b0e32fd997bbf37c4d3b2f499a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Sep 2013 20:41:52 +0500 Subject: [PATCH 25/49] FS-5740 --resolve --- src/mod/say/mod_say_en/mod_say_en.c | 26 ++++++++++++++++++++++++++ src/switch_loadable_module.c | 2 ++ 2 files changed, 28 insertions(+) diff --git a/src/mod/say/mod_say_en/mod_say_en.c b/src/mod/say/mod_say_en/mod_say_en.c index 35784a6200..be200410b6 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -498,6 +498,29 @@ static switch_status_t say_ip(switch_say_file_handle_t *sh, } +static switch_status_t say_telephone_number(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) +{ + int silence = 0; + char *p; + + for (p = tosay; !zstr(p); p++) { + int a = tolower((int) *p); + if (a >= '0' && a <= '9') { + switch_say_file(sh, "digits/%c", a); + silence = 0; + } else if (a == '+' || (a >= 'a' && a <= 'z')) { + switch_say_file(sh, "ascii/%d", a); + silence = 0; + } else if (!silence) { + switch_say_file(sh, "silence_stream://100"); + silence = 1; + } + } + + return SWITCH_STATUS_SUCCESS; +} + + static switch_status_t say_spell(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) { char *p; @@ -547,6 +570,9 @@ static switch_new_say_callback_t choose_callback(switch_say_args_t *say_args) case SST_CURRENCY: say_cb = en_say_money; break; + case SST_TELEPHONE_NUMBER: + say_cb = say_telephone_number; + break; default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); break; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 9b5d7d62ec..8ffe90ea11 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -2538,6 +2538,8 @@ SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *f if ((ret = switch_vsnprintf(buf, sizeof(buf), fmt, ap)) > 0) { if (!sh->cnt++) { sh->stream.write_function(&sh->stream, "file_string://%s.%s", buf, sh->ext); + } else if (strstr(buf, "://")) { + sh->stream.write_function(&sh->stream, "!%s", buf); } else { sh->stream.write_function(&sh->stream, "!%s.%s", buf, sh->ext); } From a49c3a253abb642dc8e4f25fa2bb4c19c0b79ccd Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Thu, 12 Sep 2013 11:58:53 -0400 Subject: [PATCH 26/49] mod_ssml: added ordinal, telephone configuration --- conf/rayo/autoload_configs/ssml.conf.xml | 6 ++++-- .../formats/mod_ssml/conf/autoload_configs/ssml.conf.xml | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/conf/rayo/autoload_configs/ssml.conf.xml b/conf/rayo/autoload_configs/ssml.conf.xml index 466d9da400..a3e732f88d 100644 --- a/conf/rayo/autoload_configs/ssml.conf.xml +++ b/conf/rayo/autoload_configs/ssml.conf.xml @@ -20,8 +20,10 @@ - - + + + + diff --git a/src/mod/formats/mod_ssml/conf/autoload_configs/ssml.conf.xml b/src/mod/formats/mod_ssml/conf/autoload_configs/ssml.conf.xml index 466d9da400..a3e732f88d 100644 --- a/src/mod/formats/mod_ssml/conf/autoload_configs/ssml.conf.xml +++ b/src/mod/formats/mod_ssml/conf/autoload_configs/ssml.conf.xml @@ -20,8 +20,10 @@ - - + + + + From 8ee46a316f48c6cde5293e519306b335bcebc7a2 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Thu, 12 Sep 2013 12:13:22 -0400 Subject: [PATCH 27/49] FS-5788 --resolve used wrong variable for setting custom origination SIP headers --- src/mod/event_handlers/mod_rayo/mod_rayo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mod/event_handlers/mod_rayo/mod_rayo.c b/src/mod/event_handlers/mod_rayo/mod_rayo.c index 3004601661..c556083f22 100644 --- a/src/mod/event_handlers/mod_rayo/mod_rayo.c +++ b/src/mod/event_handlers/mod_rayo/mod_rayo.c @@ -50,7 +50,7 @@ SWITCH_MODULE_DEFINITION(mod_rayo, mod_rayo_load, mod_rayo_shutdown, NULL); #define RAYO_END_REASON_REJECT "rejected" #define RAYO_END_REASON_ERROR "error" -#define RAYO_SIP_REQUEST_HEADER "sip_r_" +#define RAYO_SIP_REQUEST_HEADER "sip_h_" #define RAYO_SIP_RESPONSE_HEADER "sip_rh_" #define RAYO_SIP_PROVISIONAL_RESPONSE_HEADER "sip_ph_" #define RAYO_SIP_BYE_RESPONSE_HEADER "sip_bye_h_" @@ -909,9 +909,9 @@ static void rayo_call_cleanup(struct rayo_actor *actor) /* add signaling headers */ { switch_event_header_t *header; - /* get all variables prefixed with sip_r_ */ + /* get all variables prefixed with sip_h_ */ for (header = event->headers; header; header = header->next) { - if (!strncmp("variable_sip_r_", header->name, 15)) { + if (!strncmp("variable_sip_h_", header->name, 15)) { add_header(end, header->name + 15, header->value); } } @@ -2857,9 +2857,9 @@ static iks *rayo_create_offer(struct rayo_call *call, switch_core_session_t *ses add_header(offer, "to", switch_channel_get_variable(channel, "sip_full_to")); add_header(offer, "via", switch_channel_get_variable(channel, "sip_full_via")); - /* get all variables prefixed with sip_r_ */ + /* get all variables prefixed with sip_h_ */ for (var = switch_channel_variable_first(channel); var; var = var->next) { - if (!strncmp("sip_r_", var->name, 6)) { + if (!strncmp("sip_h_", var->name, 6)) { add_header(offer, var->name + 6, var->value); } } From d9216daedb07032689b461b417f4f63ddcded980 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 12 Sep 2013 21:47:54 +0500 Subject: [PATCH 28/49] Fix regression from ignoring breaks in video rtp sessions and add a flag to force a break when needed --- src/include/switch_types.h | 1 + src/switch_ivr_bridge.c | 8 ++++++-- src/switch_rtp.c | 19 ++++++++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 143328cec4..9c86e56ae9 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1339,6 +1339,7 @@ typedef enum { CF_NOVIDEO, CF_VIDEO_ECHO, CF_SLA_INTERCEPT, + CF_VIDEO_BREAK, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ /* IF YOU ADD NEW ONES CHECK IF THEY SHOULD PERSIST OR ZERO THEM IN switch_core_session.c switch_core_session_request_xml() */ CF_FLAG_MAX diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index e0d005aec9..0927fe95b5 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -626,9 +626,13 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) if (vh.up == 1) { vh.up = -1; - switch_core_session_kill_channel(session_a, SWITCH_SIG_BREAK); - switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK); } + + switch_channel_set_flag(chan_a, CF_VIDEO_BREAK); + switch_channel_set_flag(chan_b, CF_VIDEO_BREAK); + switch_core_session_kill_channel(session_a, SWITCH_SIG_BREAK); + switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "Ending video thread.\n"); switch_thread_join(&st, vid_thread); switch_channel_clear_flag(chan_a, CF_NOT_READY); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 2cae2d9686..a5b091fe17 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3344,7 +3344,17 @@ SWITCH_DECLARE(void) switch_rtp_break(switch_rtp_t *rtp_session) } if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO]) { - return; + int ret = 1; + + if (rtp_session->session) { + switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session); + if (switch_channel_test_flag(channel, CF_VIDEO_BREAK)) { + switch_channel_clear_flag(channel, CF_VIDEO_BREAK); + ret = 0; + } + } + + if (ret) return; } switch_mutex_lock(rtp_session->flag_mutex); @@ -4612,6 +4622,13 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (rtp_session->dtmf_data.out_digit_dur > 0) { return_cng_frame(); } + + if (rtp_session->flags[SWITCH_RTP_FLAG_VIDEO] && rtp_session->flags[SWITCH_RTP_FLAG_BREAK]) { + switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_BREAK); + bytes = 0; + return_cng_frame(); + } + } if (poll_status == SWITCH_STATUS_SUCCESS) { From 743b094416a671bf81bd36266f9d0d4b7d3a5bfd Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Thu, 12 Sep 2013 16:10:54 -0400 Subject: [PATCH 29/49] FS-5767 --resolve allow odbc variable to be used for postgresql even if odbc is not present --- src/mod/applications/mod_directory/mod_directory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_directory/mod_directory.c b/src/mod/applications/mod_directory/mod_directory.c index 6e0f7b2ef8..50c4701364 100644 --- a/src/mod/applications/mod_directory/mod_directory.c +++ b/src/mod/applications/mod_directory/mod_directory.c @@ -463,7 +463,7 @@ static switch_status_t load_config(switch_bool_t reload) char *val = (char *) switch_xml_attr_soft(param, "value"); if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) { - if (switch_odbc_available()) { + if (switch_odbc_available() || switch_pgsql_available()) { switch_set_string(globals.odbc_dsn, val); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n"); From 5197c726be85f0ef28cbcddadf8dfbabff96d503 Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 12 Sep 2013 15:22:57 -0500 Subject: [PATCH 30/49] add via_protocol to request so you can be informed if you wish to force expires due to tcp keepalives being on. --- src/mod/endpoints/mod_sofia/sofia_reg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index d0f7dec837..1514d4be4f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -2614,6 +2614,11 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, } } + if (sip->sip_via) { + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_via_protocol", sofia_glue_transport2str(sofia_glue_via2transport(sip->sip_via))); + } + + if (sip->sip_from) { switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_from_user", sip->sip_from->a_url->url_user); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_from_host", sip->sip_from->a_url->url_host); From 378648f2b1b69ab4c8fdf801bbc5f947eed052e6 Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 12 Sep 2013 16:56:07 -0500 Subject: [PATCH 31/49] similar fix to 53d17a13121cb85d5bf3c260a4d365fefc7ae179 --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index c6dcc771df..b56ec5433d 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Thu Sep 12 00:10:12 CDT 2013 +Thu Sep 12 16:55:32 CDT 2013 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c index 1e9d9eb14f..7196955e27 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c @@ -188,6 +188,8 @@ int tport_tcp_init_secondary(tport_t *self, int socket, int accepted, self->tp_has_connection = 1; + self->tp_params->tpp_idle = UINT_MAX; + if (setsockopt(socket, SOL_TCP, TCP_NODELAY, (void *)&val, sizeof val) == -1) return *return_reason = "TCP_NODELAY", -1; From fb238ed99779b28eeb1cc839b033ea2cf9d03212 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Fri, 13 Sep 2013 23:44:10 +0800 Subject: [PATCH 32/49] Tweaks --- libs/spandsp/src/dtmf.c | 53 ++++++++++++++---------------- libs/spandsp/src/t85_decode.c | 33 ++++++++++++++++++- libs/spandsp/tests/dtmf_rx_tests.c | 4 +-- 3 files changed, 58 insertions(+), 32 deletions(-) diff --git a/libs/spandsp/src/dtmf.c b/libs/spandsp/src/dtmf.c index 9f6401028c..39c475a554 100644 --- a/libs/spandsp/src/dtmf.c +++ b/libs/spandsp/src/dtmf.c @@ -71,21 +71,24 @@ #define DTMF_SAMPLES_PER_BLOCK 102 #if defined(SPANDSP_USE_FIXED_POINT) -#define DTMF_THRESHOLD 10438 /* -42dBm0 */ -#define DTMF_NORMAL_TWIST 6.309f /* 8dB */ -#define DTMF_REVERSE_TWIST 2.512f /* 4dB */ -#define DTMF_RELATIVE_PEAK_ROW 6.309f /* 8dB */ -#define DTMF_RELATIVE_PEAK_COL 6.309f /* 8dB */ -#define DTMF_TO_TOTAL_ENERGY 83.868f /* -0.85dB */ -#define DTMF_POWER_OFFSET 68.251f /* 10*log(256.0*256.0*DTMF_SAMPLES_PER_BLOCK) */ -#else -#define DTMF_THRESHOLD 171032462.0f /* -42dBm0 [((DTMF_SAMPLES_PER_BLOCK*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2] */ -#define DTMF_NORMAL_TWIST 6.309f /* 8dB [10^(8/10) => 6.309] */ -#define DTMF_REVERSE_TWIST 2.512f /* 4dB */ -#define DTMF_RELATIVE_PEAK_ROW 6.309f /* 8dB */ -#define DTMF_RELATIVE_PEAK_COL 6.309f /* 8dB */ +/* The fixed point version scales the 16 bit signal down by 7 bits, so the Goertzels will fit in a 32 bit word */ +#define FP_SCALE(x) ((int16_t) (x/128.0 + ((x >= 0.0) ? 0.5 : -0.5))) +#define DTMF_THRESHOLD 10438 /* -42dBm0 [((DTMF_SAMPLES_PER_BLOCK*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0)/128.0)^2]*/ +#define DTMF_NORMAL_TWIST 6.309f /* 8dB [10.0^(8.0/10.0)] */ +#define DTMF_REVERSE_TWIST 2.512f /* 4dB [10.0^(4.0/10.0)] */ +#define DTMF_RELATIVE_PEAK_ROW 6.309f /* 8dB [10.0^(8.0/10.0)] */ +#define DTMF_RELATIVE_PEAK_COL 6.309f /* 8dB [10.0^(8.0/10.0)] */ #define DTMF_TO_TOTAL_ENERGY 83.868f /* -0.85dB [DTMF_SAMPLES_PER_BLOCK*10^(-0.85/10.0)] */ -#define DTMF_POWER_OFFSET 110.395f /* 10*log(32768.0*32768.0*DTMF_SAMPLES_PER_BLOCK) */ +#define DTMF_POWER_OFFSET 68.251f /* 10*log(((32768.0/128.0)^2)*DTMF_SAMPLES_PER_BLOCK) */ +#else +#define FP_SCALE(x) (x) +#define DTMF_THRESHOLD 171032462.0f /* -42dBm0 [((DTMF_SAMPLES_PER_BLOCK*32768.0/1.4142)*10^((-42 - DBM0_MAX_SINE_POWER)/20.0))^2] */ +#define DTMF_NORMAL_TWIST 6.309f /* 8dB [10.0^(8.0/10.0)] */ +#define DTMF_REVERSE_TWIST 2.512f /* 4dB [10.0^(4.0/10.0)] */ +#define DTMF_RELATIVE_PEAK_ROW 6.309f /* 8dB [10.0^(8.0/10.0)] */ +#define DTMF_RELATIVE_PEAK_COL 6.309f /* 8dB [10.0^(8.0/10.0)] */ +#define DTMF_TO_TOTAL_ENERGY 83.868f /* -0.85dB [DTMF_SAMPLES_PER_BLOCK*10^(-0.85/10.0)] */ +#define DTMF_POWER_OFFSET 110.395f /* 10*log((32768.0^2)*DTMF_SAMPLES_PER_BLOCK) */ #endif static const float dtmf_row[] = @@ -303,11 +306,7 @@ SPAN_DECLARE(int) dtmf_rx(dtmf_rx_state_t *s, const int16_t amp[], int samples) s->in_digit = hit; } s->last_hit = hit; -#if defined(SPANDSP_USE_FIXED_POINT) - s->energy = 0; -#else - s->energy = 0.0f; -#endif + s->energy = FP_SCALE(0.0f); s->current_sample = 0; } if (s->current_digits && s->digits_callback) @@ -330,11 +329,7 @@ SPAN_DECLARE(int) dtmf_rx_fillin(dtmf_rx_state_t *s, int samples) goertzel_reset(&s->row_out[i]); goertzel_reset(&s->col_out[i]); } -#if defined(SPANDSP_USE_FIXED_POINT) - s->energy = 0; -#else - s->energy = 0.0f; -#endif + s->energy = FP_SCALE(0.0f); s->current_sample = 0; /* Don't update the hit detection. Pretend it never happened. */ /* TODO: Surely we can be cleverer than this. */ @@ -399,7 +394,11 @@ SPAN_DECLARE(void) dtmf_rx_parms(dtmf_rx_state_t *s, s->reverse_twist = powf(10.0f, reverse_twist/10.0f); if (threshold > -99) { +#if defined(SPANDSP_USE_FIXED_POINT) + x = (DTMF_SAMPLES_PER_BLOCK*32768.0f/(128.0f*1.4142f))*powf(10.0f, (threshold - DBM0_MAX_SINE_POWER)/20.0f); +#else x = (DTMF_SAMPLES_PER_BLOCK*32768.0f/1.4142f)*powf(10.0f, (threshold - DBM0_MAX_SINE_POWER)/20.0f); +#endif s->threshold = x*x; } } @@ -451,11 +450,7 @@ SPAN_DECLARE(dtmf_rx_state_t *) dtmf_rx_init(dtmf_rx_state_t *s, goertzel_init(&s->row_out[i], &dtmf_detect_row[i]); goertzel_init(&s->col_out[i], &dtmf_detect_col[i]); } -#if defined(SPANDSP_USE_FIXED_POINT) - s->energy = 0; -#else - s->energy = 0.0f; -#endif + s->energy = FP_SCALE(0.0f); s->current_sample = 0; s->lost_digits = 0; s->current_digits = 0; diff --git a/libs/spandsp/src/t85_decode.c b/libs/spandsp/src/t85_decode.c index dda2a4053d..a687961c02 100644 --- a/libs/spandsp/src/t85_decode.c +++ b/libs/spandsp/src/t85_decode.c @@ -267,14 +267,45 @@ static int finish_sde(t85_decode_state_t *s) SPAN_DECLARE(bool) t85_analyse_header(uint32_t *width, uint32_t *length, const uint8_t data[], size_t len) { + uint32_t i; + uint32_t skip; + if (len < 20) + { + *width = 0; + *length = 0; return false; + } *width = pack_32(&data[6]); *length = pack_32(&data[10]); if ((data[19] & T85_VLENGTH)) { - /* TODO: scan for a true length, if the initial one just says 0xFFFFFFFF */ /* There should be an image length sequence terminating the image later on. */ + /* TODO: scan for a true length, instead of this fudge */ + for (i = 20; i < len - 6; i++) + { + if (data[i] == T82_ESC) + { + if (data[i + 1] == T82_COMMENT) + { + skip = pack_32(&data[2]); + if ((skip + 6) > (len - i)) + break; + i += (6 + skip - 1); + } + else if (data[i + 1] == T82_ATMOVE) + { + i += (8 - 1); + } + else if (data[i + 1] == T82_NEWLEN) + { + /* We are only allow to have one of these, so if we find one + we should not look any further. */ + *length = pack_32(&data[i + 2]); + break; + } + } + } } return true; } diff --git a/libs/spandsp/tests/dtmf_rx_tests.c b/libs/spandsp/tests/dtmf_rx_tests.c index ef44e0d5b6..18267645f2 100644 --- a/libs/spandsp/tests/dtmf_rx_tests.c +++ b/libs/spandsp/tests/dtmf_rx_tests.c @@ -675,11 +675,11 @@ static void mitel_cm7291_side_2_and_bellcore_tests(void) { if (hit_types[i]) { - printf(" Digit %c had %d false hits\n", i, hit_types[i]); + printf(" Digit %c had %d false hits.\n", i, hit_types[i]); j += hit_types[i]; } } - printf(" %d hits in total\n", j); + printf(" %d false hits in total.\n", j); if (j > 470) { printf(" Failed\n"); From ea0653689f430b642ed857135557da260e3a8ad9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 14 Sep 2013 10:07:25 -0500 Subject: [PATCH 33/49] FS-5791 --resolve --- src/switch_ivr_async.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 080c7fe538..687ba9a8e6 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2189,7 +2189,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t if ((status = switch_core_media_bug_add(session, "session_record", file, record_callback, rh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error adding media bug for file %s\n", file); - switch_core_file_close(fh); + if (rh->native) { + switch_core_file_close(&rh->in_fh); + switch_core_file_close(&rh->out_fh); + } else + switch_core_file_close(fh); + } return status; } From 60f5dec57e05719d963c00e92dd47172c6fa7dcb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 14 Sep 2013 13:06:06 -0500 Subject: [PATCH 34/49] FS-5793 --resolve --- src/switch_ivr_async.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 687ba9a8e6..159bdb5f6e 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2192,7 +2192,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t if (rh->native) { switch_core_file_close(&rh->in_fh); switch_core_file_close(&rh->out_fh); - } else + } else { switch_core_file_close(fh); } return status; From 3329141e74a56d8efdfe9fd2fe0e5385a0c3c196 Mon Sep 17 00:00:00 2001 From: William King Date: Sun, 15 Sep 2013 15:57:17 -0700 Subject: [PATCH 35/49] Don't risk the double free, use switch_safe_free here same as in ~15 lines. --- src/mod/applications/mod_httapi/mod_httapi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index e5bfac12ae..6ae3001804 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -2343,7 +2343,7 @@ static char *load_cache_data(http_file_context_t *context, const char *url) if ((p = strchr(dext, '?'))) { *p = '\0'; ext = dext; - } else free(dext); + } else switch_safe_free(dext); } context->cache_file_base = switch_core_sprintf(context->pool, "%s%s%s", globals.cache_path, SWITCH_PATH_SEPARATOR, digest); From aa222c7aea4670df8aa2f9239f6dc5c680958164 Mon Sep 17 00:00:00 2001 From: William King Date: Sun, 15 Sep 2013 16:05:11 -0700 Subject: [PATCH 36/49] While sofia does garbage collection, in other locations we still call su_free after calls to sip_header_as_string. So adding it here too since we've finished using the full_contact variable. --- src/mod/endpoints/mod_sofia/sofia.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index ca9ba7ddec..fcd9c5870f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -9034,6 +9034,10 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia switch_assert(sql); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + + if ( full_contact ) { + su_free(nua_handle_home(tech_pvt->nh), full_contact); + } } if (is_nat) { From b91d6e430af611f0d4fd0067b64786d2c1041390 Mon Sep 17 00:00:00 2001 From: William King Date: Sun, 15 Sep 2013 16:19:19 -0700 Subject: [PATCH 37/49] How did the use after free not blowup in the last 3 years since it was modified? --- src/mod/applications/mod_fifo/mod_fifo.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 7c236ef6d2..1affefa3e4 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -1637,7 +1637,6 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj) fifo_execute_sql_queued(&sql, SWITCH_TRUE, SWITCH_TRUE); status = switch_ivr_originate(NULL, &session, &cause, originate_string, h->timeout, NULL, NULL, NULL, NULL, ovars, SOF_NONE, NULL); - free(originate_string); if (status != SWITCH_STATUS_SUCCESS) { @@ -1694,6 +1693,10 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj) end: + if ( originate_string ){ + switch_safe_free(originate_string); + } + switch_event_destroy(&ovars); if (node) { switch_mutex_lock(node->update_mutex); From fb318e3be9c26f0332b6ea9a7c1be9b63d7a1d39 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sun, 15 Sep 2013 18:48:10 -0600 Subject: [PATCH 38/49] FS-5784 try this with visual studio express 2010 --- Freeswitch.2010.express.sln | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Freeswitch.2010.express.sln b/Freeswitch.2010.express.sln index e554a13076..419e84e6c7 100644 --- a/Freeswitch.2010.express.sln +++ b/Freeswitch.2010.express.sln @@ -346,6 +346,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_math_fixed_tables", "l EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_cielab_luts", "libs\spandsp\src\msvc\make_cielab_luts.2010.vcxproj", "{85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_t43_gray_code_tables", "libs\spandsp\src\msvc\make_t43_gray_code_tables.2010.vcxproj", "{EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2086,6 +2088,15 @@ Global {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|Win32.Build.0 = All|Win32 {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.ActiveCfg = All|Win32 {85F0CF8C-C7AB-48F6-BA19-CC94CF87F981}.Release|x64.Build.0 = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.All|Win32.ActiveCfg = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.All|Win32.Build.0 = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.All|x64.ActiveCfg = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Debug|Win32.ActiveCfg = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Debug|Win32.Build.0 = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Debug|x64.ActiveCfg = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Release|Win32.ActiveCfg = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Release|Win32.Build.0 = All|Win32 + {EDDB8AB9-C53E-44C0-A620-0E86C2CBD5D5}.Release|x64.ActiveCfg = All|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From 27d2761ac02d69bbc0afab8473e2e4342c3f7d7d Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Sun, 15 Sep 2013 23:22:12 -0400 Subject: [PATCH 39/49] mod_rayo: fix reloadxml issue --- src/mod/event_handlers/mod_rayo/mod_rayo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_rayo/mod_rayo.c b/src/mod/event_handlers/mod_rayo/mod_rayo.c index c556083f22..e232ac8d38 100644 --- a/src/mod/event_handlers/mod_rayo/mod_rayo.c +++ b/src/mod/event_handlers/mod_rayo/mod_rayo.c @@ -3309,7 +3309,7 @@ static switch_status_t do_config(switch_memory_pool_t *pool, const char *config_ const char *alias_name = switch_xml_attr_soft(alias, "name"); const char *alias_target = switch_xml_attr_soft(alias, "target"); if (!zstr(alias_name) && !zstr(alias->txt)) { - rayo_add_cmd_alias(alias_name, alias_target, alias->txt); + rayo_add_cmd_alias(alias_name, switch_core_strdup(pool, alias_target), switch_core_strdup(pool, alias->txt)); } } } From 11fc9175cc6f5e34a5066f92f8dc43c129822455 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 16 Sep 2013 09:41:32 -0500 Subject: [PATCH 40/49] FS-5770 --resolve revert accidental commit --- libs/spandsp/src/gsm0610_rpe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/spandsp/src/gsm0610_rpe.c b/libs/spandsp/src/gsm0610_rpe.c index 387ef1493b..68ddff3e1e 100644 --- a/libs/spandsp/src/gsm0610_rpe.c +++ b/libs/spandsp/src/gsm0610_rpe.c @@ -59,7 +59,7 @@ static void weighting_filter(int16_t x[40], const int16_t *e) // signal [-5..0.39.44] IN) { -#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__) +#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__) && !(defined(__APPLE_CC__) && __APPLE_CC__ >= 5448) /* Table 4.4 Coefficients of the weighting filter */ /* This must be padded to a multiple of 4 for MMX to work */ static const union From f613105a251d189d923c58de577d836d5762f15f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Sep 2013 22:23:49 +0500 Subject: [PATCH 41/49] FS-4865 --resolve --- src/switch_core_media.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/switch_core_media.c b/src/switch_core_media.c index a4ccab3805..d8553d0766 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -4138,6 +4138,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "AUDIO RTP CHANGING DEST TO: [%s:%d]\n", a_engine->codec_params.remote_sdp_ip, a_engine->codec_params.remote_sdp_port); + + if (switch_channel_test_flag(session->channel, CF_PROTO_HOLD) && strcmp(a_engine->codec_params.remote_sdp_ip, "0.0.0.0")) { + switch_core_media_toggle_hold(session, 0); + } + + if (!switch_media_handle_test_media_flag(smh, SCMF_DISABLE_RTP_AUTOADJ) && !((val = switch_channel_get_variable(session->channel, "disable_rtp_auto_adjust")) && switch_true(val)) && !switch_channel_test_flag(session->channel, CF_WEBRTC)) { From 5f29412021ad9e58092cc50cc9ac8663034eefe6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Sep 2013 22:28:20 +0500 Subject: [PATCH 42/49] FS-5761 --resolve this solution is sufficient --- src/mod/applications/mod_spandsp/mod_spandsp_modem.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c index dec93970a0..3a84a451de 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_modem.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_modem.c @@ -47,7 +47,6 @@ #define DEFAULT_FEC_SPAN 3 static struct { - int NEXT_ID; int REF_COUNT; int THREADCOUNT; switch_memory_pool_t *pool; @@ -223,8 +222,6 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl #endif logging_state_t *logging; - memset(modem, 0, sizeof(*modem)); - modem->master = -1; modem->slave = -1; @@ -298,8 +295,6 @@ switch_status_t modem_init(modem_t *modem, modem_control_handler_t control_handl #endif #ifndef WIN32 - modem->slot = globals.NEXT_ID++; - snprintf(modem->devlink, sizeof(modem->devlink), "%s/FS%d", spandsp_globals.modem_directory, modem->slot); unlink(modem->devlink); @@ -1351,11 +1346,12 @@ static void activate_modems(void) int x; switch_mutex_lock(globals.mutex); - memset(globals.MODEM_POOL, 0, MAX_MODEMS); + memset(globals.MODEM_POOL, 0, sizeof(globals.MODEM_POOL)); for (x = 0; x < max; x++) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Starting Modem SLOT %d\n", x); + globals.MODEM_POOL[x].slot = x; launch_modem_thread(&globals.MODEM_POOL[x]); } switch_mutex_unlock(globals.mutex); From d7bce3256d1cef3c79fbf7088fc354f7fe69e690 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Sep 2013 22:59:26 +0500 Subject: [PATCH 43/49] update cc banner --- cluecon.tmpl | 52 +++++++++++++++++++++++++-------------------------- cluecon2.tmpl | 52 +++++++++++++++++++++++++-------------------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/cluecon.tmpl b/cluecon.tmpl index 39cc3d1d65..f6624beb24 100644 --- a/cluecon.tmpl +++ b/cluecon.tmpl @@ -1,26 +1,26 @@ -.========================================================================================================. -| ____ _____ ____ _ ____ _ _ _____ | -| / ___|___ _ __ ___ ___ |_ _|__ / ___| |_ _ ___ / ___|___ _ __ ( ) |___ / | -| | | / _ \| '_ ` _ \ / _ \ | |/ _ \ | | | | | | |/ _ \ | / _ \| '_ \ |/| | |_ \ | -| | |__| (_) | | | | | | __/ | | (_) | | |___| | |_| | __/ |__| (_) | | | | | |___) | | -| \____\___/|_| |_| |_|\___| |_|\___/ \____|_|\__,_|\___|\____\___/|_| |_| |_|____/ | -| | -| ____ _ _ _ _ ____ _ | -| / ___| |__ (_) ___ __ _ __ _ ___ | | | / ___| / \ | -| | | | '_ \| |/ __/ _` |/ _` |/ _ \ | | | \___ \ / _ \ | -| | |___| | | | | (_| (_| | (_| | (_) | | |_| |___) / ___ \ | -| \____|_| |_|_|\___\__,_|\__, |\___( ) \___/|____/_/ \_\ | -| |___/ |/ | -| _ _ __ _ _ ___ _ _ ____ ___ _ _____ | -| / \ _ _ __ _ _ _ ___| |_ / /_ | |_| |__ ( _ )| |_| |__ |___ \ / _ \/ |___ / | -| / _ \| | | |/ _` | | | / __| __| | '_ \| __| '_ \ _____ / _ \| __| '_ \ __) | | | | | |_ \ | -| / ___ \ |_| | (_| | |_| \__ \ |_ | (_) | |_| | | | |_____| | (_) | |_| | | | / __/| |_| | |___) | | -| /_/ \_\__,_|\__, |\__,_|___/\__| \___/ \__|_| |_| \___/ \__|_| |_| |_____|\___/|_|____/ | -| |___/ | -| _ | -| __ ____ ____ __ ___| |_ _ ___ ___ ___ _ __ ___ ___ _ __ ___ | -| \ \ /\ / /\ \ /\ / /\ \ /\ / / / __| | | | |/ _ \/ __/ _ \| '_ \ / __/ _ \| '_ ` _ \ | -| \ V V / \ V V / \ V V / _ | (__| | |_| | __/ (_| (_) | | | | _ | (_| (_) | | | | | | | -| \_/\_/ \_/\_/ \_/\_/ (_) \___|_|\__,_|\___|\___\___/|_| |_| (_) \___\___/|_| |_| |_| | -| | -.========================================================================================================. +.=======================================================================================================. +| ____ _ ____ | +| / ___| |_ _ ___ / ___|___ _ __ | +| | | | | | | |/ _ \ | / _ \| '_ \ | +| | |___| | |_| | __/ |__| (_) | | | | | +| \____|_|\__,_|\___|\____\___/|_| |_| | +| | +| _____ _ _ ____ __ | +| |_ _|__| | ___ _ __ | |__ ___ _ __ _ _ / ___|___ _ __ / _| ___ _ __ ___ _ __ ___ ___ | +| | |/ _ \ |/ _ \ '_ \| '_ \ / _ \| '_ \| | | | | | / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \ | +| | | __/ | __/ |_) | | | | (_) | | | | |_| | | |__| (_) | | | | _| __/ | | __/ | | | (_| __/ | +| |_|\___|_|\___| .__/|_| |_|\___/|_| |_|\__, | \____\___/|_| |_|_| \___|_| \___|_| |_|\___\___| | +| |_| |___/ | +| _____ _ _ | +| | ____|_ _____ _ __ _ _ / \ _ _ __ _ _ _ ___| |_ | +| | _| \ \ / / _ \ '__| | | | / _ \| | | |/ _` | | | / __| __| | +| | |___ \ V / __/ | | |_| | / ___ \ |_| | (_| | |_| \__ \ |_ | +| |_____| \_/ \___|_| \__, | /_/ \_\__,_|\__, |\__,_|___/\__| | +| |___/ |___/ | +| ____ _ ____ | +| __ ____ ____ __ / ___| |_ _ ___ / ___|___ _ __ ___ ___ _ __ ___ | +| \ \ /\ / /\ \ /\ / /\ \ /\ / / | | | | | | |/ _ \ | / _ \| '_ \ / __/ _ \| '_ ` _ \ | +| \ V V / \ V V / \ V V / _ | |___| | |_| | __/ |__| (_) | | | | _ | (_| (_) | | | | | | | +| \_/\_/ \_/\_/ \_/\_/ (_) \____|_|\__,_|\___|\____\___/|_| |_| (_) \___\___/|_| |_| |_| | +| | +.=======================================================================================================. diff --git a/cluecon2.tmpl b/cluecon2.tmpl index f96668977c..e0f2309ca3 100644 --- a/cluecon2.tmpl +++ b/cluecon2.tmpl @@ -1,29 +1,29 @@  -.========================================================================================================. -| ____ _____ ____ _ ____ _ _ _____ | -| / ___|___ _ __ ___ ___ |_ _|__ / ___| |_ _ ___ / ___|___ _ __ ( ) |___ / | -| | | / _ \| '_ ` _ \ / _ \ | |/ _ \ | | | | | | |/ _ \ | / _ \| '_ \ |/| | |_ \ | -| | |__| (_) | | | | | | __/ | | (_) | | |___| | |_| | __/ |__| (_) | | | | | |___) | | -| \____\___/|_| |_| |_|\___| |_|\___/ \____|_|\__,_|\___|\____\___/|_| |_| |_|____/ | -| | -| ____ _ _ _ _ ____ _ | -| / ___| |__ (_) ___ __ _ __ _ ___ | | | / ___| / \ | -| | | | '_ \| |/ __/ _` |/ _` |/ _ \ | | | \___ \ / _ \ | -| | |___| | | | | (_| (_| | (_| | (_) | | |_| |___) / ___ \ | -| \____|_| |_|_|\___\__,_|\__, |\___( ) \___/|____/_/ \_\ | -| |___/ |/ | -| _ _ __ _ _ ___ _ _ ____ ___ _ _____ | -| / \ _ _ __ _ _ _ ___| |_ / /_ | |_| |__ ( _ )| |_| |__ |___ \ / _ \/ |___ / | -| / _ \| | | |/ _` | | | / __| __| | '_ \| __| '_ \ _____ / _ \| __| '_ \ __) | | | | | |_ \ | -| / ___ \ |_| | (_| | |_| \__ \ |_ | (_) | |_| | | | |_____| | (_) | |_| | | | / __/| |_| | |___) | | -| /_/ \_\__,_|\__, |\__,_|___/\__| \___/ \__|_| |_| \___/ \__|_| |_| |_____|\___/|_|____/ | -| |___/ | -| _ | -| __ ____ ____ __ ___| |_ _ ___ ___ ___ _ __ ___ ___ _ __ ___ | -| \ \ /\ / /\ \ /\ / /\ \ /\ / / / __| | | | |/ _ \/ __/ _ \| '_ \ / __/ _ \| '_ ` _ \ | -| \ V V / \ V V / \ V V / _ | (__| | |_| | __/ (_| (_) | | | | _ | (_| (_) | | | | | | | -| \_/\_/ \_/\_/ \_/\_/ (_) \___|_|\__,_|\___|\___\___/|_| |_| (_) \___\___/|_| |_| |_| | -| | -.========================================================================================================. +.=======================================================================================================. +| ____ _ ____ | +| / ___| |_ _ ___ / ___|___ _ __ | +| | | | | | | |/ _ \ | / _ \| '_ \ | +| | |___| | |_| | __/ |__| (_) | | | | | +| \____|_|\__,_|\___|\____\___/|_| |_| | +| | +| _____ _ _ ____ __ | +| |_ _|__| | ___ _ __ | |__ ___ _ __ _ _ / ___|___ _ __ / _| ___ _ __ ___ _ __ ___ ___ | +| | |/ _ \ |/ _ \ '_ \| '_ \ / _ \| '_ \| | | | | | / _ \| '_ \| |_ / _ \ '__/ _ \ '_ \ / __/ _ \ | +| | | __/ | __/ |_) | | | | (_) | | | | |_| | | |__| (_) | | | | _| __/ | | __/ | | | (_| __/ | +| |_|\___|_|\___| .__/|_| |_|\___/|_| |_|\__, | \____\___/|_| |_|_| \___|_| \___|_| |_|\___\___| | +| |_| |___/ | +| _____ _ _ | +| | ____|_ _____ _ __ _ _ / \ _ _ __ _ _ _ ___| |_ | +| | _| \ \ / / _ \ '__| | | | / _ \| | | |/ _` | | | / __| __| | +| | |___ \ V / __/ | | |_| | / ___ \ |_| | (_| | |_| \__ \ |_ | +| |_____| \_/ \___|_| \__, | /_/ \_\__,_|\__, |\__,_|___/\__| | +| |___/ |___/ | +| ____ _ ____ | +| __ ____ ____ __ / ___| |_ _ ___ / ___|___ _ __ ___ ___ _ __ ___ | +| \ \ /\ / /\ \ /\ / /\ \ /\ / / | | | | | | |/ _ \ | / _ \| '_ \ / __/ _ \| '_ ` _ \ | +| \ V V / \ V V / \ V V / _ | |___| | |_| | __/ |__| (_) | | | | _ | (_| (_) | | | | | | | +| \_/\_/ \_/\_/ \_/\_/ (_) \____|_|\__,_|\___|\____\___/|_| |_| (_) \___\___/|_| |_| |_| | +| | +.=======================================================================================================.  From 4b8ad5b54930ecfd8d4f4fc0d213f85b7174f9f8 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Mon, 16 Sep 2013 20:13:26 -0400 Subject: [PATCH 44/49] mod_rayo: fixed prompt state machine - wrong state transition when output finishes before input starts --- src/mod/event_handlers/mod_rayo/rayo_prompt_component.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_rayo/rayo_prompt_component.c b/src/mod/event_handlers/mod_rayo/rayo_prompt_component.c index f48e7d02d2..7bb530fe3f 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_prompt_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_prompt_component.c @@ -454,7 +454,8 @@ static iks *prompt_component_handle_output_complete(struct rayo_actor *prompt, s iks_delete(PROMPT_COMPONENT(prompt)->iq); break; case PCS_START_INPUT_OUTPUT: - PROMPT_COMPONENT(prompt)->state = PCS_INPUT; + /* output finished before input started */ + PROMPT_COMPONENT(prompt)->state = PCS_START_INPUT_TIMERS; break; case PCS_INPUT_OUTPUT: PROMPT_COMPONENT(prompt)->state = PCS_INPUT; From 50ea67b340e027351287f470276deb69bc781242 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 17 Sep 2013 06:24:41 +0500 Subject: [PATCH 45/49] fix connection issue in websocket --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/tport/ws.c | 64 +++++++++++++---------- libs/sofia-sip/libsofia-sip-ua/tport/ws.h | 38 +++++++++----- 3 files changed, 60 insertions(+), 44 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index b56ec5433d..76ab95f85f 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Thu Sep 12 16:55:32 CDT 2013 +Tue Sep 17 06:24:17 CDT 2013 diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c index 35fb4c0f22..6039aea826 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.c @@ -6,7 +6,7 @@ #endif #define SHA1_HASH_SIZE 20 -struct globals_s globals; +struct ws_globals_s ws_globals; #ifndef WSS_STANDALONE @@ -83,20 +83,20 @@ void init_ssl(void) { OpenSSL_add_all_algorithms(); /* load & register cryptos */ SSL_load_error_strings(); /* load all error messages */ - globals.ssl_method = TLSv1_server_method(); /* create server instance */ - globals.ssl_ctx = SSL_CTX_new(globals.ssl_method); /* create context */ - assert(globals.ssl_ctx); + ws_globals.ssl_method = TLSv1_server_method(); /* create server instance */ + ws_globals.ssl_ctx = SSL_CTX_new(ws_globals.ssl_method); /* create context */ + assert(ws_globals.ssl_ctx); /* set the local certificate from CertFile */ - SSL_CTX_use_certificate_file(globals.ssl_ctx, globals.cert, SSL_FILETYPE_PEM); + SSL_CTX_use_certificate_file(ws_globals.ssl_ctx, ws_globals.cert, SSL_FILETYPE_PEM); /* set the private key from KeyFile */ - SSL_CTX_use_PrivateKey_file(globals.ssl_ctx, globals.key, SSL_FILETYPE_PEM); + SSL_CTX_use_PrivateKey_file(ws_globals.ssl_ctx, ws_globals.key, SSL_FILETYPE_PEM); /* verify private key */ - if ( !SSL_CTX_check_private_key(globals.ssl_ctx) ) { + if ( !SSL_CTX_check_private_key(ws_globals.ssl_ctx) ) { abort(); } - SSL_CTX_set_cipher_list(globals.ssl_ctx, "HIGH:!DSS:!aNULL@STRENGTH"); + SSL_CTX_set_cipher_list(ws_globals.ssl_ctx, "HIGH:!DSS:!aNULL@STRENGTH"); thread_setup(); } @@ -228,7 +228,7 @@ int ws_handshake(wsh_t *wsh) unsigned char output[SHA1_HASH_SIZE] = ""; char b64[256] = ""; char respond[512] = ""; - issize_t bytes; + ssize_t bytes; char *p, *e = 0; if (wsh->sock == ws_sock_invalid) { @@ -304,9 +304,9 @@ int ws_handshake(wsh_t *wsh) } -issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) +ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) { - issize_t r; + ssize_t r; int x = 0; if (wsh->ssl) { @@ -335,11 +335,11 @@ issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes) if (x >= 100) { r = -1; } - + return r; } -issize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) +ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes) { size_t r; @@ -415,7 +415,7 @@ int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock) wsh->sock = sock; if (!ssl_ctx) { - ssl_ctx = globals.ssl_ctx; + ssl_ctx = ws_globals.ssl_ctx; } if (close_sock) { @@ -510,7 +510,7 @@ void ws_destroy(wsh_t *wsh) } } -issize_t ws_close(wsh_t *wsh, int16_t reason) +ssize_t ws_close(wsh_t *wsh, int16_t reason) { if (wsh->down) { @@ -540,10 +540,10 @@ issize_t ws_close(wsh_t *wsh, int16_t reason) } -issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) +ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) { - issize_t need = 2; + ssize_t need = 2; char *maskp; again: @@ -559,8 +559,8 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) return ws_close(wsh, WS_PROTO_ERR); } - if ((wsh->datalen = ws_raw_read(wsh, wsh->buffer, 14)) < need) { - if ((wsh->datalen += ws_raw_read(wsh, wsh->buffer + wsh->datalen, 14 - wsh->datalen)) < need) { + if ((wsh->datalen = ws_raw_read(wsh, wsh->buffer, 9)) < need) { + if ((wsh->datalen += ws_raw_read(wsh, wsh->buffer + wsh->datalen, 9 - wsh->datalen)) < need) { /* too small - protocol err */ return ws_close(wsh, WS_PROTO_ERR); } @@ -597,7 +597,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) wsh->plen = wsh->buffer[1] & 0x7f; wsh->payload = &wsh->buffer[2]; - + if (wsh->plen == 127) { uint64_t *u64; @@ -637,7 +637,13 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) need = (wsh->plen - (wsh->datalen - need)); - if ((need + wsh->datalen) > (issize_t)wsh->buflen) { + if (need < 0) { + /* invalid read - protocol err .. */ + *oc = WSOC_CLOSE; + return ws_close(wsh, WS_PROTO_ERR); + } + + if ((need + wsh->datalen) > (ssize_t)wsh->buflen) { /* too big - Ain't nobody got time fo' dat */ *oc = WSOC_CLOSE; return ws_close(wsh, WS_DATA_TOO_BIG); @@ -646,7 +652,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) wsh->rplen = wsh->plen - need; while(need) { - issize_t r = ws_raw_read(wsh, wsh->payload + wsh->rplen, need); + ssize_t r = ws_raw_read(wsh, wsh->payload + wsh->rplen, need); if (r < 1) { /* invalid read - protocol err .. */ @@ -660,7 +666,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) } if (mask && maskp) { - issize_t i; + ssize_t i; for (i = 0; i < wsh->datalen; i++) { wsh->payload[i] ^= maskp[i % 4]; @@ -693,7 +699,7 @@ issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data) } } -issize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes) +ssize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes) { if (bytes + wsh->wdatalen > wsh->buflen) { @@ -707,9 +713,9 @@ issize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes) return bytes; } -issize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc) +ssize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc) { - issize_t r = 0; + ssize_t r = 0; if (!wsh->wdatalen) { return -1; @@ -723,7 +729,7 @@ issize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc) } -issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes) +ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes) { uint8_t hdr[14] = { 0 }; size_t hlen = 2; @@ -757,11 +763,11 @@ issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes) *u64 = htonl(bytes); } - if (ws_raw_write(wsh, (void *) &hdr[0], hlen) != (issize_t)hlen) { + if (ws_raw_write(wsh, (void *) &hdr[0], hlen) != (ssize_t)hlen) { return -1; } - if (ws_raw_write(wsh, data, bytes) != (issize_t)bytes) { + if (ws_raw_write(wsh, data, bytes) != (ssize_t)bytes) { return -2; } diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/ws.h b/libs/sofia-sip/libsofia-sip-ua/tport/ws.h index 81368158b3..ac383e9c8b 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/ws.h +++ b/libs/sofia-sip/libsofia-sip-ua/tport/ws.h @@ -24,17 +24,27 @@ #include //#include "sha1.h" #include -#include + +#ifdef _MSC_VER +#ifdef _WIN64 +#define WS_SSIZE_T __int64 +#elif _MSC_VER >= 1400 +#define WS_SSIZE_T __int32 __w64 +#else +#define WS_SSIZE_T __int32 +#endif +typedef WS_SSIZE_T ssize_t +#endif -struct globals_s { +struct ws_globals_s { const SSL_METHOD *ssl_method; SSL_CTX *ssl_ctx; char cert[512]; char key[512]; }; -extern struct globals_s globals; +extern struct ws_globals_s ws_globals; typedef int ws_socket_t; #define ws_sock_invalid -1 @@ -61,11 +71,11 @@ typedef struct wsh_s { char buffer[65536]; char wbuffer[65536]; size_t buflen; - issize_t datalen; - issize_t wdatalen; + ssize_t datalen; + ssize_t wdatalen; char *payload; - issize_t plen; - issize_t rplen; + ssize_t plen; + ssize_t rplen; SSL *ssl; int handshake; uint8_t down; @@ -73,16 +83,16 @@ typedef struct wsh_s { uint8_t close_sock; } wsh_t; -issize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc); -issize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes); +ssize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc); +ssize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes); -issize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes); -issize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes); -issize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data); -issize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes); +ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes); +ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes); +ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data); +ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes); int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock); -issize_t ws_close(wsh_t *wsh, int16_t reason); +ssize_t ws_close(wsh_t *wsh, int16_t reason); void ws_destroy(wsh_t *wsh); void init_ssl(void); void deinit_ssl(void); From 52f4507619a18f5cb1d4d4355473b561fcbcf713 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 17 Sep 2013 06:26:20 +0500 Subject: [PATCH 46/49] del mod_html5 --- src/mod/endpoints/mod_html5/Makefile.am | 22 - src/mod/endpoints/mod_html5/mod_html5.c | 541 ------------------------ 2 files changed, 563 deletions(-) delete mode 100644 src/mod/endpoints/mod_html5/Makefile.am delete mode 100644 src/mod/endpoints/mod_html5/mod_html5.c diff --git a/src/mod/endpoints/mod_html5/Makefile.am b/src/mod/endpoints/mod_html5/Makefile.am deleted file mode 100644 index 9262333ad1..0000000000 --- a/src/mod/endpoints/mod_html5/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -include $(top_srcdir)/build/modmake.rulesam - -MODNAME=mod_html5 - -LIBWEBSOCKETS_DIR=$(switch_srcdir)/libs/libwebsockets -LIBWEBSOCKETS_BUILDDIR=$(switch_builddir)/libs/libwebsockets -LIBWEBSOCKETSLA=$(LIBWEBSOCKETS_BUILDDIR)/lib/libwebsockets.la - -mod_LTLIBRARIES = mod_html5.la -mod_html5_la_SOURCES = mod_html5.c -mod_html5_la_CFLAGS = $(AM_CFLAGS) -I. -mod_html5_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(LIBWEBSOCKETSLA) -mod_html5_la_LDFLAGS = -avoid-version -module -no-undefined -shared - -BUILT_SOURCES = $(LIBWEBSOCKETSLA) - -$(mod_html5_la_SOURCES) : $(BUILT_SOURCES) - -$(LIBWEBSOCKETSLA): $(LIBWEBSOCKETS_DIR) $(LIBWEBSOCKETS_DIR)/.update - cd $(LIBWEBSOCKETS_BUILDDIR) && $(MAKE) - $(TOUCH_TARGET) - diff --git a/src/mod/endpoints/mod_html5/mod_html5.c b/src/mod/endpoints/mod_html5/mod_html5.c deleted file mode 100644 index 20700e07f5..0000000000 --- a/src/mod/endpoints/mod_html5/mod_html5.c +++ /dev/null @@ -1,541 +0,0 @@ -/* - * mod_html5 for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2011-2012, Barracuda Networks Inc. - * - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mod_html5 for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * - * The Initial Developer of the Original Code is Barracuda Networks Inc. - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II - * Michael Jerris - * - * mod_html5.c -- HTML5 Endpoint Module - * - */ - -#include - -#define HTML5_EVENT_CUSTOM "html5::custom" - -struct html5_profile { - char *name; /* < Profile name */ - switch_memory_pool_t *pool; /* < Memory pool */ - switch_thread_rwlock_t *rwlock; /* < Rwlock for reference counting */ - uint32_t flags; /* < PFLAGS */ - switch_mutex_t *mutex; /* < Mutex for call count */ - int calls; /* < Active calls count */ - int clients; /* < Number of connected clients */ - switch_hash_t *session_hash; /* < Active rtmp sessions */ - switch_thread_rwlock_t *session_rwlock; /* < rwlock for session hashtable */ - const char *context; /* < Default dialplan name */ - const char *dialplan; /* < Default dialplan context */ - const char *bind_address; /* < Bind address */ - const char *io_name; /* < Name of I/O module (from config) */ - int chunksize; /* < Override default chunksize (from config) */ - int buffer_len; /* < Receive buffer length the flash clients should use */ - - switch_hash_t *reg_hash; /* < Registration hashtable */ - switch_thread_rwlock_t *reg_rwlock; /* < Registration hash rwlock */ - - switch_bool_t auth_calls; /* < Require authentiation */ -}; - -typedef struct html5_profile html5_profile_t; - -struct html5_private { - unsigned int flags; - switch_codec_t read_codec; - switch_codec_t write_codec; - - switch_frame_t read_frame; - unsigned char databuf[SWITCH_RECOMMENDED_BUFFER_SIZE]; /* < Buffer for read_frame */ - - switch_caller_profile_t *caller_profile; - - switch_mutex_t *mutex; - switch_mutex_t *flag_mutex; - - switch_core_session_t *session; - switch_channel_t *channel; -}; - -typedef struct html5_private html5_private_t; - -switch_status_t html5_on_execute(switch_core_session_t *session); -switch_status_t html5_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf); -switch_status_t html5_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg); -switch_status_t html5_receive_event(switch_core_session_t *session, switch_event_t *event); -switch_status_t html5_on_init(switch_core_session_t *session); -switch_status_t html5_on_hangup(switch_core_session_t *session); -switch_status_t html5_on_destroy(switch_core_session_t *session); -switch_status_t html5_on_routing(switch_core_session_t *session); -switch_status_t html5_on_exchange_media(switch_core_session_t *session); -switch_status_t html5_on_soft_execute(switch_core_session_t *session); -switch_call_cause_t html5_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, - switch_caller_profile_t *outbound_profile, - switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, - switch_call_cause_t *cancel_cause); -switch_status_t html5_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id); -switch_status_t html5_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id); -switch_status_t html5_kill_channel(switch_core_session_t *session, int sig); - -SWITCH_MODULE_LOAD_FUNCTION(mod_html5_load); -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_html5_shutdown); -SWITCH_MODULE_DEFINITION(mod_html5, mod_html5_load, mod_html5_shutdown, NULL); - -switch_state_handler_table_t html5_state_handlers = { - /*.on_init */ html5_on_init, - /*.on_routing */ html5_on_routing, - /*.on_execute */ html5_on_execute, - /*.on_hangup */ html5_on_hangup, - /*.on_exchange_media */ html5_on_exchange_media, - /*.on_soft_execute */ html5_on_soft_execute, - /*.on_consume_media */ NULL, - /*.on_hibernate */ NULL, - /*.on_reset */ NULL, - /*.on_park */ NULL, - /*.on_reporting */ NULL, - /*.on_destroy */ html5_on_destroy -}; - -switch_io_routines_t html5_io_routines = { - /*.outgoing_channel */ html5_outgoing_channel, - /*.read_frame */ html5_read_frame, - /*.write_frame */ html5_write_frame, - /*.kill_channel */ html5_kill_channel, - /*.send_dtmf */ html5_send_dtmf, - /*.receive_message */ html5_receive_message, - /*.receive_event */ html5_receive_event -}; - -/* - State methods they get called when the state changes to the specific state - returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next - so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it. -*/ -switch_status_t html5_on_init(switch_core_session_t *session) -{ - switch_channel_t *channel; - html5_private_t *tech_pvt = NULL; - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - return SWITCH_STATUS_SUCCESS; -} - -switch_status_t html5_on_routing(switch_core_session_t *session) -{ - switch_channel_t *channel = NULL; - html5_private_t *tech_pvt = NULL; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); - - return SWITCH_STATUS_SUCCESS; -} - -switch_status_t html5_on_execute(switch_core_session_t *session) -{ - switch_channel_t *channel = NULL; - html5_private_t *tech_pvt = NULL; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel)); - - return SWITCH_STATUS_SUCCESS; -} - -switch_status_t html5_on_destroy(switch_core_session_t *session) -{ - switch_channel_t *channel = NULL; - html5_private_t *tech_pvt = NULL; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - - if (tech_pvt == NULL) { - return SWITCH_STATUS_SUCCESS; - } - - return SWITCH_STATUS_SUCCESS; -} - -switch_status_t html5_on_hangup(switch_core_session_t *session) -{ - switch_channel_t *channel = NULL; - html5_private_t *tech_pvt = NULL; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - return SWITCH_STATUS_SUCCESS; -} - -switch_status_t html5_kill_channel(switch_core_session_t *session, int sig) -{ - switch_channel_t *channel = NULL; - html5_private_t *tech_pvt = NULL; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - switch (sig) { - case SWITCH_SIG_KILL: - break; - case SWITCH_SIG_BREAK: - break; - default: - break; - } - - return SWITCH_STATUS_SUCCESS; -} - -switch_status_t html5_on_exchange_media(switch_core_session_t *session) -{ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n"); - return SWITCH_STATUS_SUCCESS; -} - -switch_status_t html5_on_soft_execute(switch_core_session_t *session) -{ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n"); - return SWITCH_STATUS_SUCCESS; -} - -switch_status_t html5_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf) -{ - html5_private_t *tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - return SWITCH_STATUS_SUCCESS; -} - -switch_status_t html5_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) -{ - switch_channel_t *channel = NULL; - html5_private_t *tech_pvt = NULL; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - // *frame = &tech_pvt->read_frame; - - return SWITCH_STATUS_SUCCESS; -} - -switch_status_t html5_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) -{ - switch_channel_t *channel = NULL; - html5_private_t *tech_pvt = NULL; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - return SWITCH_STATUS_SUCCESS; -} - -switch_status_t html5_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg) -{ - switch_channel_t *channel; - html5_private_t *tech_pvt; - - channel = switch_core_session_get_channel(session); - assert(channel != NULL); - - tech_pvt = (html5_private_t *) switch_core_session_get_private(session); - assert(tech_pvt != NULL); - - switch (msg->message_id) { - case SWITCH_MESSAGE_INDICATE_ANSWER: - switch_channel_mark_answered(channel); - break; - case SWITCH_MESSAGE_INDICATE_RINGING: - switch_channel_mark_ring_ready(channel); - break; - case SWITCH_MESSAGE_INDICATE_PROGRESS: - switch_channel_mark_pre_answered(channel); - break; - case SWITCH_MESSAGE_INDICATE_HOLD: - case SWITCH_MESSAGE_INDICATE_UNHOLD: - break; - case SWITCH_MESSAGE_INDICATE_DISPLAY: - break; - default: - break; - } - - return SWITCH_STATUS_SUCCESS; -} - -/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines - that allocate memory or you will have 1 channel with memory allocated from another channel's pool! -*/ -switch_call_cause_t html5_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, - switch_caller_profile_t *outbound_profile, - switch_core_session_t **newsession, switch_memory_pool_t **inpool, switch_originate_flag_t flags, - switch_call_cause_t *cancel_cause) -{ - // html5_private_t *tech_pvt; - // switch_caller_profile_t *caller_profile; - // switch_channel_t *channel; - switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - - return cause; -} - -switch_status_t html5_receive_event(switch_core_session_t *session, switch_event_t *event) -{ - html5_private_t *tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - return SWITCH_STATUS_SUCCESS; -} - -#if 0 - -static switch_xml_config_item_t *get_instructions(html5_profile_t *profile) { - switch_xml_config_item_t *dup; - switch_xml_config_item_t instructions[] = { - /* parameter name type reloadable pointer default value options structure */ - SWITCH_CONFIG_ITEM("context", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->context, "public", &switch_config_string_strdup, - "", "The dialplan context to use for inbound calls"), - SWITCH_CONFIG_ITEM("dialplan", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->dialplan, "XML", &switch_config_string_strdup, - "", "The dialplan to use for inbound calls"), - SWITCH_CONFIG_ITEM("bind-address", SWITCH_CONFIG_STRING, 0, &profile->bind_address, "0.0.0.0:1935", &switch_config_string_strdup, - "ip:port", "IP and port to bind"), - SWITCH_CONFIG_ITEM("auth-calls", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &profile->auth_calls, SWITCH_FALSE, NULL, "true|false", "Set to true in order to reject unauthenticated calls"), - SWITCH_CONFIG_ITEM_END() - }; - - dup = malloc(sizeof(instructions)); - memcpy(dup, instructions, sizeof(instructions)); - return dup; -} - -static switch_status_t config_profile(html5_profile_t *profile, switch_bool_t reload) -{ - switch_xml_t cfg, xml, x_profiles, x_profile, x_settings; - switch_status_t status = SWITCH_STATUS_FALSE; - switch_xml_config_item_t *instructions = (profile ? get_instructions(profile) : NULL); - switch_event_t *event = NULL; - int count; - const char *file = "html5.conf"; - - if (!(xml = switch_xml_open_cfg(file, &cfg, NULL))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open %s\n", file); - goto done; - } - - if (!(x_profiles = switch_xml_child(cfg, "profiles"))) { - goto done; - } - - for (x_profile = switch_xml_child(x_profiles, "profile"); x_profile; x_profile = x_profile->next) { - const char *name = switch_xml_attr_soft(x_profile, "name"); - if (strcmp(name, profile->name)) { - continue; - } - - if (!(x_settings = switch_xml_child(x_profile, "settings"))) { - goto done; - } - - - count = switch_event_import_xml(switch_xml_child(x_settings, "param"), "name", "value", &event); - status = switch_xml_config_parse_event(event, count, reload, instructions); - } - - -done: - if (xml) { - switch_xml_free(xml); - } - switch_safe_free(instructions); - if (event) { - switch_event_destroy(&event); - } - return status; -} -#endif - -static void html5_event_handler(switch_event_t *event) -{ - if (!event) { - return; - } -} - -#define HTML5_CONTACT_FUNCTION_SYNTAX "profile/user@domain[/[!]nickname]" -SWITCH_STANDARD_API(html5_contact_function) -{ - int argc; - char *argv[5]; - char *dup = NULL; - // char *szprofile = NULL, *user = NULL; - // const char *nickname = NULL; - - if (zstr(cmd)) { - goto usage; - } - - dup = strdup(cmd); - argc = switch_split(dup, '/', argv); - - if (argc < 2 || zstr(argv[0]) || zstr(argv[1])) { - goto usage; - } - - // szprofile = argv[0]; - - if (!strchr(argv[1], '@')) { - goto usage; - } - - // user = argv[1]; - // nickname = argv[2]; - - goto done; - -usage: - stream->write_function(stream, "Usage: html5_contact "HTML5_CONTACT_FUNCTION_SYNTAX"\n"); - -done: - switch_safe_free(dup); - return SWITCH_STATUS_SUCCESS; -} - -#define HTML5_FUNCTION_SYNTAX "profile [profilename] [start | stop | rescan | restart]\nstatus profile [profilename]\nstatus profile [profilename] [reg | sessions]\nsession [session_id] [kill | login [user@domain] | logout [user@domain]]" -SWITCH_STANDARD_API(html5_function) -{ - int argc; - char *argv[10]; - char *dup = NULL; - - if (zstr(cmd)) { - goto usage; - } - - dup = strdup(cmd); - argc = switch_split(dup, ' ', argv); - - if (argc < 1 || zstr(argv[0])) { - goto usage; - } - - goto done; - -usage: - stream->write_function(stream, "-ERR Usage: "HTML5_FUNCTION_SYNTAX"\n"); - -done: - switch_safe_free(dup); - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_MODULE_LOAD_FUNCTION(mod_html5_load) -{ - switch_api_interface_t *api_interface; - switch_endpoint_interface_t *html5_endpoint_interface; - - *module_interface = switch_loadable_module_create_module_interface(pool, modname); - - html5_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE); - html5_endpoint_interface->interface_name = "html5"; - html5_endpoint_interface->io_routines = &html5_io_routines; - html5_endpoint_interface->state_handler = &html5_state_handlers; - - SWITCH_ADD_API(api_interface, "html5", "html5 management", html5_function, HTML5_FUNCTION_SYNTAX); - SWITCH_ADD_API(api_interface, "html5_contact", "html5 contact", html5_contact_function, HTML5_CONTACT_FUNCTION_SYNTAX); - - // switch_console_set_complete("add html5 status"); - - switch_event_bind("mod_html5", SWITCH_EVENT_CUSTOM, HTML5_EVENT_CUSTOM, html5_event_handler, NULL); - - { - switch_xml_t cfg, xml, x_profiles, x_profile; - const char *file = "html5.conf"; - - if (!(xml = switch_xml_open_cfg(file, &cfg, NULL))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open %s\n", file); - goto done; - } - - if (!(x_profiles = switch_xml_child(cfg, "profiles"))) { - goto done; - } - - for (x_profile = switch_xml_child(x_profiles, "profile"); x_profile; x_profile = x_profile->next) { - //const char *name = switch_xml_attr_soft(x_profile, "name"); - //html5_profile_start(name); - } - done: - if (xml) { - switch_xml_free(xml); - } - } - - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_html5_shutdown) -{ - switch_event_unbind_callback(html5_event_handler); - - return SWITCH_STATUS_SUCCESS; -} - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: - */ From 802794b9f14eebfa33ce176f4ead84c40fbdaacf Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Sep 2013 19:56:02 -0500 Subject: [PATCH 47/49] FS-5794 --resolve --- src/include/switch_cpp.h | 3 ++- src/switch_cpp.cpp | 11 ++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index bccf71a3a1..57d122b79b 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -107,8 +107,9 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod protected: char *last_data; char time_buf[64]; + switch_core_session_t *session; public: - SWITCH_DECLARE_CONSTRUCTOR API(void); + SWITCH_DECLARE_CONSTRUCTOR API(CoreSession *s = NULL); virtual SWITCH_DECLARE_CONSTRUCTOR ~ API(); SWITCH_DECLARE(const char *) execute(const char *command, const char *data = NULL); SWITCH_DECLARE(const char *) executeString(const char *command); diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index f7f6a4a5b8..27d6dc68b6 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -215,8 +215,13 @@ SWITCH_DECLARE(void) IVRMenu::execute(CoreSession *session, const char *name) switch_ivr_menu_execute(session->session, menu, (char *)name, NULL); } -SWITCH_DECLARE_CONSTRUCTOR API::API() +SWITCH_DECLARE_CONSTRUCTOR API::API(CoreSession *s) { + if (s) { + session = s->session; + } else { + session = NULL; + } last_data = NULL; } @@ -231,7 +236,7 @@ SWITCH_DECLARE(const char *) API::execute(const char *cmd, const char *arg) switch_stream_handle_t stream = { 0 }; this_check(""); SWITCH_STANDARD_STREAM(stream); - switch_api_execute(cmd, arg, NULL, &stream); + switch_api_execute(cmd, arg, session, &stream); switch_safe_free(last_data); last_data = (char *) stream.data; return last_data; @@ -267,7 +272,7 @@ SWITCH_DECLARE(const char *) API::executeString(const char *cmd) switch_safe_free(last_data); SWITCH_STANDARD_STREAM(stream); - switch_api_execute(mycmd, arg, NULL, &stream); + switch_api_execute(mycmd, arg, session, &stream); last_data = (char *) stream.data; switch_safe_free(mycmd); return last_data; From 903461559e19e0c3b6978282abd6d59cf037d58c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 16 Sep 2013 19:56:24 -0500 Subject: [PATCH 48/49] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 29 +++++++++++++++++-- src/mod/languages/mod_managed/managed/swig.cs | 26 +++++++++++++++-- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 0b224e86ee..756259d4d2 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -6639,6 +6639,29 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_thread_data_t_alloc_get(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_thread_data_t_pool_set(void * jarg1, void * jarg2) { + switch_thread_data_t *arg1 = (switch_thread_data_t *) 0 ; + switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ; + + arg1 = (switch_thread_data_t *)jarg1; + arg2 = (switch_memory_pool_t *)jarg2; + if (arg1) (arg1)->pool = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_thread_data_t_pool_get(void * jarg1) { + void * jresult ; + switch_thread_data_t *arg1 = (switch_thread_data_t *) 0 ; + switch_memory_pool_t *result = 0 ; + + arg1 = (switch_thread_data_t *)jarg1; + result = (switch_memory_pool_t *) ((arg1)->pool); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_thread_data_t() { void * jresult ; switch_thread_data_t *result = 0 ; @@ -39944,11 +39967,13 @@ SWIGEXPORT void SWIGSTDCALL CSharp_IvrMenu_Execute(void * jarg1, void * jarg2, c } -SWIGEXPORT void * SWIGSTDCALL CSharp_new_Api() { +SWIGEXPORT void * SWIGSTDCALL CSharp_new_Api(void * jarg1) { void * jresult ; + CoreSession *arg1 = (CoreSession *) NULL ; API *result = 0 ; - result = (API *)new API(); + arg1 = (CoreSession *)jarg1; + result = (API *)new API(arg1); jresult = (void *)result; return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 87792b283c..f260022a00 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -39,7 +39,7 @@ public class Api : IDisposable { } } - public Api() : this(freeswitchPINVOKE.new_Api(), true) { + public Api(CoreSession s) : this(freeswitchPINVOKE.new_Api(CoreSession.getCPtr(s)), true) { } public string Execute(string command, string data) { @@ -8683,6 +8683,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_thread_data_t_alloc_get")] public static extern int switch_thread_data_t_alloc_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_thread_data_t_pool_set")] + public static extern void switch_thread_data_t_pool_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_thread_data_t_pool_get")] + public static extern IntPtr switch_thread_data_t_pool_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_thread_data_t")] public static extern IntPtr new_switch_thread_data_t(); @@ -16421,7 +16427,7 @@ class freeswitchPINVOKE { public static extern void IvrMenu_Execute(HandleRef jarg1, HandleRef jarg2, string jarg3); [DllImport("mod_managed", EntryPoint="CSharp_new_Api")] - public static extern IntPtr new_Api(); + public static extern IntPtr new_Api(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_delete_Api")] public static extern void delete_Api(HandleRef jarg1); @@ -25895,6 +25901,8 @@ public enum switch_channel_flag_t { CF_VIDEO_PASSIVE, CF_NOVIDEO, CF_VIDEO_ECHO, + CF_SLA_INTERCEPT, + CF_VIDEO_BREAK, CF_FLAG_MAX } @@ -27816,6 +27824,9 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_BLIND_TRANSFER_RESPONSE, SWITCH_MESSAGE_INDICATE_STUN_ERROR, SWITCH_MESSAGE_INDICATE_MEDIA_RENEG, + SWITCH_MESSAGE_ANSWER_EVENT, + SWITCH_MESSAGE_PROGRESS_EVENT, + SWITCH_MESSAGE_RING_EVENT, SWITCH_MESSAGE_INVALID } @@ -36351,6 +36362,17 @@ public class switch_thread_data_t : IDisposable { } } + public SWIGTYPE_p_apr_pool_t pool { + set { + freeswitchPINVOKE.switch_thread_data_t_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_thread_data_t_pool_get(swigCPtr); + SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false); + return ret; + } + } + public switch_thread_data_t() : this(freeswitchPINVOKE.new_switch_thread_data_t(), true) { } From dffe48aaeca731da455f12d5644cf97f675c3ee9 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Mon, 16 Sep 2013 22:00:35 -0400 Subject: [PATCH 49/49] Fix bootstrap from the removal of mod_html5 in previous commit and cleanup some other reference to it --- build/modules.conf.in | 3 +-- configure.in | 1 - debian/control-modules | 4 ---- debian/copyright | 1 - src/mod/.gitignore | 3 --- 5 files changed, 1 insertion(+), 11 deletions(-) diff --git a/build/modules.conf.in b/build/modules.conf.in index d60b1211ef..3f77b125b5 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -82,7 +82,6 @@ dialplans/mod_dialplan_xml #endpoints/mod_dingaling #endpoints/mod_gsmopen #endpoints/mod_h323 -#endpoints/mod_html5 #endpoints/mod_khomp endpoints/mod_loopback #endpoints/mod_opal @@ -152,4 +151,4 @@ xml_int/mod_xml_scgi #../../libs/openzap/mod_openzap ## Experimental Modules (don't cry if they're broken) -#../../contrib/mod/xml_int/mod_xml_odbc \ No newline at end of file +#../../contrib/mod/xml_int/mod_xml_odbc diff --git a/configure.in b/configure.in index da0a8bd559..ce78907d4a 100644 --- a/configure.in +++ b/configure.in @@ -1120,7 +1120,6 @@ AC_CONFIG_FILES([Makefile src/mod/applications/mod_stress/Makefile src/mod/applications/mod_hash/Makefile src/mod/codecs/mod_com_g729/Makefile - src/mod/endpoints/mod_html5/Makefile src/mod/endpoints/mod_portaudio/Makefile src/mod/endpoints/mod_skinny/Makefile src/mod/endpoints/mod_skypopen/Makefile diff --git a/debian/control-modules b/debian/control-modules index 919382ce93..679082187c 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -395,10 +395,6 @@ Description: mod_h323 Adds mod_h323. Build-Depends: libopenh323-dev | libh323plus-dev, libpt-dev -Module: endpoints/mod_html5 -Description: HTML5 endpoint module - This module adds support for HTML5 technologies such as WebRTC. - Module: endpoints/mod_khomp Description: mod_khomp Adds mod_khomp. diff --git a/debian/copyright b/debian/copyright index fcea146b7a..d7ea35053f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1765,7 +1765,6 @@ License: GPL-2+ Files: src/mod/endpoints/mod_rtmp/rtmp.c src/mod/endpoints/mod_rtmp/mod_rtmp.[ch] src/mod/endpoints/mod_rtmp/rtmp_sig.c - src/mod/endpoints/mod_html5/mod_html5.c src/mod/endpoints/mod_rtmp/rtmp_tcp.c Copyright: 2011-2012, Barracuda Networks Inc. License: MPL-1.1 diff --git a/src/mod/.gitignore b/src/mod/.gitignore index bfcc02ab70..78158b6fd1 100644 --- a/src/mod/.gitignore +++ b/src/mod/.gitignore @@ -36,7 +36,6 @@ /codecs/mod_vp8/Makefile /dialplans/mod_dialplan_asterisk/Makefile /dialplans/mod_dialplan_xml/Makefile -/endpoints/mod_html5/mod_html5.log /endpoints/mod_portaudio/Makefile /endpoints/mod_portaudio/Makefile.in /endpoints/mod_portaudio/mod_portaudio.log @@ -49,8 +48,6 @@ /endpoints/mod_sofia/Makefile /endpoints/mod_sofia/Makefile.in /endpoints/mod_sofia/mod_sofia.log -/endpoints/mod_html5/Makefile -/endpoints/mod_html5/Makefile.in /event_handlers/mod_erlang_event/Makefile /event_handlers/mod_event_socket/Makefile /formats/mod_native_file/Makefile