From 08dcb793601b16c548fdf65f0ab64cfa8699a08e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 21 Apr 2010 08:26:54 -0500 Subject: [PATCH 1/9] change SVN to source so even if we change repos again we won't say the wrong one --- bootstrap.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 4755bc75c5..f4da83706f 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -22,7 +22,7 @@ ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[ if test -z "$ac_version"; then echo "bootstrap: autoconf not found." echo " You need autoconf version 2.59 or newer installed" -echo " to build FreeSWITCH from SVN." +echo " to build FreeSWITCH from source." exit 1 fi @@ -37,7 +37,7 @@ IFS=.; set $ac_version; IFS=' ' if test "$1" = "2" -a "$2" -lt "59" || test "$1" -lt "2"; then echo "bootstrap: autoconf version $ac_version found." echo " You need autoconf version 2.59 or newer installed" -echo " to build FreeSWITCH from SVN." +echo " to build FreeSWITCH from source." exit 1 else echo "bootstrap: autoconf version $ac_version (ok)" @@ -50,7 +50,7 @@ am_version=`${AUTOMAKE:-automake} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[ if test -z "$am_version"; then echo "bootstrap: automake not found." echo " You need automake version 1.7 or newer installed" -echo " to build FreeSWITCH from SVN." +echo " to build FreeSWITCH from source." exit 1 fi IFS=_; set $am_version; IFS=' ' @@ -59,7 +59,7 @@ IFS=.; set $am_version; IFS=' ' if test "$1" = "1" -a "$2" -lt "7"; then echo "bootstrap: automake version $am_version found." echo " You need automake version 1.7 or newer installed" -echo " to build FreeSWITCH from SVN." +echo " to build FreeSWITCH from source." exit 1 else echo "bootstrap: automake version $am_version (ok)" @@ -71,7 +71,7 @@ acl_version=`${ACLOCAL:-aclocal} --version 2>/dev/null|sed -e 's/^[^0-9]*//;s/[a if test -z "$acl_version"; then echo "bootstrap: aclocal not found." echo " You need aclocal version 1.7 or newer installed" -echo " to build FreeSWITCH from SVN." +echo " to build FreeSWITCH from source." exit 1 fi IFS=_; set $acl_version; IFS=' ' @@ -80,7 +80,7 @@ IFS=.; set $acl_version; IFS=' ' if test "$1" = "1" -a "$2" -lt "7"; then echo "bootstrap: aclocal version $acl_version found." echo " You need aclocal version 1.7 or newer installed" -echo " to build FreeSWITCH from SVN." +echo " to build FreeSWITCH from source." exit 1 else echo "bootstrap: aclocal version $acl_version (ok)" @@ -96,7 +96,7 @@ libtool=${LIBTOOL:-`${LIBDIR}/apr/build/PrintPath glibtool libtool libtool22 lib lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'` if test -z "$lt_pversion"; then echo "bootstrap: libtool not found." - echo " You need libtool version 1.5.14 or newer to build FreeSWITCH from SVN." + echo " You need libtool version 1.5.14 or newer to build FreeSWITCH from source." exit 1 fi lt_version=`echo $lt_pversion|sed -e 's/\([a-z]*\)$/.\1/'` @@ -121,7 +121,7 @@ if test $lt_status = "good"; then echo "bootstrap: libtool version $lt_pversion (ok)" else echo "bootstrap: libtool version $lt_pversion found." - echo " You need libtool version 1.5.14 or newer to build FreeSWITCH from SVN." + echo " You need libtool version 1.5.14 or newer to build FreeSWITCH from source." exit 1 fi From 964d59c56e245b9c1cf53a73af87b2834c2c5ad8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 21 Apr 2010 09:53:26 -0500 Subject: [PATCH 2/9] proper checking for dlerror on failed dso load --- src/switch_dso.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/switch_dso.c b/src/switch_dso.c index 6fc5c7b86c..152c280d5d 100644 --- a/src/switch_dso.c +++ b/src/switch_dso.c @@ -127,7 +127,16 @@ void *switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err) { void *addr = dlsym(lib, sym); if (!addr) { - *err = strdup(dlerror()); + char *err_str = NULL; + dlerror(); + + if (!(addr = dlsym(lib, sym))) { + err_str = dlerror(); + } + + if (err_str) { + *err = strdup(err_str); + } } return addr; } From 95665f0096d6d8af74257fd0e17c6522f31ee6c1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 21 Apr 2010 10:11:13 -0500 Subject: [PATCH 3/9] JANITOR-4 --- src/mod/endpoints/mod_loopback/mod_loopback.c | 6 ------ src/mod/formats/mod_sndfile/mod_sndfile.c | 9 ++------- src/mod/loggers/mod_logfile/mod_logfile.c | 2 ++ src/switch.c | 1 + src/switch_core.c | 10 ++++++++++ src/switch_loadable_module.c | 3 ++- src/switch_time.c | 4 ++++ 7 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index 8dde5042b6..9e11c5b474 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -44,8 +44,6 @@ SWITCH_MODULE_DEFINITION(mod_loopback, mod_loopback_load, mod_loopback_shutdown, static switch_endpoint_interface_t *loopback_endpoint_interface = NULL; -static switch_memory_pool_t *module_pool = NULL; - typedef enum { TFLAG_LINKED = (1 << 0), TFLAG_OUTBOUND = (1 << 1), @@ -887,10 +885,6 @@ static switch_io_routines_t channel_io_routines = { SWITCH_MODULE_LOAD_FUNCTION(mod_loopback_load) { - if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n"); - return SWITCH_STATUS_TERM; - } memset(&globals, 0, sizeof(globals)); diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index 020943ce5a..c017ad9f06 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -36,7 +36,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sndfile_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sndfile_shutdown); SWITCH_MODULE_DEFINITION(mod_sndfile, mod_sndfile_load, mod_sndfile_shutdown, NULL); -static switch_memory_pool_t *module_pool = NULL; static struct { switch_hash_t *format_hash; @@ -415,12 +414,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sndfile_load) { switch_file_interface_t *file_interface; - if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n"); - return SWITCH_STATUS_TERM; - } - - switch_core_hash_init(&globals.format_hash, module_pool); + switch_core_hash_init(&globals.format_hash, pool); if (setup_formats() != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; @@ -447,6 +441,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sndfile_load) SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sndfile_shutdown) { switch_core_hash_destroy(&globals.format_hash); + return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/loggers/mod_logfile/mod_logfile.c b/src/mod/loggers/mod_logfile/mod_logfile.c index 3645cb1ea1..8cdaf9615a 100644 --- a/src/mod/loggers/mod_logfile/mod_logfile.c +++ b/src/mod/loggers/mod_logfile/mod_logfile.c @@ -398,9 +398,11 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_logfile_shutdown) if ((profile = (logfile_profile_t *) val)) { switch_file_close(profile->log_afd); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Closing %s\n", profile->logfile); + switch_safe_free(profile->logfile); } } + switch_core_hash_destroy(&profile_hash); return SWITCH_STATUS_SUCCESS; diff --git a/src/switch.c b/src/switch.c index 5c761e372c..77aea8dc00 100644 --- a/src/switch.c +++ b/src/switch.c @@ -791,6 +791,7 @@ int main(int argc, char *argv[]) destroy_status = switch_core_destroy(); switch_file_close(fd); + apr_pool_destroy(pool); if (unlink(pid_path) != 0) { fprintf(stderr, "Failed to delete pid file [%s]\n", pid_path); diff --git a/src/switch_core.c b/src/switch_core.c index fe0ffcbaba..78296ebe7b 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1867,13 +1867,23 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void) switch_safe_free(SWITCH_GLOBAL_dirs.script_dir); switch_safe_free(SWITCH_GLOBAL_dirs.htdocs_dir); switch_safe_free(SWITCH_GLOBAL_dirs.grammar_dir); + switch_safe_free(SWITCH_GLOBAL_dirs.storage_dir); switch_safe_free(SWITCH_GLOBAL_dirs.recordings_dir); switch_safe_free(SWITCH_GLOBAL_dirs.sounds_dir); + switch_safe_free(SWITCH_GLOBAL_dirs.run_dir); switch_safe_free(SWITCH_GLOBAL_dirs.temp_dir); switch_core_hash_destroy(&runtime.global_vars); switch_core_hash_destroy(&runtime.mime_types); + if (IP_LIST.hash) { + switch_core_hash_destroy(&IP_LIST.hash); + } + + if (IP_LIST.pool) { + switch_core_destroy_memory_pool(&IP_LIST.pool); + } + if (runtime.memory_pool) { apr_pool_destroy(runtime.memory_pool); apr_terminate(); diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 62ca411609..2e37585e52 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -788,7 +788,7 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena switch_loadable_module_interface_t *module_interface = NULL; char *derr = NULL; const char *err = NULL; - switch_memory_pool_t *pool; + switch_memory_pool_t *pool = NULL; switch_bool_t load_global = global; switch_assert(path != NULL); @@ -1349,6 +1349,7 @@ SWITCH_DECLARE(void) switch_loadable_module_shutdown(void) switch_core_hash_destroy(&loadable_modules.management_hash); switch_core_hash_destroy(&loadable_modules.dialplan_hash); + switch_core_destroy_memory_pool(&loadable_modules.pool); } SWITCH_DECLARE(switch_endpoint_interface_t *) switch_loadable_module_get_endpoint_interface(const char *name) diff --git a/src/switch_time.c b/src/switch_time.c index cbdc2f8eb1..2d74e60594 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -1064,6 +1064,10 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(softtimer_shutdown) switch_core_destroy_memory_pool(&TIMEZONES_LIST.pool); } + if (NODE) { + switch_event_unbind(&NODE); + } + return SWITCH_STATUS_SUCCESS; } From 118ddcf5d34a97d2dc02be0295a6c2130088e5ff Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Wed, 21 Apr 2010 19:57:23 +0100 Subject: [PATCH 4/9] fixed RTCP configuration in internal.xml --- conf/sip_profiles/internal.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index 2f5636e5a6..2196eff20d 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -209,8 +209,8 @@ - - + + From 0b45537ec8584a28251e8a3d4836c2d22cb8f272 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 21 Apr 2010 14:52:25 -0400 Subject: [PATCH 5/9] freetdm: make sure gains are not applied to non-voice channels --- libs/freetdm/src/ftdm_io.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 356eba5cb8..f00e7988e3 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2050,6 +2050,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co case FTDM_COMMAND_SET_RX_GAIN: { + if (!FTDM_IS_VOICE_CHANNEL(ftdmchan)) { + ftdm_log(FTDM_LOG_ERROR, "Cannot set rx gain in non-voice channel of type: %s\n", ftdm_chan_type2str(ftdmchan->type)); + GOTO_STATUS(done, FTDM_FAIL); + } ftdmchan->rxgain = FTDM_COMMAND_OBJ_FLOAT; reset_gain_table(ftdmchan->rxgain_table, ftdmchan->rxgain, ftdmchan->native_codec); if (ftdmchan->rxgain == 0.0) { @@ -2068,6 +2072,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co break; case FTDM_COMMAND_SET_TX_GAIN: { + if (!FTDM_IS_VOICE_CHANNEL(ftdmchan)) { + ftdm_log(FTDM_LOG_ERROR, "Cannot set tx gain in non-voice channel of type: %s\n", ftdm_chan_type2str(ftdmchan->type)); + GOTO_STATUS(done, FTDM_FAIL); + } ftdmchan->txgain = FTDM_COMMAND_OBJ_FLOAT; reset_gain_table(ftdmchan->txgain_table, ftdmchan->txgain, ftdmchan->native_codec); if (ftdmchan->txgain == 0.0) { @@ -2468,17 +2476,17 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "ftdmchan is null\n"); ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "No I/O module attached to ftdmchan\n"); - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "channel not open"); - return FTDM_FAIL; - } + return FTDM_FAIL; + } if (!ftdmchan->fio->read) { snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "method not implemented"); return FTDM_FAIL; } - status = ftdmchan->fio->read(ftdmchan, data, datalen); + status = ftdmchan->fio->read(ftdmchan, data, datalen); if (ftdmchan->fds[0] > -1) { int dlen = (int) *datalen; if (write(ftdmchan->fds[0], data, dlen) != dlen) { From e9829d1ed85c93ca14b91457b8c8b2513e112ae5 Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Wed, 21 Apr 2010 16:41:08 -0400 Subject: [PATCH 6/9] Add SAF_SUPPORT_NOMEDIA to nibblebill --- src/mod/applications/mod_nibblebill/mod_nibblebill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_nibblebill/mod_nibblebill.c b/src/mod/applications/mod_nibblebill/mod_nibblebill.c index 093fbd4ef2..b1b124bc67 100755 --- a/src/mod/applications/mod_nibblebill/mod_nibblebill.c +++ b/src/mod/applications/mod_nibblebill/mod_nibblebill.c @@ -944,7 +944,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_nibblebill_load) /* Add dialplan applications */ SWITCH_ADD_APP(app_interface, "nibblebill", "Handle billing for the current channel/call", "Pause, resume, reset, adjust, flush, heartbeat commands to handle billing.", nibblebill_app_function, APP_SYNTAX, - SAF_NONE | SAF_ROUTING_EXEC); + SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); /* register state handlers for billing */ switch_core_add_state_handler(&nibble_state_handler); From 5ce95b8443cd6000a5003e31c69963a0bbc477f4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 21 Apr 2010 14:50:17 -0500 Subject: [PATCH 7/9] fix errs --- src/switch_rtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index c2b2b457d7..e14bf3ad20 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1546,9 +1546,9 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi if (send_rate == -1) { switch_set_flag(rtp_session, SWITCH_RTP_FLAG_RTCP_PASSTHRU); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "RTCP passthru enabled. Remote Port: %d\n", rtp_session->remote_rtcp_port); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTCP passthru enabled. Remote Port: %d\n", rtp_session->remote_rtcp_port); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "RTCP send rate is: %d and packet rate is: %d Remote Port: %d\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTCP send rate is: %d and packet rate is: %d Remote Port: %d\n", send_rate, rtp_session->ms_per_packet, rtp_session->remote_rtcp_port); rtp_session->rtcp_interval = send_rate/(rtp_session->ms_per_packet/1000); } From 4616d9424e736af1653361749e37f2f9c2c62e4d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 21 Apr 2010 17:13:10 -0500 Subject: [PATCH 8/9] wtf --- src/mod/endpoints/mod_sofia/sofia_glue.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 49b302b7ff..9df96c280d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2727,8 +2727,6 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f (tech_pvt->stun_flags & STUN_FLAG_FUNNY) ? 1 : 0); } - printf("WTF [%s][%s]\n", switch_channel_get_variable(tech_pvt->channel, "rtcp_audio_interval_msec"), tech_pvt->profile->rtcp_audio_interval_msec); - if ((val = switch_channel_get_variable(tech_pvt->channel, "rtcp_audio_interval_msec")) || (val = tech_pvt->profile->rtcp_audio_interval_msec)) { const char *rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_audio_rtcp_port"); switch_port_t remote_port = 0; From fb9e6a104babca9616abd9e45b1f4f3b9a9d3a7b Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 21 Apr 2010 18:46:52 -0400 Subject: [PATCH 9/9] freetdm: fix boost unload crash --- .../ftmod_sangoma_boost/ftmod_sangoma_boost.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c index af92ac6775..f6138c2f43 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c @@ -2136,23 +2136,23 @@ static ftdm_status_t ftdm_sangoma_boost_start(ftdm_span_t *span) static ftdm_status_t ftdm_sangoma_boost_stop(ftdm_span_t *span) { - int cnt = 10; ftdm_status_t status = FTDM_SUCCESS; ftdm_sangoma_boost_data_t *sangoma_boost_data = span->signal_data; if (sangoma_boost_data->sigmod) { - - /* FIXME: we should make sure the span thread is stopped (use pthread_kill or freetdm thread kill function) */ /* I think stopping the span before destroying the queue makes sense otherwise may be boost events would still arrive when the queue is already destroyed! */ status = sangoma_boost_data->sigmod->stop_span(span); ftdm_queue_enqueue(sangoma_boost_data->boost_queue, NULL); - while(ftdm_test_flag(sangoma_boost_data, FTDM_SANGOMA_BOOST_RUNNING) && cnt-- > 0) { - ftdm_log(FTDM_LOG_DEBUG, "Waiting for boost thread\n"); - ftdm_sleep(500); - } + } + + while (ftdm_test_flag(sangoma_boost_data, FTDM_SANGOMA_BOOST_RUNNING)) { + ftdm_log(FTDM_LOG_DEBUG, "Waiting for boost thread\n"); + ftdm_sleep(100); + } + + if (sangoma_boost_data->sigmod) { ftdm_queue_destroy(&sangoma_boost_data->boost_queue); - return status; } return status; }