Merge branch 'signalwire:master' into master

This commit is contained in:
alexey-khabulyak 2023-05-15 15:03:22 -07:00 committed by GitHub
commit eaa521421c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
86 changed files with 8281 additions and 7955 deletions

View File

@ -40,7 +40,7 @@ Step by step tutorials to install FreeSWITCH from packages:
### Build from source
Example Dockerfiles to build FreeSWITCH and dependencies from source:
* https://github.com/signalwire/freeswitch/tree/dockerfile/docker/examples
* https://github.com/signalwire/freeswitch/tree/master/docker/examples
Step by step tutorials to build FreeSWITCH with provided dependency packages:
* [Debian](https://freeswitch.org/confluence/display/FREESWITCH/Debian#Debian-buildfromsource) [<b>Recommended</b>]

5
SECURITY.md Normal file
View File

@ -0,0 +1,5 @@
# Security Policy
## Reporting a Vulnerability
Send an e-mail to security@signalwire.com to report a vulnerability. If accepted, we'll create a security advisory and add you and your team as collaborators. Please allow our team sufficient time to resolve the vulnerability before disclosing it; we'll remain in contact about the fix and may ask for your assistance to verify it is resolved.

View File

@ -1 +1 @@
1.10.9-dev
1.10.10-dev

View File

@ -137,13 +137,13 @@
By default without specifying any crypto suites FreeSWITCH will offer
crypto suites from strongest to weakest accepting the strongest each
endpoint has in common. If you wish to force specific crypto suites you
can do so by appending the suites in a comma separated list in the order
can do so by appending the suites in a colon separated list in the order
that you wish to offer them in.
Examples:
rtp_secure_media=mandatory:AES_CM_256_HMAC_SHA1_80,AES_CM_256_HMAC_SHA1_32
rtp_secure_media=true:AES_CM_256_HMAC_SHA1_80,AES_CM_256_HMAC_SHA1_32
rtp_secure_media=mandatory:AES_CM_256_HMAC_SHA1_80:AES_CM_256_HMAC_SHA1_32
rtp_secure_media=true:AES_CM_256_HMAC_SHA1_80:AES_CM_256_HMAC_SHA1_32
rtp_secure_media=optional:AES_CM_256_HMAC_SHA1_80
rtp_secure_media=true:AES_CM_256_HMAC_SHA1_80

View File

@ -3,10 +3,10 @@
# Must change all of the below together
# For a release, set revision for that tagged release as well and uncomment
AC_INIT([freeswitch], [1.10.9-dev], bugs@freeswitch.org)
AC_INIT([freeswitch], [1.10.10-dev], bugs@freeswitch.org)
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
AC_SUBST(SWITCH_VERSION_MINOR, [10])
AC_SUBST(SWITCH_VERSION_MICRO, [9-dev])
AC_SUBST(SWITCH_VERSION_MICRO, [10-dev])
AC_SUBST(SWITCH_VERSION_REVISION, [])
AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
@ -716,7 +716,7 @@ PKG_CHECK_MODULES([SPANDSP], [spandsp >= 3.0],[
AC_MSG_ERROR([no usable spandsp; please install spandsp3 devel package or equivalent])
])
PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.6],[
PKG_CHECK_MODULES([SOFIA_SIP], [sofia-sip-ua >= 1.13.15],[
AM_CONDITIONAL([HAVE_SOFIA_SIP],[true])],[
AC_MSG_ERROR([no usable sofia-sip; please install sofia-sip-ua devel package or equivalent])
])
@ -1518,7 +1518,7 @@ PKG_CHECK_MODULES([V8FS_STATIC], [v8-6.1_static >= 6.1.298],[
])
])
PKG_CHECK_MODULES([KS], [libks >= 1.1.0],[
PKG_CHECK_MODULES([KS], [libks >= 1.8.2],[
AM_CONDITIONAL([HAVE_KS],[true])],[
if module_enabled mod_verto; then
AC_MSG_ERROR([You need to either install libks or disable mod_verto in modules.conf])

4
debian/bootstrap.sh vendored
View File

@ -332,7 +332,7 @@ Build-Depends:
uuid-dev, libexpat1-dev, libgdbm-dev, libdb-dev,
# used by many modules
libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev,
bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.6),
bison, zlib1g-dev, libsofia-sip-ua-dev (>= 1.13.15),
libspandsp3-dev,
# used to format the private freeswitch apt-repo key properly
gnupg,
@ -371,7 +371,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
Package: libfreeswitch1
Architecture: amd64 armhf
Depends: \${shlibs:Depends}, \${misc:Depends}, libsofia-sip-ua0 (>= 1.13.6)
Depends: \${shlibs:Depends}, \${misc:Depends}, libsofia-sip-ua0 (>= 1.13.15)
Recommends:
Suggests: libfreeswitch1-dbg
Conflicts: freeswitch-all (<= 1.6.7)

View File

@ -31,13 +31,18 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -yq install \
# mod_pgsql
libpq-dev \
# mod_sndfile
libsndfile1-dev libflac-dev libogg-dev libvorbis-dev
libsndfile1-dev libflac-dev libogg-dev libvorbis-dev \
# mod_shout
libshout3-dev libmpg123-dev libmp3lame-dev
RUN cd /usr/src/libs/libks && cmake . -DCMAKE_INSTALL_PREFIX=/usr -DWITH_LIBBACKTRACE=1 && make install
RUN cd /usr/src/libs/sofia-sip && ./bootstrap.sh && ./configure CFLAGS="-g -ggdb" --with-pic --with-glib=no --without-doxygen --disable-stun --prefix=/usr && make -j`nproc --all` && make install
RUN cd /usr/src/libs/spandsp && ./bootstrap.sh && ./configure CFLAGS="-g -ggdb" --with-pic --prefix=/usr && make -j`nproc --all` && make install
RUN cd /usr/src/libs/signalwire-c && PKG_CONFIG_PATH=/usr/lib/pkgconfig cmake . -DCMAKE_INSTALL_PREFIX=/usr && make install
# Enable modules
RUN sed -i 's|#formats/mod_shout|formats/mod_shout|' /usr/src/freeswitch/build/modules.conf.in
RUN cd /usr/src/freeswitch && ./bootstrap.sh -j
RUN cd /usr/src/freeswitch && ./configure
RUN cd /usr/src/freeswitch && make -j`nproc` && make install
@ -46,4 +51,4 @@ RUN cd /usr/src/freeswitch && make -j`nproc` && make install
RUN apt-get clean
# Uncomment to cleanup even more
#RUN rm -rf /usr/src/*
#RUN rm -rf /usr/src/*

View File

@ -140,7 +140,7 @@ BuildRequires: curl-devel >= 7.19
BuildRequires: gcc-c++
BuildRequires: libtool >= 1.5.17
BuildRequires: openssl-devel >= 1.0.1e
BuildRequires: sofia-sip-devel >= 1.13.6
BuildRequires: sofia-sip-devel >= 1.13.15
BuildRequires: spandsp3-devel >= 3.0
BuildRequires: pcre-devel
BuildRequires: speex-devel

View File

@ -29,7 +29,7 @@
#include "fspr_pools.h"
#include "fspr_errno.h"
#if !defined(_ANSI_SOURCE) && defined(_DARWIN_C_SOURCE)
#if !defined(NSIG) && !defined(_ANSI_SOURCE) && defined(_DARWIN_C_SOURCE)
#define NSIG __DARWIN_NSIG
#endif

View File

@ -310,7 +310,7 @@ extern struct switch_session_manager session_manager;
switch_status_t switch_core_sqldb_init(const char **err);
void switch_core_sqldb_destroy();
void switch_core_sqldb_destroy(void);
switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_t manage);
void switch_core_sqldb_stop(void);
void switch_core_session_init(switch_memory_pool_t *pool);

View File

@ -448,7 +448,7 @@ SWITCH_DECLARE(switch_status_t) switch_img_to_raw(switch_image_t *src, void *des
* \param[in] width The raw data width
* \param[in] height The raw data height
*/
SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t *dest, void *src, switch_img_fmt_t fmt, int width, int height);
SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t** destP, void *src, switch_img_fmt_t fmt, int width, int height);
SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_bool_t full, const char *text);
SWITCH_DECLARE(switch_image_t *) switch_img_read_file(const char* file_name);

View File

@ -1591,6 +1591,8 @@ GCC_DIAG_ON(deprecated-declarations)
context->vid_ready = 1;
switch_queue_push(context->eh.video_queue, img);
context->last_vid_push = switch_time_now();
} else {
switch_img_free(&img);
}
}
}

View File

@ -86,7 +86,6 @@ typedef union {
static uint32_t index_from_float(float f);
static float float_from_index(uint32_t d);
static float *acos_table = NULL;
static int acos_fd = -1;
#ifdef FAST_ACOSF_TESTING
@ -112,6 +111,10 @@ extern int compute_table(void)
acos_table_file = fopen(ACOS_TABLE_FILENAME, "w");
if (!acos_table_file) {
return -3;
}
for (i = 0; i < ACOS_TABLE_LENGTH; i++) {
f = acosf(float_from_index(i));
res = fwrite(&f, sizeof(f), 1, acos_table_file);
@ -124,10 +127,12 @@ extern int compute_table(void)
if (res != 0) {
return -2;
}
return 0;
fail:
fclose(acos_table_file);
return -1;
}
@ -144,8 +149,9 @@ extern int init_fast_acosf(void)
* or some other error occured */
errsv = errno;
strerror_r(errsv, err, 150);
if (errsv != ENOENT) return -1;
else {
if (errsv != ENOENT) {
return -1;
} else {
switch_log_printf(
SWITCH_CHANNEL_LOG,
SWITCH_LOG_NOTICE,
@ -166,10 +172,10 @@ extern int init_fast_acosf(void)
acos_fp = fopen(ACOS_TABLE_FILENAME, "r");
if (acos_fp == NULL) return -3;
/* can't fail */
acos_fd = fileno(acos_fp);
acos_table = (float *) mmap(
NULL, /* kernel chooses the address at which to create the mapping */
ACOS_TABLE_LENGTH * sizeof(float), PROT_READ, MAP_SHARED, acos_fd, 0);
ACOS_TABLE_LENGTH * sizeof(float), PROT_READ, MAP_SHARED, fileno(acos_fp), 0);
fclose(acos_fp);
if (acos_table == MAP_FAILED) return -4;
return 0;
@ -178,9 +184,7 @@ extern int init_fast_acosf(void)
extern int destroy_fast_acosf(void)
{
if (munmap(acos_table, ACOS_TABLE_LENGTH) == -1) return -1;
if (acos_fd != -1) {
if (close(acos_fd) == -1) return -2;
}
/* disable use of fast arc cosine file */
acos_table = NULL;

View File

@ -1138,6 +1138,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load) {
switch_application_interface_t *app_interface;
switch_api_interface_t *api_interface;
if (pool == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No memory pool assigned!\n");
return SWITCH_STATUS_TERM;
}
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@ -1147,10 +1154,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_avmd_load) {
}
memset(&avmd_globals, 0, sizeof(avmd_globals));
if (pool == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No memory pool assigned!\n");
return SWITCH_STATUS_TERM;
}
switch_mutex_init(&avmd_globals.mutex, SWITCH_MUTEX_NESTED, pool);
avmd_globals.pool = pool;
@ -1622,9 +1625,6 @@ SWITCH_STANDARD_APP(avmd_start_function) {
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_avmd_shutdown) {
size_t session_n;
#ifndef WIN32
int res;
#endif
switch_mutex_lock(avmd_globals.mutex);
@ -1638,18 +1638,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_avmd_shutdown) {
#ifndef WIN32
if (avmd_globals.settings.fast_math == 1) {
res = destroy_fast_acosf();
if (res != 0) {
switch (res) {
case -1:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed unmap arc cosine table\n");
break;
case -2:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed closing arc cosine table\n");
break;
default:
break;
}
if (destroy_fast_acosf()) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed unmap arc cosine table\n");
}
}
#endif
@ -1658,6 +1648,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_avmd_shutdown) {
switch_mutex_unlock(avmd_globals.mutex);
switch_mutex_destroy(avmd_globals.mutex);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Advanced voicemail detection disabled\n");
return SWITCH_STATUS_SUCCESS;
}

View File

@ -1969,9 +1969,10 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa
playback_array(agent_session, o_announce);
}
/* This is used for the waiting caller to quit waiting for a agent */
/* This is used to set the reason for callcenter_function breakout */
switch_channel_set_variable(member_channel, "cc_agent_found", "true");
switch_channel_set_variable(member_channel, "cc_agent_uuid", agent_uuid);
if (switch_true(switch_channel_get_variable(member_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE)) || switch_true(switch_channel_get_variable(agent_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE))) {
switch_channel_set_flag(member_channel, CF_BYPASS_MEDIA_AFTER_BRIDGE);
}
@ -1990,6 +1991,12 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa
switch_channel_set_variable(agent_channel, "cc_agent_bridged", "false");
switch_channel_set_variable(member_channel, "cc_agent_bridged", "false");
/* Set member to Abandoned state, previous Trying */
sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" SWITCH_TIME_T_FMT "' WHERE uuid = '%q' AND instance_id = '%q'",
cc_member_state2str(CC_MEMBER_STATE_ABANDONED), local_epoch_time_now(NULL), h->member_uuid, globals.cc_instance_id);
cc_execute_sql(NULL, sql, NULL);
switch_safe_free(sql);
if ((o_announce = switch_channel_get_variable(member_channel, "cc_bridge_failed_outbound_announce"))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Playing bridge failed audio to agent %s, audio: %s\n", h->agent_name, o_announce);
playback_array(agent_session, o_announce);
@ -2008,9 +2015,15 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa
bridged = 1;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member \"%s\" %s is bridged to agent %s\n",
h->member_cid_name, h->member_cid_number, h->agent_name);
switch_channel_set_variable(member_channel, "cc_agent_bridged", "true");
switch_channel_set_variable(agent_channel, "cc_agent_bridged", "true");
switch_channel_set_variable(member_channel, "cc_agent_uuid", agent_uuid);
/* Update member to Answered state, previous Trying */
sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%" SWITCH_TIME_T_FMT "' WHERE uuid = '%q' AND instance_id = '%q'",
cc_member_state2str(CC_MEMBER_STATE_ANSWERED), local_epoch_time_now(NULL), h->member_uuid, globals.cc_instance_id);
cc_execute_sql(NULL, sql, NULL);
switch_safe_free(sql);
}
if (bridged) {
@ -2111,7 +2124,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa
}
} else {
/* Agent didn't answer or originate failed */
/* Agent didn't answer or originate/bridge failed */
int delay_next_agent_call = 0;
switch_channel_t *member_channel = switch_core_session_get_channel(member_session);
switch_channel_clear_app_flag_key(CC_APP_KEY, member_channel, CC_APP_AGENT_CONNECTING);
@ -3051,6 +3064,10 @@ SWITCH_STANDARD_APP(callcenter_function)
switch_channel_set_variable(member_channel, "cc_side", "member");
switch_channel_set_variable(member_channel, "cc_member_uuid", member_uuid);
/* Clear flags in case previously set */
switch_channel_set_variable(member_channel, "cc_agent_found", NULL);
switch_channel_set_variable(member_channel, "cc_agent_bridged", NULL);
/* Add manually imported score */
if (cc_base_score) {
cc_base_score_int += atoi(cc_base_score);
@ -3178,8 +3195,8 @@ SWITCH_STANDARD_APP(callcenter_function)
args.buf = (void *) &ht;
args.buflen = sizeof(h);
/* An agent was found, time to exit and let the bridge do it job */
if ((p = switch_channel_get_variable(member_channel, "cc_agent_found")) && (agent_found = switch_true(p))) {
/* If the bridge didn't break the loop, break out now */
if ((p = switch_channel_get_variable(member_channel, "cc_agent_bridged")) && (agent_found = switch_true(p))) {
break;
}
/* If the member thread set a different reason, we monitor it so we can quit the wait */
@ -3201,8 +3218,6 @@ SWITCH_STANDARD_APP(callcenter_function)
switch_channel_set_variable(member_channel, "cc_exit_key", buf);
h->member_cancel_reason = CC_MEMBER_CANCEL_REASON_EXIT_WITH_KEY;
break;
} else if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
} else {
switch_status_t status = switch_ivr_collect_digits_callback(member_session, &args, 0, 0);
@ -3230,12 +3245,18 @@ SWITCH_STANDARD_APP(callcenter_function)
h->running = 0;
}
/* Stop uuid_broadcasts */
switch_core_session_flush_private_events(member_session);
switch_channel_stop_broadcast(member_channel);
switch_channel_set_flag_value(member_channel, CF_BREAK, 2);
/* Check if we were removed because FS Core(BREAK) asked us to */
if (h->member_cancel_reason == CC_MEMBER_CANCEL_REASON_NONE && !agent_found) {
h->member_cancel_reason = CC_MEMBER_CANCEL_REASON_BREAK_OUT;
}
switch_channel_set_variable(member_channel, "cc_agent_found", NULL);
/* Canceled for some reason */
if (!switch_channel_up(member_channel) || h->member_cancel_reason != CC_MEMBER_CANCEL_REASON_NONE) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> abandoned waiting in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name);
@ -3282,12 +3303,6 @@ SWITCH_STANDARD_APP(callcenter_function)
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> is answered by an agent in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name);
/* Update member state */
sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%" SWITCH_TIME_T_FMT "' WHERE uuid = '%q' AND instance_id = '%q'",
cc_member_state2str(CC_MEMBER_STATE_ANSWERED), local_epoch_time_now(NULL), member_uuid, globals.cc_instance_id);
cc_execute_sql(NULL, sql, NULL);
switch_safe_free(sql);
/* Update some channel variables for xml_cdr needs */
switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", "answered");
if ((queue = get_queue(queue_name))) {

View File

@ -845,6 +845,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cidlookup_load)
Macro expands to: switch_status_t mod_cidlookup_shutdown() */
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cidlookup_shutdown)
{
switch_xml_config_cleanup(instructions);
switch_event_unbind(&reload_xml_event);
return SWITCH_STATUS_SUCCESS;
}

View File

@ -2417,7 +2417,7 @@ SWITCH_STANDARD_API(uptime_function)
return SWITCH_STATUS_SUCCESS;
}
#define CTL_SYNTAX "[recover|send_sighup|hupall|pause [inbound|outbound]|resume [inbound|outbound]|shutdown [cancel|elegant|asap|now|restart]|sps|sps_peak_reset|sync_clock|sync_clock_when_idle|reclaim_mem|max_sessions|min_dtmf_duration [num]|max_dtmf_duration [num]|default_dtmf_duration [num]|min_idle_cpu|loglevel [level]|debug_level [level]|mdns_resolve [enable|disable]]"
#define CTL_SYNTAX "[api_expansion [on|off]|recover|send_sighup|hupall|pause [inbound|outbound]|resume [inbound|outbound]|shutdown [cancel|elegant|asap|now|restart]|sps|sps_peak_reset|sync_clock|sync_clock_when_idle|reclaim_mem|max_sessions|min_dtmf_duration [num]|max_dtmf_duration [num]|default_dtmf_duration [num]|min_idle_cpu|loglevel [level]|debug_level [level]|mdns_resolve [enable|disable]]"
SWITCH_STANDARD_API(ctl_function)
{
int argc;
@ -3225,6 +3225,7 @@ SWITCH_STANDARD_API(uuid_capture_text)
} else {
if ((tsession = switch_core_session_locate(uuid))) {
switch_ivr_capture_text(tsession, switch_true(onoff));
switch_core_session_rwunlock(tsession);
} else {
stream->write_function(stream, "-ERR No such channel %s!\n", uuid);
}
@ -5653,22 +5654,26 @@ SWITCH_STANDARD_API(alias_function)
#define COALESCE_SYNTAX "[^^<delim>]<value1>,<value2>,..."
SWITCH_STANDARD_API(coalesce_function)
{
switch_status_t status = SWITCH_STATUS_FALSE;
char *data = (char *) cmd;
char *mydata = NULL, *argv[256] = { 0 };
char *arg = (char *) cmd;
int argc = -1;
char delim = ',';
if (data && *data && (mydata = strdup(data))) {
argc = switch_separate_string(mydata, ',', argv,
if (!zstr(arg) && *arg == '^' && *(arg+1) == '^') {
arg += 2;
delim = *arg++;
}
if (!zstr(arg) && (mydata = strdup(arg))) {
argc = switch_separate_string(mydata, delim, argv,
(sizeof(argv) / sizeof(argv[0])));
}
if (argc > 0) {
int i;
for (i = 0; i < argc; i++) {
if (argv[i] && *argv[i]) {
if (!zstr(argv[i])) {
stream->write_function(stream, argv[i]);
status = SWITCH_STATUS_SUCCESS;
break;
}
}
@ -5676,7 +5681,9 @@ SWITCH_STANDARD_API(coalesce_function)
stream->write_function(stream, "-USAGE: %s\n", COALESCE_SYNTAX);
}
return status;
switch_safe_free(mydata);
return SWITCH_STATUS_SUCCESS;
}
#define SHOW_SYNTAX "codec|endpoint|application|api|dialplan|file|timer|calls [count]|channels [count|like <match string>]|calls|detailed_calls|bridged_calls|detailed_bridged_calls|aliases|complete|chat|management|modules|nat_map|say|interfaces|interface_types|tasks|limits|status"
@ -7745,6 +7752,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
switch_console_set_complete("add complete add");
switch_console_set_complete("add complete del");
switch_console_set_complete("add db_cache status");
switch_console_set_complete("add fsctl api_expansion on");
switch_console_set_complete("add fsctl api_expansion off");
switch_console_set_complete("add fsctl debug_level");
switch_console_set_complete("add fsctl debug_pool");
switch_console_set_complete("add fsctl debug_sql");
@ -7793,6 +7802,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
switch_console_set_complete("add fsctl shutdown restart elegant");
switch_console_set_complete("add fsctl sps");
switch_console_set_complete("add fsctl sync_clock");
switch_console_set_complete("add fsctl sync_clock_when_idle");
switch_console_set_complete("add fsctl flush_db_handles");
switch_console_set_complete("add fsctl min_idle_cpu");
switch_console_set_complete("add fsctl send_sighup");

View File

@ -3803,6 +3803,7 @@ void *SWITCH_THREAD_FUNC conference_video_muxing_thread_run(switch_thread_t *thr
switch_image_t *use_img = NULL;
if (!omember->session || !switch_channel_test_flag(omember->channel, CF_VIDEO_READY) ||
(conference_utils_test_flag(omember->conference, CFLAG_VIDEO_MUTE_EXIT_CANVAS) && !conference_utils_member_test_flag(omember, MFLAG_CAN_BE_SEEN)) ||
switch_core_session_media_flow(omember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_SENDONLY || switch_core_session_media_flow(omember->session, SWITCH_MEDIA_TYPE_VIDEO) == SWITCH_MEDIA_FLOW_INACTIVE) {
continue;
}

View File

@ -854,7 +854,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
}
if (context->rawImage && (context->debug || !context->overlay_count)) {
switch_img_from_raw(frame->img, (uint8_t *)context->rawImage->imageData, SWITCH_IMG_FMT_RGB24, context->rawImage->width, context->rawImage->height);
switch_img_from_raw(&frame->img, (uint8_t *)context->rawImage->imageData, SWITCH_IMG_FMT_RGB24, context->rawImage->width, context->rawImage->height);
}
int abs = 0;

View File

@ -4584,7 +4584,7 @@ SWITCH_STANDARD_APP(wait_for_silence_function)
timeout_ms = switch_atoui(argv[3]);
}
if (thresh > 0 && silence_hits > 0 && listen_hits >= 0) {
if (thresh > 0 && silence_hits > 0) {
switch_ivr_wait_for_silence(session, thresh, silence_hits, listen_hits, timeout_ms, argv[4]);
return;
}

View File

@ -497,6 +497,7 @@ switch_status_t ldns_lookup(const char *number, const char *root, char *server_n
/* create a new resolver from /etc/resolv.conf */
if (res) {
ldns_resolver_free(res);
res = NULL;
}
s = ldns_resolver_new_frm_file(&res, NULL);
}

View File

@ -370,6 +370,11 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
}
}
}
if (pvt->ldesc->activate) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "ACTIVATE\n");
pvt->ldesc->activate(pvt->handle);
}
}
break;
@ -382,6 +387,10 @@ static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, s
}
if (pvt->handle && pvt->ldesc) {
if (pvt->ldesc->deactivate) {
pvt->ldesc->deactivate(pvt->handle);
}
pvt->ldesc->cleanup(pvt->handle);
}

View File

@ -228,7 +228,7 @@ static ks_status_t load_credentials_from_json(ks_json_t *json)
const char *relay_connector_id = NULL;
#if SIGNALWIRE_CLIENT_C_VERSION_MAJOR >= 2
if ((bootstrap = ks_json_get_string(json, "bootstrap")) == NULL) {
if ((bootstrap = ks_json_get_object_string(json, "bootstrap", NULL)) == NULL) {
#else
if ((bootstrap = ks_json_get_object_cstr(json, "bootstrap")) == NULL) {
#endif
@ -238,7 +238,7 @@ static ks_status_t load_credentials_from_json(ks_json_t *json)
}
#if SIGNALWIRE_CLIENT_C_VERSION_MAJOR >= 2
if ((relay_connector_id = ks_json_get_string(json, "relay_connector_id")) == NULL) {
if ((relay_connector_id = ks_json_get_object_string(json, "relay_connector_id", NULL)) == NULL) {
#else
if ((relay_connector_id = ks_json_get_object_cstr(json, "relay_connector_id")) == NULL) {
#endif
@ -797,6 +797,7 @@ static ks_status_t load_credentials(void)
status = KS_STATUS_FAIL;
goto done;
}
fclose(fp);
json = ks_json_parse(data);
@ -805,6 +806,7 @@ static ks_status_t load_credentials(void)
status = KS_STATUS_FAIL;
goto done;
}
status = load_credentials_from_json(json);
ks_json_delete(&json);
@ -981,7 +983,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_signalwire_load)
#ifdef WIN32
sslLoadWindowsCACertificate();
#endif
// Configuration
swclt_config_create(&globals.config);
load_config();
@ -1206,6 +1207,7 @@ static void mod_signalwire_state_configure(void)
#if SIGNALWIRE_CLIENT_C_VERSION_MAJOR >= 2
if (!swclt_sess_provisioning_configure(globals.signalwire_session, "freeswitch", local_endpoint, external_endpoint, globals.relay_connector_id, &reply)) {
if (reply->type == SWCLT_CMD_TYPE_RESULT) {
ks_json_t *result;
#else
if (!swclt_sess_provisioning_configure(globals.signalwire_session, "freeswitch", local_endpoint, external_endpoint, globals.relay_connector_id, &cmd)) {
SWCLT_CMD_TYPE cmd_type;
@ -1215,7 +1217,8 @@ static void mod_signalwire_state_configure(void)
#endif
signalwire_provisioning_configure_response_t *configure_res;
#if SIGNALWIRE_CLIENT_C_VERSION_MAJOR >= 2
if (!SIGNALWIRE_PROVISIONING_CONFIGURE_RESPONSE_PARSE(reply->pool, reply->json, &configure_res)) {
result = ks_json_get_object_item(reply->json, "result");
if (!SIGNALWIRE_PROVISIONING_CONFIGURE_RESPONSE_PARSE(reply->pool, result, &configure_res)) {
#else
swclt_cmd_result(cmd, &result);
result = ks_json_get_object_item(result, "result");
@ -1223,7 +1226,7 @@ static void mod_signalwire_state_configure(void)
#endif
ks_json_t *configuration = configure_res->configuration;
#if SIGNALWIRE_CLIENT_C_VERSION_MAJOR >= 2
const char *configuration_profile = ks_json_get_string(configuration, "profile");
const char *configuration_profile = ks_json_get_object_string(configuration, "profile", NULL);
#else
const char *configuration_profile = ks_json_get_object_cstr(configuration, "profile");
#endif
@ -1231,6 +1234,7 @@ static void mod_signalwire_state_configure(void)
switch_xml_free(globals.signalwire_profile);
globals.signalwire_profile = NULL;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\"%s\"\n", configuration_profile);
globals.signalwire_profile = switch_xml_parse_str_dynamic((char *)configuration_profile, SWITCH_TRUE);
if (!globals.signalwire_profile) {

View File

@ -130,6 +130,7 @@ static void translate_number(char *number, char *profile, char **translated, swi
hi = switch_core_hash_find_rdlock(globals.translate_profiles, (const char *)profile, globals.profile_hash_rwlock);
if (!hi) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "can't find key for profile matching [%s]\n", profile);
return;
}
@ -142,6 +143,7 @@ static void translate_number(char *number, char *profile, char **translated, swi
switch_regex_safe_free(re);
goto end;
}
memset(substituted, 0, len);
switch_perform_substitution(re, proceed, rule->replace, number, substituted, len, ovector);
@ -153,16 +155,21 @@ static void translate_number(char *number, char *profile, char **translated, swi
} else if (event) {
subbed = switch_event_expand_headers(event, substituted);
}
if (subbed != substituted) {
switch_safe_free(substituted);
}
if (session) {
substituted = switch_core_session_strdup(session, subbed);
} else {
substituted = switch_core_strdup(pool, subbed);
}
if (subbed != substituted) {
switch_safe_free(subbed);
}
switch_safe_free(subbed);
}
switch_regex_safe_free(re);
break;
}
}

View File

@ -645,7 +645,7 @@ static switch_status_t video_thread_callback(switch_core_session_t *session, swi
}
switch_img_from_raw(frame->img, patch_data, SWITCH_IMG_FMT_ARGB, frame->img->d_w, frame->img->d_h);
switch_img_from_raw(&frame->img, patch_data, SWITCH_IMG_FMT_ARGB, frame->img->d_w, frame->img->d_h);
switch_img_free(&img);

View File

@ -47,7 +47,7 @@ extern int switch_amr_array_lshift(uint8_t lshift, uint8_t *buf, int a_len)
if (!buf || !a_len)
return (-1);
if ((lshift < 0) || (lshift > 8))
if (lshift > 8)
return (-1);
first_byte = 0xFF >> lshift;

View File

@ -817,6 +817,7 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
int fec = 0, plc = 0;
int32_t frame_size = 0, last_frame_size = 0;
uint32_t frame_samples;
uint8_t buf[SWITCH_RTP_MAX_BUF_LEN];
if (!context) {
return SWITCH_STATUS_FALSE;
@ -842,7 +843,6 @@ static switch_status_t switch_opus_decode(switch_codec_t *codec,
}
if (codec->cur_frame && (jb = switch_core_session_get_jb(session, SWITCH_MEDIA_TYPE_AUDIO))) {
switch_frame_t frame = { 0 };
uint8_t buf[SWITCH_RTP_MAX_BUF_LEN];
uint32_t ts = 0;
uint16_t seq = 0;
@ -1105,7 +1105,7 @@ static switch_status_t switch_opus_keep_fec_enabled(switch_codec_t *codec)
uint32_t LBRR_threshold_bitrate,LBRR_rate_thres_bps,real_target_bitrate ;
opus_int32 a32,b32;
uint32_t fs = context->enc_frame_size * 1000 / (codec->implementation->microseconds_per_packet / 1000);
float frame_rate =(float)(1000 / (codec->implementation->microseconds_per_packet / 1000));
float frame_rate =(float)(1000 / (float)(codec->implementation->microseconds_per_packet / 1000));
uint32_t step = (codec->implementation->microseconds_per_packet / 1000) != 60 ? 8000 / (codec->implementation->microseconds_per_packet / 1000 ) : 134 ;
opus_encoder_ctl(context->encoder_object, OPUS_GET_BITRATE(&current_bitrate));

View File

@ -629,6 +629,8 @@ done:
error:
pgsql_free_result(&result);
return SWITCH_STATUS_FALSE;
}

View File

@ -142,6 +142,7 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt)
if (!caller_profile || zstr(caller_profile->destination_number)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Obtaining Profile!\n");
return NULL;
}
@ -150,6 +151,7 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt)
if (!switch_config_open_file(&cfg, cf)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return NULL;
}
@ -226,12 +228,14 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt)
}
} else {
if (pattern && strcasecmp(pattern, field_data)) {
switch_safe_free(field_expanded);
continue;
}
}
if (cid) {
if (strcasecmp(cid, caller_profile->caller_id_number)) {
switch_safe_free(field_expanded);
continue;
}
}
@ -266,15 +270,19 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt)
switch_perform_substitution(re, proceed, argument, field_data, substituted, sizeof(substituted), ovector);
argument = substituted;
}
switch_regex_safe_free(re);
if (!extension) {
if (zstr(field_data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No extension!\n");
switch_safe_free(field_expanded);
break;
}
if ((extension = switch_caller_extension_new(session, field_data, field_data)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
switch_safe_free(field_expanded);
break;
}
}

View File

@ -23,7 +23,7 @@ if HAVE_STIRSHAKEN
test_test_sofia_funcs_CFLAGS += -DHAVE_STIRSHAKEN
endif
test_test_sofia_funcs_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) $(STIRSHAKEN_LIBS)
test_test_sofia_funcs_LDADD = libsofiamod.la $(SOFIA_SIP_LIBS)
test_test_sofia_funcs_LDADD = libsofiamod.la $(SOFIA_SIP_LIBS) $(STIRSHAKEN_LIBS)
test_test_nuafail_SOURCES = test/test_nuafail.c
test_test_nuafail_CFLAGS = $(AM_CFLAGS) $(SOFIA_SIP_CFLAGS) $(STIRSHAKEN_CFLAGS) -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\"

View File

@ -2065,7 +2065,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), SIPTAG_PAYLOAD_STR(message), TAG_END());
} else if (update_allowed && ua && (switch_stristr("polycom", ua) ||
} else if (update_allowed && ua && (switch_channel_var_true(tech_pvt->channel, "update_ignore_ua") ||
switch_stristr("polycom", ua) ||
(switch_stristr("aastra", ua) && !switch_stristr("Intelligate", ua)) ||
(switch_stristr("cisco/spa50", ua) ||
switch_stristr("cisco/spa525", ua)) ||
@ -4667,7 +4668,7 @@ static switch_status_t sofia_manage(char *relative_oid, switch_management_action
return SWITCH_STATUS_SUCCESS;
}
static int protect_dest_uri(switch_caller_profile_t *cp)
int protect_dest_uri(switch_caller_profile_t *cp)
{
char *p = cp->destination_number, *o = p;
char *q = NULL, *e = NULL, *qenc = NULL;

View File

@ -815,8 +815,12 @@ sres_record_t ** dig_addr_simple(struct dig *dig,
uint16_t type)
{
sres_record_t **answers = NULL;
int error;
sres_blocking_query(dig->sres, type, host, 0, &answers);
error = sres_blocking_query(dig->sres, type, host, 0, &answers);
if (error < 0) {
return NULL;
}
return answers;
}

View File

@ -2949,6 +2949,9 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread
sofia_set_pflag_locked(profile, PFLAG_WORKER_RUNNING);
/* Seed PRNG for functions within worker thread */
srand((unsigned)((intptr_t) switch_thread_self() + switch_micro_time_now()));
while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING))) {
if (tick) {
@ -11484,6 +11487,16 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
}
}
if (sip->sip_identity) {
sip_identity_t *id;
for (id = sip->sip_identity; id; id = id->id_next) {
if (!zstr(id->id_value)) {
switch_channel_add_variable_var_check(channel, "sip_identity", id->id_value, SWITCH_FALSE, SWITCH_STACK_PUSH);
}
}
}
if (sip->sip_identity && sip->sip_identity->id_value) {
switch_channel_set_variable(channel, "sip_h_identity", sip->sip_identity->id_value);
}

View File

@ -446,14 +446,16 @@ void sofia_glue_store_session_id(switch_core_session_t *session, sofia_profile_t
a_id = switch_strip_whitespace(duped);
if (zstr(a_id)) return;
if (zstr(a_id)) {
goto end;
}
p = strchr(a_id, ';');
if (p) *p = '\0';
if (!sofia_glue_is_valid_session_uuid(a_id)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Session-ID: Ignoring \"%s\" parsed as \"%s\"\n", header, a_id);
return;
goto end;
}
/* RFC7329 compatibility */
@ -483,7 +485,7 @@ void sofia_glue_store_session_id(switch_core_session_t *session, sofia_profile_t
if (!p) {
switch_channel_set_flag(channel, CF_RFC7329_COMPAT);
switch_channel_set_flag_partner(channel, CF_RFC7329_COMPAT);
return;
goto end;
}
p++;
remote_param = strstr(p, "remote=");
@ -491,7 +493,7 @@ void sofia_glue_store_session_id(switch_core_session_t *session, sofia_profile_t
switch_channel_set_flag(channel, CF_RFC7329_COMPAT);
switch_channel_set_flag_partner(channel, CF_RFC7329_COMPAT);
sofia_glue_check_filter_generic_params(session, profile, p);
return;
goto end;
}
b_id = remote_param + 7;
if (!zstr(b_id) && strlen(b_id) == RFC7989_SESSION_UUID_LEN /*32*/) {
@ -503,6 +505,9 @@ void sofia_glue_store_session_id(switch_core_session_t *session, sofia_profile_t
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Session-ID: invalid uuid, ignored.\n");
}
end:
switch_safe_free(a_id);
}
/* add "Session-ID:" header */

View File

@ -399,6 +399,7 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
switch_safe_free(route_uri);
switch_safe_free(ffrom);
switch_safe_free(dup);
switch_safe_free(extra_headers);
if (profile) {
switch_thread_rwlock_unlock(profile->rwlock);
@ -3755,7 +3756,6 @@ void sofia_presence_handle_sip_i_subscribe(int status,
if ((sub_max_deviation_var = profile->sip_subscription_max_deviation)) {
int sub_deviation;
srand( (unsigned) ( (unsigned)(intptr_t)switch_thread_self() + switch_micro_time_now() ) );
/* random negative number between 0 and negative sub_max_deviation_var: */
sub_deviation = ( rand() % sub_max_deviation_var ) - sub_max_deviation_var;
if ( (exp_delta + sub_deviation) > 45 ) {

View File

@ -884,7 +884,6 @@ long sofia_reg_uniform_distribution(int max)
int result;
int range = max + 1;
srand((unsigned)((intptr_t) switch_thread_self() + switch_micro_time_now()));
result = (int)((double)rand() / (((double)RAND_MAX + (double)1) / range));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Generated random %ld, max is %d\n", (long) result, max);
@ -894,8 +893,7 @@ long sofia_reg_uniform_distribution(int max)
void sofia_reg_check_ping_expire(sofia_profile_t *profile, time_t now, int interval)
{
char *sql;
int mean = interval / 2;
long next, irand;
long next;
char buf[32] = "";
int count;
@ -952,8 +950,7 @@ void sofia_reg_check_ping_expire(sofia_profile_t *profile, time_t now, int inter
/* only update if needed */
if (count) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "Updating ping expires for profile %s\n", profile->name);
irand = mean + sofia_reg_uniform_distribution(interval);
next = (long) now + irand;
next = (long) now + interval;
sql = switch_mprintf("update sip_registrations set ping_expires = %ld where hostname='%q' and profile_name='%q' and ping_expires <= %ld ",
next, mod_sofia_globals.hostname, profile->name, (long) now);
@ -1765,7 +1762,6 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
(( exp_max_deviation_var = profile->sip_expires_max_deviation )) ) {
if (exp_max_deviation_var > 0) {
int exp_deviation;
srand( (unsigned) ( (unsigned)(intptr_t)switch_thread_self() + switch_micro_time_now() ) );
/* random number between negative exp_max_deviation_var and positive exp_max_deviation_var: */
exp_deviation = ( rand() % ( exp_max_deviation_var * 2 ) ) - exp_max_deviation_var;
exptime += exp_deviation;
@ -2013,23 +2009,26 @@ uint8_t sofia_reg_handle_register_token(nua_t *nua, sofia_profile_t *profile, nu
sql = switch_mprintf("insert into sip_registrations "
"(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires,"
"user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm,"
"mwi_user,mwi_host, orig_server_host, orig_hostname, sub_host, ping_status, ping_count, force_ping) "
"values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q', '%q', '%q','%q','%q','%q','%q','%q','%q','%q', '%q', %d, %d)",
"mwi_user,mwi_host, orig_server_host, orig_hostname, sub_host, ping_status, ping_count, ping_expires, force_ping) "
"values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q', '%q', '%q','%q','%q','%q','%q','%q','%q','%q', '%q', %d, %ld, %d)",
call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : "",
contact_str, reg_desc, rpid, (long) reg_time + (long) exptime + profile->sip_expires_late_margin,
agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm,
mwi_user, mwi_host, guess_ip4, mod_sofia_globals.hostname, sub_host, "Reachable", 0, force_ping);
mwi_user, mwi_host, guess_ip4, mod_sofia_globals.hostname, sub_host, "Reachable", 0,
(long) switch_epoch_time_now(NULL) + sofia_reg_uniform_distribution(profile->iping_seconds), force_ping);
} else {
sql = switch_mprintf("update sip_registrations set call_id='%q',"
"sub_host='%q', network_ip='%q',network_port='%q',"
"presence_hosts='%q', server_host='%q', orig_server_host='%q',"
"hostname='%q', orig_hostname='%q',"
"expires = %ld, force_ping=%d where sip_user='%q' and sip_username='%q' and sip_host='%q' and contact='%q'",
"expires = %ld, ping_expires=%ld, force_ping=%d "
"where sip_user='%q' and sip_username='%q' and sip_host='%q' and contact='%q'",
call_id, sub_host, network_ip, network_port_c,
profile->presence_hosts ? profile->presence_hosts : "", guess_ip4, guess_ip4,
mod_sofia_globals.hostname, mod_sofia_globals.hostname,
(long) reg_time + (long) exptime + profile->sip_expires_late_margin, force_ping,
to_user, username, reg_host, contact_str);
(long) reg_time + (long) exptime + profile->sip_expires_late_margin,
(long) switch_epoch_time_now(NULL) + sofia_reg_uniform_distribution(profile->iping_seconds),
force_ping, to_user, username, reg_host, contact_str);
}
if (sql) {

View File

@ -31,7 +31,8 @@
#include <switch.h>
#include <test/switch_test.h>
#include "../mod_sofia.c"
int protect_dest_uri(switch_caller_profile_t *cp);
static int timeout_sec = 10;
static switch_interval_time_t delay_start_ms = 5000;

View File

@ -86,6 +86,7 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
if ( setsockopt(handle->sock, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(one)) != 0 ) {
mcast_socket_close(handle);
return -1;
}
@ -103,11 +104,13 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
if (setsockopt(handle->sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (void *)&mreq, sizeof(mreq)) < 0) {
mcast_socket_close(handle);
return -1;
}
if (bind(handle->sock, (struct sockaddr *) &handle->recv_addr, sizeof(handle->recv_addr)) < 0) {
mcast_socket_close(handle);
return -1;
}
@ -124,7 +127,11 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
addr_criteria.ai_flags |= AI_NUMERICHOST;
snprintf(service, sizeof(service), "%d", port);
getaddrinfo(host, service, &addr_criteria, &mcast_addr);
if (getaddrinfo(host, service, &addr_criteria, &mcast_addr) != 0) {
mcast_socket_close(handle);
return -1;
}
memset(&handle->recv_addr6, 0, sizeof(handle->recv_addr6));
@ -134,11 +141,14 @@ int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle,
memcpy(&mreq.ipv6mr_multiaddr, &((struct sockaddr_in6 *)mcast_addr->ai_addr)->sin6_addr, sizeof(struct in6_addr));
freeaddrinfo(mcast_addr);
mreq.ipv6mr_interface = 0;
setsockopt(handle->sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, (const char *)&mreq, sizeof(mreq));
if (bind(handle->sock, (struct sockaddr *) &handle->recv_addr6, sizeof(handle->recv_addr6)) < 0) {
mcast_socket_close(handle);
return -1;
}
}

View File

@ -771,10 +771,6 @@ static void jsock_send_event(cJSON *event)
}
switch_thread_rwlock_unlock(verto_globals.event_channel_rwlock);
if (use_jsock) {
switch_thread_rwlock_unlock(use_jsock->rwlock);
use_jsock = NULL;
}
}
static jrpc_func_t jrpc_get_func(jsock_t *jsock, const char *method)
@ -1069,7 +1065,7 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
const char *use_passwd = NULL, *verto_context = NULL, *verto_dialplan = NULL;
time_t now = switch_epoch_time_now(NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Login sucessful for user: %s domain: %s\n", id, domain ? domain : "N/A");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Login sucessful for user: %s domain: %s\n", id, domain);
jsock->logintime = now;
jsock->id = switch_core_strdup(jsock->pool, id);
@ -1970,6 +1966,7 @@ static void client_run(jsock_t *jsock)
{
int flags = KWS_BLOCK;
int idle = 0;
ks_json_t *params = NULL;
if (jsock->profile->vhosts) {
flags |= KWS_STAY_OPEN;
@ -1977,7 +1974,14 @@ static void client_run(jsock_t *jsock)
}
ks_pool_open(&jsock->kpool);
#if defined(KS_VERSION_NUM) && KS_VERSION_NUM >= 20000
params = ks_json_create_object();
ks_json_add_number_to_object(params, "payload_size_max", 1000000);
if (kws_init_ex(&jsock->ws, jsock->client_socket, (jsock->ptype & PTYPE_CLIENT_SSL) ? jsock->profile->ssl_ctx : NULL, 0, flags, jsock->kpool, params) != KS_STATUS_SUCCESS) {
#else
if (kws_init(&jsock->ws, jsock->client_socket, (jsock->ptype & PTYPE_CLIENT_SSL) ? jsock->profile->ssl_ctx : NULL, 0, flags, jsock->kpool) != KS_STATUS_SUCCESS) {
#endif
log_and_exit(SWITCH_LOG_NOTICE, "%s WS SETUP FAILED\n", jsock->name);
}
@ -2123,6 +2127,8 @@ static void client_run(jsock_t *jsock)
detach_jsock(jsock);
kws_destroy(&jsock->ws);
ks_pool_close(&jsock->kpool);
ks_json_delete(&params);
return;
}
@ -6769,6 +6775,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_verto_load)
ks_ssl_init_skip(KS_TRUE);
ks_init();
#if defined(KS_VERSION_NUM) && KS_VERSION_NUM < 20000
kws_set_global_payload_size_max(1000000);
#endif
if (switch_event_reserve_subclass(MY_EVENT_LOGIN) != SWITCH_STATUS_SUCCESS) {
ks_shutdown();
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_LOGIN);

View File

@ -70,6 +70,11 @@
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>AMQP_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

View File

@ -101,6 +101,11 @@ typedef struct mod_amqp_keypart_s {
int size;
} mod_amqp_keypart_t;
typedef struct {
switch_event_types_t id;
char* subclass;
} mod_amqp_events_t;
typedef struct {
char *name;
@ -117,7 +122,7 @@ typedef struct {
/* Array to store the possible event subscriptions */
int event_subscriptions;
switch_event_node_t *event_nodes[SWITCH_EVENT_ALL];
switch_event_types_t event_ids[SWITCH_EVENT_ALL];
mod_amqp_events_t events[SWITCH_EVENT_ALL];
switch_event_node_t *eventNode;

View File

@ -397,6 +397,7 @@ switch_status_t mod_amqp_connection_create(mod_amqp_connection_t **conn, switch_
new_con->ssl_verify_peer = ssl_verify_peer;
*conn = new_con;
return SWITCH_STATUS_SUCCESS;
}

View File

@ -186,7 +186,8 @@ switch_status_t mod_amqp_producer_create(char *name, switch_xml_t cfg)
profile->name = switch_core_strdup(profile->pool, name);
profile->running = 1;
memset(profile->format_fields, 0, (MAX_ROUTING_KEY_FORMAT_FIELDS + 1) * sizeof(mod_amqp_keypart_t));
profile->event_ids[0] = SWITCH_EVENT_ALL;
profile->events[0].id = SWITCH_EVENT_ALL;
profile->events[0].subclass = SWITCH_EVENT_SUBCLASS_ANY;
profile->event_subscriptions = 1;
profile->conn_root = NULL;
profile->conn_active = NULL;
@ -269,7 +270,14 @@ switch_status_t mod_amqp_producer_create(char *name, switch_xml_t cfg)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Found %d subscriptions\n", profile->event_subscriptions);
for (arg = 0; arg < profile->event_subscriptions; arg++) {
if (switch_name_event(argv[arg], &(profile->event_ids[arg])) != SWITCH_STATUS_SUCCESS) {
char *subclass = SWITCH_EVENT_SUBCLASS_ANY;
if ((subclass = strchr(argv[arg], '^'))) {
*subclass++ = '\0';
}
if (switch_name_event(argv[arg], &(profile->events[arg].id)) == SWITCH_STATUS_SUCCESS) {
profile->events[arg].subclass = subclass;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "The switch event %s was not recognised.\n", argv[arg]);
}
}
@ -344,13 +352,13 @@ switch_status_t mod_amqp_producer_create(char *name, switch_xml_t cfg)
/* Subscribe events */
for (i = 0; i < profile->event_subscriptions; i++) {
if (switch_event_bind_removable("AMQP",
profile->event_ids[i],
SWITCH_EVENT_SUBCLASS_ANY,
profile->events[i].id,
profile->events[i].subclass,
mod_amqp_producer_event_handler,
profile,
&(profile->event_nodes[i])) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind to event handler %d!\n",(int)profile->event_ids[i]);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind to event handler %d!\n",(int)profile->events[i].id);
goto err;
}
}

View File

@ -1998,7 +1998,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_erlang_event_runtime)
struct ei_cnode_s ec;
ErlConnect conn;
int clientfd;
switch_os_socket_t epmdfd;
switch_os_socket_t epmdfd = SWITCH_SOCK_INVALID;
switch_socket_t *epmd_sock = NULL;
if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {

View File

@ -153,16 +153,18 @@ static switch_status_t load_config(switch_xml_t input_cfg)
}
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
char *val_no_whitespace = switch_strip_whitespace(val);
if (!strcasecmp(var, "address")) {
set_global_dst_addrs(switch_strip_whitespace(val));
set_global_dst_addrs(val_no_whitespace);
} else if (!strcasecmp(var, "source_address")) {
set_global_src_addr(switch_strip_whitespace(val));
set_global_src_addr(val_no_whitespace);
} else if (!strcasecmp(var, "source_address_ipv6")) {
set_global_src_addr6(switch_strip_whitespace(val));
set_global_src_addr6(val_no_whitespace);
} else if (!strcasecmp(var, "bindings")) {
set_global_bindings(val);
} else if (!strcasecmp(var, "port")) {
@ -183,6 +185,8 @@ static switch_status_t load_config(switch_xml_t input_cfg)
} else if (!strcasecmp(var, "loopback")) {
globals.loopback = switch_true(val);
}
switch_safe_free(val_no_whitespace);
}
}
@ -190,6 +194,7 @@ static switch_status_t load_config(switch_xml_t input_cfg)
if (globals.bindings) {
for (cur = globals.bindings; cur; count++) {
switch_event_types_t type;
@ -293,13 +298,13 @@ static switch_status_t initialize_sockets(switch_xml_t input_cfg)
char *host_string;
char ipv6_first_octet[3];
memset(&globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr, 0, sizeof(dst_sockaddr_t));
if (globals.num_dst_addrs > MAX_DST_HOSTS) {
if (globals.num_dst_addrs >= MAX_DST_HOSTS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot add destination address: %s, exceeded maximum of %d\n", dst_hosts[i], MAX_DST_HOSTS);
continue;
}
memset(&globals.dst_sockaddrs[globals.num_dst_addrs], 0, sizeof(dst_sockaddr_t));
if (switch_sockaddr_info_get(&globals.dst_sockaddrs[globals.num_dst_addrs].sockaddr, dst_hosts[i], SWITCH_UNSPEC, globals.port, 0, module_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find address: %s\n", dst_hosts[i]);
switch_goto_status(SWITCH_STATUS_TERM, fail);
@ -627,8 +632,8 @@ static void event_handler(switch_event_t *event)
len = strlen(packet) + strlen((char *) MAGIC);
#endif
buf = malloc(len + 1);
memset(buf, 0, len + 1);
switch_assert(buf);
memset(buf, 0, len + 1);
#ifdef HAVE_OPENSSL
if (globals.psk) {
@ -777,7 +782,11 @@ static switch_status_t process_packet(char* packet, size_t len)
switch_url_decode(val);
switch_snprintf(tmpname, sizeof(tmpname), "Orig-%s", var);
switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, tmpname, val);
var = term + 1;
if (term) {
var = term + 1;
} else {
var = NULL;
}
} else {
/* This should be our magic packet, done processing incoming headers */
break;

View File

@ -564,13 +564,16 @@ switch_status_t kazoo_config_fetch_handler(kazoo_config_ptr definitions, kazoo_c
switch_memory_pool_t *pool = NULL;
char *name = (char *) switch_xml_attr_soft(cfg, "name");
if (zstr(name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "missing name in profile\n");
return SWITCH_STATUS_GENERR;
}
if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error allocation pool for new profile : %s\n", name);
return SWITCH_STATUS_GENERR;
}
@ -582,6 +585,7 @@ switch_status_t kazoo_config_fetch_handler(kazoo_config_ptr definitions, kazoo_c
fetch_section = switch_xml_parse_section_string(name);
if ((params = switch_xml_child(cfg, "params")) != NULL) {
for (param = switch_xml_child(params, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
@ -605,7 +609,9 @@ switch_status_t kazoo_config_fetch_handler(kazoo_config_ptr definitions, kazoo_c
}
if (fetch_section == SWITCH_XML_SECTION_RESULT) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Fetch Profile[%s] invalid fetch-section: %s\n", name, switch_xml_toxml(cfg, SWITCH_FALSE));
char *tmp = switch_xml_toxml(cfg, SWITCH_FALSE);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Fetch Profile[%s] invalid fetch-section: %s\n", name, tmp);
free(tmp);
goto err;
}
@ -622,17 +628,20 @@ switch_status_t kazoo_config_fetch_handler(kazoo_config_ptr definitions, kazoo_c
}
}
if(ptr)
if (ptr) {
*ptr = profile;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "fetch handler profile %s successfully configured\n", name);
return SWITCH_STATUS_SUCCESS;
err:
/* Cleanup */
if(pool) {
switch_core_destroy_memory_pool(&pool);
}
if(pool) {
switch_core_destroy_memory_pool(&pool);
}
return SWITCH_STATUS_GENERR;
}

View File

@ -233,9 +233,11 @@ cJSON * kazoo_event_add_field_to_json(cJSON *dst, switch_event_t *src, kazoo_fie
} else if((header = switch_event_get_header_ptr(src, field->name)) != NULL) {
if (header->idx) {
item = cJSON_CreateArray();
for(i = 0; i < header->idx; i++) {
cJSON_AddItemToArray(item, kazoo_event_json_value(field->out_type, header->array[i]));
}
kazoo_cJSON_AddItemToObject(dst, field->as ? field->as : field->name, item);
} else if (field->out_type_as_array) {
item = cJSON_CreateArray();
@ -251,13 +253,16 @@ cJSON * kazoo_event_add_field_to_json(cJSON *dst, switch_event_t *src, kazoo_fie
expanded = kz_event_expand_headers(src, field->value);
if(expanded != NULL && !zstr(expanded)) {
item = kazoo_event_add_json_value(dst, field, field->as ? field->as : field->name, expanded);
if(expanded != field->value) {
free(expanded);
}
}
if (expanded != field->value) {
switch_safe_free(expanded);
}
break;
case FIELD_FIRST_OF:
for(n = 0; n < field->list.size; n++) {
if(*field->list.value[n] == '#') {
item = kazoo_event_add_json_value(dst, field, field->as ? field->as : field->name, ++field->list.value[n]);
@ -267,33 +272,41 @@ cJSON * kazoo_event_add_field_to_json(cJSON *dst, switch_event_t *src, kazoo_fie
if(header) {
if (header->idx) {
item = cJSON_CreateArray();
for(i = 0; i < header->idx; i++) {
cJSON_AddItemToArray(item, kazoo_event_json_value(field->out_type, header->array[i]));
}
kazoo_cJSON_AddItemToObject(dst, field->as ? field->as : field->name, item);
} else {
item = kazoo_event_add_json_value(dst, field, field->as ? field->as : field->name, header->value);
}
break;
}
}
}
break;
case FIELD_PREFIX:
for (header = src->headers; header; header = header->next) {
if(!strncmp(header->name, field->name, strlen(field->name))) {
if (header->idx) {
cJSON *array = cJSON_CreateArray();
for(i = 0; i < header->idx; i++) {
cJSON_AddItemToArray(array, kazoo_event_json_value(field->out_type, header->array[i]));
}
kazoo_cJSON_AddItemToObject(dst, field->exclude_prefix ? header->name+strlen(field->name) : header->name, array);
} else {
kazoo_event_add_json_value(dst, field, field->exclude_prefix ? header->name+strlen(field->name) : header->name, header->value);
}
}
}
break;
case FIELD_STATIC:
@ -308,7 +321,7 @@ cJSON * kazoo_event_add_field_to_json(cJSON *dst, switch_event_t *src, kazoo_fie
break;
}
return item;
return item;
}
static switch_status_t kazoo_event_add_fields_to_json(kazoo_logging_ptr logging, cJSON *dst, switch_event_t *src, kazoo_field_ptr field) {

View File

@ -1097,23 +1097,27 @@ static switch_status_t handle_request_fetch_reply(ei_node_t *ei_node, erlang_pid
if (ei_decode_atom_safe(buf->buff, &buf->index, section_str)
|| !(section = switch_xml_parse_section_string(section_str))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Ignoring a fetch reply without a configuration section\n");
return erlang_response_badarg(rbuf);
}
if (ei_decode_string_or_binary_limited(buf->buff, &buf->index, sizeof(uuid_str), uuid_str)
|| zstr_buf(uuid_str)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Ignoring a fetch reply without request UUID\n");
return erlang_response_badarg(rbuf);
}
if (ei_decode_string_or_binary(buf->buff, &buf->index, &xml_str)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Ignoring a fetch reply without XML : %s \n", uuid_str);
return erlang_response_badarg(rbuf);
}
if (zstr(xml_str)) {
switch_safe_free(xml_str);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Ignoring an empty fetch reply : %s\n", uuid_str);
return erlang_response_badarg(rbuf);
}
@ -1138,13 +1142,19 @@ static switch_status_t handle_request_fetch_reply(ei_node_t *ei_node, erlang_pid
break;
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received fetch reply %s for an unknown configuration section: %s : %s\n", uuid_str, section_str, xml_str);
switch_safe_free(xml_str);
return erlang_response_badarg(rbuf);
}
if (result == SWITCH_STATUS_SUCCESS) {
switch_safe_free(xml_str);
return erlang_response_ok(rbuf);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received fetch reply %s is unknown or has expired : %s\n", uuid_str, xml_str);
switch_safe_free(xml_str);
return erlang_response_baduuid(rbuf);
}
}

View File

@ -166,8 +166,10 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
if (channel) {
const char *disable_flag = switch_channel_get_variable(channel, "disable_radius_start");
if (switch_true(disable_flag)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Not Sending RADIUS Start\n");
return SWITCH_STATUS_SUCCESS;
}
}
@ -250,6 +252,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
goto end;
}
}
if (profile->caller_id_number) {
if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *) profile->caller_id_number, -1, PW_FS_PEC) == NULL) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
@ -257,6 +260,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
goto end;
}
}
if (profile->caller_id_name) {
if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *) profile->caller_id_name, -1, PW_FS_PEC) == NULL) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
@ -264,6 +268,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
goto end;
}
}
if (profile->destination_number) {
if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *) profile->destination_number, -1, PW_FS_PEC) == NULL) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Dst: %s\n", profile->destination_number);
@ -271,6 +276,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
goto end;
}
}
if (profile->dialplan) {
if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *) profile->dialplan, -1, PW_FS_PEC) == NULL) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan);
@ -278,6 +284,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
goto end;
}
}
if (profile->network_addr) {
inet_pton(AF_INET, (void *) profile->network_addr, &framed_addr);
framed_addr = htonl(framed_addr);
@ -287,6 +294,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
goto end;
}
}
if (profile->rdnis) {
if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *) profile->rdnis, -1, PW_FS_PEC) == NULL) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis);
@ -294,6 +302,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
goto end;
}
}
if (profile->context) {
if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *) profile->context, -1, PW_FS_PEC) == NULL) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Context: %s\n", profile->context);
@ -301,6 +310,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
goto end;
}
}
if (profile->ani) {
if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *) profile->ani, -1, PW_FS_PEC) == NULL) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-ANI: %s\n", profile->ani);
@ -308,6 +318,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
goto end;
}
}
if (profile->aniii) {
if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *) profile->aniii, -1, PW_FS_PEC) == NULL) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-ANIII: %s\n", profile->aniii);
@ -315,6 +326,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
goto end;
}
}
if (profile->source) {
if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *) profile->source, -1, PW_FS_PEC) == NULL) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Source: %s\n", profile->source);
@ -322,6 +334,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
goto end;
}
}
if (callstartdate > 0) {
switch_time_exp_tz(&tm, callstartdate, requested_tm.tm_gmtoff);
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
@ -380,25 +393,33 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
}
if (radius_avpair) {
char *radius_avpair_data_tmp = NULL;
radius_avpair_data = strdup(radius_avpair + (strncmp(radius_avpair, "ARRAY::", 7) ? 0 : 7));
radius_avpair_data_tmp = radius_avpair_data;
do {
delim = strstr(radius_avpair_data, "|:");
delim = strstr(radius_avpair_data_tmp, "|:");
if (delim) {
*delim = '\0';
}
if (rc_avpair_add(rad_config, &send, PW_FS_AVPAIR, (void *) radius_avpair_data, -1, PW_FS_PEC) == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-AVPair: %s\n", radius_avpair_data);
if (rc_avpair_add(rad_config, &send, PW_FS_AVPAIR, (void *)radius_avpair_data_tmp, -1, PW_FS_PEC) == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-AVPair: %s\n", radius_avpair_data_tmp);
rc_destroy(rad_config);
switch_safe_free(radius_avpair_data);
goto end;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "added Freeswitch-AVPair: %s\n", radius_avpair_data);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "added Freeswitch-AVPair: %s\n", radius_avpair_data_tmp);
if (delim) {
radius_avpair_data = delim + 2;
radius_avpair_data_tmp = delim + 2;
}
} while (delim);
switch_safe_free(radius_avpair_data);
}
} else {
@ -413,11 +434,13 @@ static switch_status_t my_on_routing(switch_core_session_t *session)
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] RADIUS Accounting Failed\n");
retval = SWITCH_STATUS_TERM;
}
rc_avpair_free(send);
rc_destroy(rad_config);
end:
switch_xml_free(cdr);
switch_thread_rwlock_unlock(globals.rwlock);
return (retval);
}

View File

@ -4765,7 +4765,7 @@ static void send_console_command(struct rayo_client *client, const char *to, con
iks *command = NULL;
iksparser *p = iks_dom_new(&command);
if (iks_parse(p, command_str, 0, 1) == IKS_OK && command) {
if (p && iks_parse(p, command_str, 0, 1) == IKS_OK && command) {
char *str;
iks *iq = NULL;
@ -4784,9 +4784,11 @@ static void send_console_command(struct rayo_client *client, const char *to, con
if (!iks_find_attrib(iq, "type")) {
iks_insert_attrib(iq, "type", "set");
}
if (!iks_find_attrib(iq, "id")) {
iks_insert_attrib_printf(iq, "id", "console-%i", RAYO_SEQ_NEXT(client));
}
iks_insert_attrib(iq, "from", RAYO_JID(client));
/* send command */
@ -4794,10 +4796,13 @@ static void send_console_command(struct rayo_client *client, const char *to, con
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\nSEND: to %s, %s\n", to, str);
rayo_client_command_recv(client, iq);
iks_delete(command);
iks_parser_delete(p);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "bad request xml\n");
if (p) {
iks_parser_delete(p);
}
}
iks_parser_delete(p);
}
/**

View File

@ -384,10 +384,11 @@ static switch_status_t read_page(pdf_file_context_t *context)
if (ret == MagickFalse && context->exception->severity != UndefinedException) {
CatchException(context->exception);
free(storage);
return SWITCH_STATUS_FALSE;
}
switch_img_from_raw(context->img, storage, SWITCH_IMG_FMT_BGR24, w, h);
switch_img_from_raw(&context->img, storage, SWITCH_IMG_FMT_BGR24, w, h);
free(storage);
} else {
switch_image_t *img = switch_img_alloc(NULL, SWITCH_IMG_FMT_ARGB, image->columns, image->rows, 0);
@ -397,6 +398,8 @@ static switch_status_t read_page(pdf_file_context_t *context)
if (ret == MagickFalse && context->exception->severity != UndefinedException) {
CatchException(context->exception);
switch_img_free(&img);
return SWITCH_STATUS_FALSE;
}

View File

@ -295,6 +295,7 @@ static switch_status_t switch_opusfile_open(switch_file_handle_t *handle, const
context->of = op_open_file(path, &ret);
if (!context->of) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[OGG/OPUS File] Error opening %s\n", path);
switch_thread_rwlock_unlock(context->rwlock);
return SWITCH_STATUS_GENERR;
}
@ -653,6 +654,7 @@ static switch_status_t switch_opusstream_stream_decode(opus_stream_context_t *co
}
switch_goto_status(SWITCH_STATUS_SUCCESS, end);
}
break;
case OP_EREAD: /*An underlying read operation failed. This may signal a truncation attack from an <https:> source.*/
case OP_EFAULT: /* An internal memory allocation failed. */

View File

@ -189,169 +189,163 @@ SWITCH_STANDARD_APP(java_function)
static switch_status_t load_config(JavaVMOption **javaOptions, int *optionCount, vm_control_t * vmControl)
{
switch_xml_t cfg, xml;
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_xml_t cfg, xml;
switch_status_t status = SWITCH_STATUS_SUCCESS;
char *derr = NULL;
xml = switch_xml_open_cfg("java.conf", &cfg, NULL);
if (xml)
{
switch_xml_t javavm;
switch_xml_t options;
switch_xml_t startup;
switch_xml_t shutdown;
xml = switch_xml_open_cfg("java.conf", &cfg, NULL);
if (xml) {
switch_xml_t javavm;
switch_xml_t options;
switch_xml_t startup;
switch_xml_t shutdown;
javavm = switch_xml_child(cfg, "javavm");
if (javavm != NULL)
{
const char *path = switch_xml_attr_soft(javavm, "path");
if (path != NULL)
{
javavm = switch_xml_child(cfg, "javavm");
if (javavm != NULL) {
const char *path = switch_xml_attr_soft(javavm, "path");
if (path != NULL) {
javaVMHandle = switch_dso_open(path, 0, &derr);
if (derr || !javaVMHandle) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error loading %s\n", path);
switch_safe_free(derr);
}
}
else
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Java VM path specified in java.conf.xml\n");
status = SWITCH_STATUS_FALSE;
}
}
else
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Java VM specified in java.conf.xml\n");
status = SWITCH_STATUS_FALSE;
goto close;
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Java VM path specified in java.conf.xml\n");
status = SWITCH_STATUS_FALSE;
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Java VM specified in java.conf.xml\n");
status = SWITCH_STATUS_FALSE;
goto close;
}
options = switch_xml_child(cfg, "options");
if (options != NULL) {
switch_xml_t option;
int i = 0;
*optionCount = 0;
for (option = switch_xml_child(options, "option"); option; option = option->next) {
const char *value = switch_xml_attr_soft(option, "value");
if (value != NULL) {
++*optionCount;
}
}
*optionCount += 1;
*javaOptions = switch_core_alloc(memoryPool, (switch_size_t)(*optionCount * sizeof(JavaVMOption)));
if (*javaOptions == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
status = SWITCH_STATUS_FALSE;
goto close;
}
for (option = switch_xml_child(options, "option"); option; option = option->next) {
const char *value = switch_xml_attr_soft(option, "value");
if (value == NULL) {
continue;
}
(*javaOptions)[i].optionString = switch_core_strdup(memoryPool, value);
if ((*javaOptions)[i].optionString == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
status = SWITCH_STATUS_FALSE;
goto close;
}
++i;
}
options = switch_xml_child(cfg, "options");
if (options != NULL)
{
switch_xml_t option;
int i = 0;
*optionCount = 0;
for (option = switch_xml_child(options, "option"); option; option = option->next)
{
const char *value = switch_xml_attr_soft(option, "value");
if (value != NULL)
++*optionCount;
}
*optionCount += 1;
*javaOptions = switch_core_alloc(memoryPool, (switch_size_t)(*optionCount * sizeof(JavaVMOption)));
if (*javaOptions == NULL)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
status = SWITCH_STATUS_FALSE;
goto close;
}
for (option = switch_xml_child(options, "option"); option; option = option->next)
{
const char *value = switch_xml_attr_soft(option, "value");
if (value == NULL)
continue;
(*javaOptions)[i].optionString = switch_core_strdup(memoryPool, value);
if ((*javaOptions)[i].optionString == NULL)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
status = SWITCH_STATUS_FALSE;
goto close;
}
++i;
}
(*javaOptions)[i].optionString = switch_core_sprintf(memoryPool, "-Djava.library.path=%s", SWITCH_GLOBAL_dirs.mod_dir);
}
}
/*
<startup class="net/cog/fs/system/Control" method="startup" arg="start up arg"/>
<shutdown class="net/cog/fs/system/Control" method="shutdown" arg="shutdown arg"/>
*/
/*
<startup class="net/cog/fs/system/Control" method="startup" arg="start up arg"/>
<shutdown class="net/cog/fs/system/Control" method="shutdown" arg="shutdown arg"/>
*/
memset(vmControl, 0, sizeof(struct vm_control));
startup = switch_xml_child(cfg, "startup");
if (startup != NULL) {
vmControl->startup.class = switch_xml_attr_soft(startup, "class");
vmControl->startup.method = switch_xml_attr_soft(startup, "method");
vmControl->startup.arg = switch_xml_attr_soft(startup, "arg");
}
shutdown = switch_xml_child(cfg, "shutdown");
if (shutdown != NULL) {
vmControl->shutdown.class = switch_xml_attr_soft(shutdown, "class");
vmControl->shutdown.method = switch_xml_attr_soft(shutdown, "method");
vmControl->shutdown.arg = switch_xml_attr_soft(shutdown, "arg");
}
memset(vmControl, 0, sizeof(struct vm_control));
startup = switch_xml_child(cfg, "startup");
if (startup != NULL) {
vmControl->startup.class = switch_xml_attr_soft(startup, "class");
vmControl->startup.method = switch_xml_attr_soft(startup, "method");
vmControl->startup.arg = switch_xml_attr_soft(startup, "arg");
}
close:
switch_xml_free(xml);
}
else
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening java.conf.xml\n");
status = SWITCH_STATUS_FALSE;
}
return status;
shutdown = switch_xml_child(cfg, "shutdown");
if (shutdown != NULL) {
vmControl->shutdown.class = switch_xml_attr_soft(shutdown, "class");
vmControl->shutdown.method = switch_xml_attr_soft(shutdown, "method");
vmControl->shutdown.arg = switch_xml_attr_soft(shutdown, "arg");
}
close:
switch_xml_free(xml);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening java.conf.xml\n");
status = SWITCH_STATUS_FALSE;
}
return status;
}
static switch_status_t create_java_vm(JavaVMOption *options, int optionCount, vm_control_t * vmControl)
{
jint (JNICALL *pJNI_CreateJavaVM)(JavaVM**,void**,void*);
switch_status_t status;
jint (JNICALL *pJNI_CreateJavaVM)(JavaVM**,void**,void*);
switch_status_t status;
char *derr = NULL;
pJNI_CreateJavaVM = (jint (*)(JavaVM **, void **, void *))switch_dso_func_sym(javaVMHandle, "JNI_CreateJavaVM", &derr);
if (!derr)
{
JNIEnv *env;
JavaVMInitArgs initArgs;
jint res;
if (!derr) {
JNIEnv *env;
JavaVMInitArgs initArgs;
jint res;
memset(&initArgs, 0, sizeof(initArgs));
initArgs.version = JNI_VERSION_1_4;
initArgs.nOptions = optionCount;
initArgs.options = options;
initArgs.ignoreUnrecognized = JNI_TRUE;
memset(&initArgs, 0, sizeof(initArgs));
initArgs.version = JNI_VERSION_1_4;
initArgs.nOptions = optionCount;
initArgs.options = options;
initArgs.ignoreUnrecognized = JNI_TRUE;
res = pJNI_CreateJavaVM(&javaVM, (void*) &env, &initArgs);
if (res == JNI_OK)
{
// call FindClass here already so that the Java VM executes the static
// initializer (@see org.freeswitch.Launcher) which loads the jni library
// so we can use jni functions right away (for example in the startup method)
launcherClass = (*env)->FindClass(env, "org/freeswitch/Launcher");
if ( launcherClass == NULL )
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to find 'org.freeswitch.Launcher' class!\n");
(*env)->ExceptionDescribe(env);
}
res = pJNI_CreateJavaVM(&javaVM, (void*) &env, &initArgs);
if (res == JNI_OK) {
/* call FindClass here already so that the Java VM executes the static
initializer (@see org.freeswitch.Launcher) which loads the jni library
so we can use jni functions right away (for example in the startup method) */
// store a global reference for use in the launch_java() function
launcherClass = (*env)->NewGlobalRef(env, launcherClass);
if ( launcherClass == NULL )
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
(*env)->ExceptionDescribe(env);
status = SWITCH_STATUS_FALSE;
}
else
{
status = SWITCH_STATUS_SUCCESS;
}
launcherClass = (*env)->FindClass(env, "org/freeswitch/Launcher");
if ( launcherClass == NULL ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to find 'org.freeswitch.Launcher' class!\n");
(*env)->ExceptionDescribe(env);
}
(*javaVM)->DetachCurrentThread(javaVM);
}
else
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating Java VM!\n");
status = SWITCH_STATUS_FALSE;
}
}
else
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Specified Java VM doesn't have JNI_CreateJavaVM\n");
status = SWITCH_STATUS_FALSE;
}
return status;
/* store a global reference for use in the launch_java() function */
launcherClass = (*env)->NewGlobalRef(env, launcherClass);
if ( launcherClass == NULL ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
(*env)->ExceptionDescribe(env);
status = SWITCH_STATUS_FALSE;
} else {
status = SWITCH_STATUS_SUCCESS;
}
(*javaVM)->DetachCurrentThread(javaVM);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating Java VM!\n");
status = SWITCH_STATUS_FALSE;
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Specified Java VM doesn't have JNI_CreateJavaVM\n");
switch_safe_free(derr);
status = SWITCH_STATUS_FALSE;
}
return status;
}
SWITCH_MODULE_LOAD_FUNCTION(mod_java_load)

View File

@ -39405,6 +39405,24 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_event_add_header_stri
}
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_event_add_header_string_nodup___(void * jarg1, int jarg2, char * jarg3, char * jarg4) {
int jresult ;
switch_event_t *arg1 = (switch_event_t *) 0 ;
switch_stack_t arg2 ;
char *arg3 = (char *) 0 ;
char *arg4 = (char *) 0 ;
switch_status_t result;
arg1 = (switch_event_t *)jarg1;
arg2 = (switch_stack_t)jarg2;
arg3 = (char *)jarg3;
arg4 = (char *)jarg4;
result = (switch_status_t)switch_event_add_header_string_nodup(arg1,arg2,(char const *)arg3,(char const *)arg4);
jresult = (int)result;
return jresult;
}
SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_event_del_header_val___(void * jarg1, char * jarg2, char * jarg3) {
int jresult ;
switch_event_t *arg1 = (switch_event_t *) 0 ;

File diff suppressed because it is too large Load Diff

View File

@ -354,12 +354,24 @@ static switch_xml_t python_fetch(const char *section,
switch_xml_t xml = NULL;
char *str = NULL;
switch_event_t *my_params = NULL;
if (!zstr(globals.xml_handler)) {
char *mycmd = strdup(globals.xml_handler);
switch_assert(mycmd);
if (!params) {
switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
switch_assert(params);
my_params = params;
}
switch_event_add_header_string(params, SWITCH_STACK_TOP, "section", switch_str_nil(section));
switch_event_add_header_string(params, SWITCH_STACK_TOP, "tag_name", switch_str_nil(tag_name));
switch_event_add_header_string(params, SWITCH_STACK_TOP, "key_name", switch_str_nil(key_name));
switch_event_add_header_string(params, SWITCH_STACK_TOP, "key_value", switch_str_nil(key_value));
eval_some_python("xml_fetch", mycmd, NULL, NULL, params, &str, NULL);
if (str) {
@ -372,6 +384,10 @@ static switch_xml_t python_fetch(const char *section,
}
free(mycmd);
if (my_params) {
switch_event_destroy(&my_params);
}
}
return xml;

View File

@ -169,6 +169,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(FetchURLHash)
} else {
/* The var exists, but is wrong type - exit with error */
info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Second argument is the name of an existing var of the wrong type"));
return;
}
} else if (info.Length() > 1 && info[1]->IsArray()) {
@ -177,6 +178,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(FetchURLHash)
} else if (info.Length() > 1) {
/* The var exists, but is wrong type - exit with error */
info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Second argument is of the wrong type"));
return;
} else {
/* Second argument doesn't exist, this is also ok. The hash will be returned as the result */
@ -185,6 +187,11 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(FetchURLHash)
}
curl_handle = switch_curl_easy_init();
if (!curl_handle) {
info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Failed to initiate curl easy session."));
return;
}
if (!strncasecmp(js_safe_str(*url), "https", 5)) {
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
@ -224,14 +231,22 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(FetchURLFile)
const char *url = NULL, *filename = NULL;
String::Utf8Value str1(info[0]);
String::Utf8Value str2(info[1]);
url = js_safe_str(*str1);
filename = js_safe_str(*str2);
curl_handle = switch_curl_easy_init();
if (!curl_handle) {
info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Failed to initiate curl easy session."));
return;
}
if (!strncasecmp(url, "https", 5)) {
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
}
config_data.isolate = info.GetIsolate();
if ((config_data.fileHandle = open(filename, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
@ -245,13 +260,14 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(FetchURLFile)
switch_curl_easy_perform(curl_handle);
switch_curl_easy_cleanup(curl_handle);
close(config_data.fileHandle);
info.GetReturnValue().Set(true);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open file [%s]\n", filename);
info.GetReturnValue().Set(false);
}
switch_curl_easy_cleanup(curl_handle);
} else {
info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Invalid arguments"));
}
@ -270,12 +286,19 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(FetchURL)
if (info.Length() >= 1) {
const char *url;
String::Utf8Value str(info[0]);
url = js_safe_str(*str);
if (info.Length() > 1) {
buffer_size = info[1]->Int32Value();
}
curl_handle = switch_curl_easy_init();
if (!curl_handle) {
info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Failed to initiate curl easy session."));
return;
}
if (!strncasecmp(url, "https", 5)) {
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
@ -289,6 +312,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(FetchURL)
if (config_data.buffer == NULL) {
info.GetIsolate()->ThrowException(String::NewFromUtf8(info.GetIsolate(), "Failed to allocate data buffer."));
switch_curl_easy_cleanup(curl_handle);
return;
}

View File

@ -196,7 +196,7 @@ static switch_status_t en_say_general_count(switch_say_file_handle_t *sh, char *
static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args)
{
int32_t t = 0;
int64_t t = 0;
switch_time_t target = 0, target_now = 0;
switch_time_exp_t tm, tm_now;
uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0;
@ -287,7 +287,7 @@ static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, sw
if (strchr(tosay, ':')) {
switch_time_t tme = switch_str_time(tosay);
t = (int32_t) ((tme) / (int64_t) (1000000));
t = (int64_t) ((tme) / (int64_t) (1000000));
target = switch_time_make(t, 0);
target_now = switch_micro_time_now();

View File

@ -141,6 +141,7 @@ static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data)
static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
void *user_data)
{
switch_event_t *my_params = NULL;
char filename[512] = "";
switch_CURL *curl_handle = NULL;
switch_CURLcode cc;
@ -185,6 +186,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
if (!params) {
switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
switch_assert(params);
my_params = params;
}
switch_event_add_header_string(params, SWITCH_STACK_TOP, "hostname", hostname);
@ -208,13 +210,6 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
switch_uuid_format(uuid_str, &uuid);
switch_snprintf(filename, sizeof(filename), "%s%s%s.tmp.xml", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, uuid_str);
curl_handle = switch_curl_easy_init();
headers = switch_curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
if (!strncasecmp(binding->url, "https", 5)) {
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
}
memset(&config_data, 0, sizeof(config_data));
@ -222,6 +217,14 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
config_data.max_bytes = binding->curl_max_bytes;
if ((config_data.fd = open(filename, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
curl_handle = switch_curl_easy_init();
headers = switch_curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
if (!strncasecmp(binding->url, "https", 5)) {
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
}
if (!zstr(binding->cred)) {
switch_curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, binding->auth_scheme);
switch_curl_easy_setopt(curl_handle, CURLOPT_USERPWD, binding->cred);
@ -333,6 +336,11 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
switch_safe_free(uri);
if (binding->use_dynamic_url && dynamic_url != binding->url)
switch_safe_free(dynamic_url);
if (my_params) {
switch_event_destroy(&my_params);
}
return xml;
}

View File

@ -614,7 +614,7 @@ abyss_bool websocket_hook(TSession *r)
if (ret != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "handshake error %d\n", ret);
return FALSE;
goto err;
}
if (switch_event_bind_removable("websocket", SWITCH_EVENT_CUSTOM, "websocket::stophook", stop_hook_event_handler, wsh, &nodes[node_count++]) != SWITCH_STATUS_SUCCESS) {
@ -696,8 +696,11 @@ abyss_bool websocket_hook(TSession *r)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "wsh->down = %d, node_count = %d\n", wsh->down, node_count);
switch_yield(2000);
while (--node_count >= 0) switch_event_unbind(&nodes[node_count]);
err:
ws_destroy(wsh);
switch_safe_free(wsh);
return FALSE;

View File

@ -176,6 +176,10 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
if (bytes > XML_SCGI_MAX_BYTES) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Data too big!\n");
len = -1;
if (expanded != (char*)buf) {
free(expanded);
}
break;
}

View File

@ -147,7 +147,7 @@ static void check_ip(void)
} else if (strcmp(hostname, runtime.hostname)) {
if (switch_event_create(&event, SWITCH_EVENT_TRAP) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "condition", "hostname-change");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "old-hostname", hostname ? hostname : "nil");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "old-hostname", hostname);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "new-hostname", runtime.hostname);
switch_event_fire(&event);
}
@ -3009,7 +3009,7 @@ SWITCH_DECLARE(switch_bool_t) switch_core_ready_outbound(void)
return (switch_test_flag((&runtime), SCF_SHUTTING_DOWN) || switch_test_flag((&runtime), SCF_NO_NEW_OUTBOUND_SESSIONS)) ? SWITCH_FALSE : SWITCH_TRUE;
}
void switch_core_sqldb_destroy()
void switch_core_sqldb_destroy(void)
{
if (switch_test_flag((&runtime), SCF_USE_SQL)) {
switch_core_sqldb_stop();

View File

@ -3057,7 +3057,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
uint32_t codec_ms = (int) (engine->read_frame.timestamp -
engine->last_ts) / (engine->read_impl.samples_per_second / 1000);
if (engine->last_seq && (int) (engine->read_frame.seq - engine->last_seq) > 1) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[%s]: Correcting calculated ptime value from [%d] to [%d] to compensate for [%d] lost packet(s). \n", is_vbr?"VBR":"CBR", codec_ms, codec_ms / (int) (engine->read_frame.seq - engine->last_seq), (int) (engine->read_frame.seq - engine->last_seq - 1));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[CBR]: Correcting calculated ptime value from [%d] to [%d] to compensate for [%d] lost packet(s). \n", codec_ms, codec_ms / (int) (engine->read_frame.seq - engine->last_seq), (int) (engine->read_frame.seq - engine->last_seq - 1));
codec_ms = codec_ms / (int) (engine->read_frame.seq - engine->last_seq);
}
@ -3080,9 +3080,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
if (codec_ms > 120) { /* yeah right */
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
"[%s]: Your phone is trying to send timestamps that suggest an increment of %dms per packet\n"
"[CBR]: Your phone is trying to send timestamps that suggest an increment of %dms per packet\n"
"That seems hard to believe so I am going to go on ahead and um ignore that, mmkay?\n",
is_vbr?"VBR":"CBR",
(int) codec_ms);
engine->check_frames = MAX_CODEC_CHECK_FRAMES;
goto skip;
@ -3092,8 +3091,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
if (codec_ms != engine->cur_payload_map->codec_ms) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
"[%s]: Asynchronous PTIME not supported, changing our end from %d to %d\n",
is_vbr?"VBR":"CBR",
"[CBR]: Asynchronous PTIME not supported, changing our end from %d to %d\n",
(int) engine->cur_payload_map->codec_ms,
(int) codec_ms
);
@ -3123,7 +3121,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
engine->last_ts) / (engine->read_impl.samples_per_second / 1000);
if (engine->last_seq && (int) (engine->read_frame.seq - engine->last_seq) > 1) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[%s]: Correcting calculated ptime value from [%d] to [%d] to compensate for [%d] lost packet(s)\n", is_vbr?"VBR":"CBR", codec_ms, codec_ms / (int) (engine->read_frame.seq - engine->last_seq), (int) (engine->read_frame.seq - engine->last_seq - 1));
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[VBR]: Correcting calculated ptime value from [%d] to [%d] to compensate for [%d] lost packet(s)\n", codec_ms, codec_ms / (int) (engine->read_frame.seq - engine->last_seq), (int) (engine->read_frame.seq - engine->last_seq - 1));
codec_ms = codec_ms / (int) (engine->read_frame.seq - engine->last_seq);
}
@ -3142,8 +3140,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
if (codec_ms > 120) {
/*will show too many times with packet loss*/
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG3,
"[%s]: Remote party is trying to send timestamps that suggest an increment of [%d] ms per packet, which is too high. Ignoring.\n",
is_vbr?"VBR":"CBR",
"[VBR]: Remote party is trying to send timestamps that suggest an increment of [%d] ms per packet, which is too high. Ignoring.\n",
(int) codec_ms);
engine->last_ts = engine->read_frame.timestamp;
engine->last_seq = engine->read_frame.seq;
@ -3152,8 +3149,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session
if (codec_ms != engine->cur_payload_map->codec_ms) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
"[%s]: Packet size change detected. Remote PTIME changed from [%d] to [%d]\n",
is_vbr?"VBR":"CBR",
"[VBR]: Packet size change detected. Remote PTIME changed from [%d] to [%d]\n",
(int) engine->cur_payload_map->codec_ms,
(int) codec_ms
);
@ -6676,10 +6672,6 @@ SWITCH_DECLARE(void) switch_core_session_write_blank_video(switch_core_session_t
if (!height) height = 288;
if (!fps) fps = 15;
if (!(width && height && fps)) {
return;
}
fr.packet = buf;
fr.packetlen = buflen;
fr.data = buf + 12;
@ -12443,7 +12435,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_media_params(switch_core_sessi
*val++ = '\0';
}
if (name && val) {
if (val) {
if (!strcmp(name, "aspect")) {
aspect = val;
vid++;
@ -15864,7 +15856,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
if (!(switch_core_codec_ready(session->write_codec) && switch_core_codec_ready(frame->codec))) goto error;
if ((session->write_codec && frame->codec && session->write_codec->implementation != frame->codec->implementation)) {
if (frame->codec && session->write_codec->implementation != frame->codec->implementation) {
if (session->write_impl.codec_id == frame->codec->implementation->codec_id ||
session->write_impl.microseconds_per_packet != frame->codec->implementation->microseconds_per_packet) {
ptime_mismatch = TRUE;

View File

@ -2380,11 +2380,6 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_
int32_t sps = 0;
if (use_uuid && switch_core_hash_find(session_manager.session_table, use_uuid)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Duplicate UUID!\n");
return NULL;
}
if (direction == SWITCH_CALL_DIRECTION_INBOUND && !switch_core_ready_inbound()) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "The system cannot create any inbound sessions at this time.\n");
return NULL;
@ -2406,6 +2401,15 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_
PROTECT_INTERFACE(endpoint_interface);
switch_mutex_lock(runtime.session_hash_mutex);
if (use_uuid && switch_core_hash_find(session_manager.session_table, use_uuid)) {
switch_mutex_unlock(runtime.session_hash_mutex);
UNPROTECT_INTERFACE(endpoint_interface);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Duplicate UUID!\n");
return NULL;
}
if (!(originate_flags & SOF_NO_LIMITS)) {
switch_mutex_lock(runtime.throttle_mutex);
count = session_manager.session_count;
@ -2413,12 +2417,14 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_
switch_mutex_unlock(runtime.throttle_mutex);
if (sps <= 0) {
switch_mutex_unlock(runtime.session_hash_mutex);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Throttle Error! %d\n", session_manager.session_count);
UNPROTECT_INTERFACE(endpoint_interface);
return NULL;
}
if ((count + 1) > session_manager.session_limit) {
switch_mutex_unlock(runtime.session_hash_mutex);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Limit! %d\n", session_manager.session_limit);
UNPROTECT_INTERFACE(endpoint_interface);
return NULL;
@ -2490,7 +2496,6 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_
switch_queue_create(&session->private_event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
switch_queue_create(&session->private_event_queue_pri, SWITCH_EVENT_QUEUE_LEN, session->pool);
switch_mutex_lock(runtime.session_hash_mutex);
switch_core_hash_insert(session_manager.session_table, session->uuid_str, session);
session->id = session_manager.session_id++;
session_manager.session_count++;
@ -3000,7 +3005,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_se
{
char *dp[25];
char *dpstr;
int argc, x, count = 0;
int argc, x;
uint32_t stack_count = 0;
switch_caller_profile_t *profile, *new_profile, *pp = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
@ -3054,8 +3059,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_se
continue;
}
count++;
extension = dialplan_interface->hunt_function(session, dparg, new_profile);
UNPROTECT_INTERFACE(dialplan_interface);

View File

@ -3181,6 +3181,8 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName
if (!(ep = switch_loadable_module_get_endpoint_interface(argv[0]))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "EP ERROR\n");
switch_xml_free(xml);
return 0;
}

View File

@ -3521,11 +3521,18 @@ SWITCH_DECLARE(switch_status_t) switch_img_to_raw(switch_image_t *src, void *des
#endif
}
SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t *dest, void *src, switch_img_fmt_t fmt, int width, int height)
SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t **destP, void *src, switch_img_fmt_t fmt, int width, int height)
{
#ifdef SWITCH_HAVE_YUV
uint32_t fourcc;
int ret = -1;
switch_image_t *dest = NULL;
if (!destP) {
return SWITCH_STATUS_FALSE;
}
dest = *destP;
fourcc = switch_img_fmt2fourcc(fmt);
@ -3574,6 +3581,8 @@ SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t *dest, void *
0, fourcc);
}
*destP = dest;
return ret == 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
#else
return SWITCH_STATUS_FALSE;
@ -3586,10 +3595,12 @@ SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_ima
switch_image_t *dest = NULL;
int ret = 0;
if (destP) {
dest = *destP;
if (!destP) {
return SWITCH_STATUS_FALSE;
}
dest = *destP;
switch_assert(width > 0);
switch_assert(height > 0);
@ -3615,15 +3626,13 @@ SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_ima
kFilterBox);
}
*destP = dest;
if (ret != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Scaling Error: ret: %d\n", ret);
return SWITCH_STATUS_FALSE;
}
if (destP) {
*destP = dest;
}
return SWITCH_STATUS_SUCCESS;
#else
return SWITCH_STATUS_FALSE;
@ -3637,10 +3646,12 @@ SWITCH_DECLARE(switch_status_t) switch_img_mirror(switch_image_t *src, switch_im
switch_image_t *dest = NULL;
int ret = 0;
if (destP) {
dest = *destP;
if (!destP) {
return SWITCH_STATUS_FALSE;
}
dest = *destP;
if (dest && src->fmt != dest->fmt) switch_img_free(&dest);
if (!dest) dest = switch_img_alloc(NULL, src->fmt, src->d_w, src->d_h, 1);
@ -3660,15 +3671,13 @@ SWITCH_DECLARE(switch_status_t) switch_img_mirror(switch_image_t *src, switch_im
}
*destP = dest;
if (ret != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Mirror Error: ret: %d\n", ret);
return SWITCH_STATUS_FALSE;
}
if (destP) {
*destP = dest;
}
return SWITCH_STATUS_SUCCESS;
#else
return SWITCH_STATUS_FALSE;

View File

@ -1909,6 +1909,8 @@ SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const ch
data = (char *) malloc(2048);
if (!data) {
va_end(ap);
switch_xml_free(xml);
return NULL;
}
ret = vsnprintf(data, 2048, fmt, ap);
@ -1918,6 +1920,8 @@ SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const ch
#ifndef HAVE_VASPRINTF
free(data);
#endif
switch_xml_free(xml);
return NULL;
}
}

View File

@ -546,6 +546,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *
}
if (dmachine->pinging) {
switch_mutex_unlock(dmachine->mutex);
return SWITCH_STATUS_BREAK;
}
@ -2129,7 +2130,7 @@ static switch_bool_t eavesdrop_callback(switch_media_bug_t *bug, void *user_data
break;
}
if (ep->eavesdropper && switch_core_session_read_lock(ep->eavesdropper) == SWITCH_STATUS_SUCCESS) {
if (switch_core_session_read_lock(ep->eavesdropper) == SWITCH_STATUS_SUCCESS) {
if (switch_core_session_write_video_frame(ep->eavesdropper, bug->video_ping_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error writing video to %s\n", switch_core_session_get_name(ep->eavesdropper));
ep->errs++;
@ -2177,10 +2178,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_pop_eavesdropper(switch_cor
struct eavesdrop_pvt *ep = (struct eavesdrop_pvt *) switch_core_media_bug_get_user_data(bug);
if (ep && ep->eavesdropper && ep->eavesdropper != session) {
switch_core_session_read_lock(ep->eavesdropper);
*sessionp = ep->eavesdropper;
switch_core_media_bug_set_flag(bug, SMBF_PRUNE);
status = SWITCH_STATUS_SUCCESS;
if (switch_core_session_read_lock(ep->eavesdropper) == SWITCH_STATUS_SUCCESS) {
*sessionp = ep->eavesdropper;
switch_core_media_bug_set_flag(bug, SMBF_PRUNE);
status = SWITCH_STATUS_SUCCESS;
}
}
}

View File

@ -237,7 +237,7 @@ static void video_bridge_thread(switch_core_session_t *session, void *obj)
continue;
}
if (switch_channel_media_up(b_channel)) {
if (read_frame && switch_channel_media_up(b_channel)) {
if (switch_core_session_write_video_frame(vh->session_b, read_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
switch_cond_next();
continue;

View File

@ -909,6 +909,9 @@ static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map
return -1;
}
wrote = teletone_mux_tones(ts, map);
if (wrote <= 0) {
return -1;
}
if (tto->channels != 1) {
if (tto->mux_buflen < wrote * 2 * tto->channels) {
@ -3215,6 +3218,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
l_session = NULL;
}
switch_channel_set_variable(oglobals.originate_status[i].peer_channel, "originate_endpoint", chan_type);
switch_channel_execute_on(oglobals.originate_status[i].peer_channel, SWITCH_CHANNEL_EXECUTE_ON_ORIGINATE_VARIABLE);
switch_channel_api_on(oglobals.originate_status[i].peer_channel, SWITCH_CHANNEL_API_ON_ORIGINATE_VARIABLE);
}

View File

@ -506,7 +506,7 @@ static switch_status_t switch_nat_add_mapping_upnp(switch_port_t port, switch_na
if (r == UPNPCOMMAND_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mapped public port %s protocol %s to localport %s\n", port_str,
(proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str);
(proto == SWITCH_NAT_TCP) ? "TCP" : "UDP", port_str);
status = SWITCH_STATUS_SUCCESS;
}
@ -566,7 +566,7 @@ static switch_status_t switch_nat_del_mapping_upnp(switch_port_t port, switch_na
if (r == UPNPCOMMAND_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %s protocol %s to localport %s\n", port_str,
(proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str);
(proto == SWITCH_NAT_TCP) ? "TCP" : "UDP", port_str);
status = SWITCH_STATUS_SUCCESS;
}
return status;

View File

@ -160,8 +160,6 @@ SWITCH_DECLARE(switch_status_t) switch_packetizer_feed_extradata(switch_packetiz
p += 5;
left -= 5;
if (left < 0) return SWITCH_STATUS_FALSE;
//sps
n_sps = *p & 0x1f;
p += 1;

View File

@ -1277,7 +1277,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
}
if (ice->ice_params && ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].cand_type &&
if (ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].cand_type &&
!strcasecmp(ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].cand_type, "relay")) {
do_adj++;
}
@ -1353,7 +1353,6 @@ SWITCH_DECLARE(void) switch_srtp_err_to_txt(srtp_err_status_t stat, char **msg)
else if (stat == srtp_err_status_read_fail) *msg="couldn't read data";
else if (stat == srtp_err_status_write_fail) *msg="couldn't write data";
else if (stat == srtp_err_status_parse_err) *msg="error parsing data";
else if (stat == srtp_err_status_write_fail) *msg="couldn't read data";
else if (stat == srtp_err_status_encode_err) *msg="error encoding data";
else if (stat == srtp_err_status_semaphore_err) *msg="error while using semaphores";
else if (stat == srtp_err_status_pfkey_err) *msg="error while using pfkey ";
@ -3010,7 +3009,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_
rtp_session->dtls->sock_output = rtp_session->sock_output;
if (rtp_session->flags[SWITCH_RTP_FLAG_RTCP_MUX]) {
switch_sockaddr_info_get(&rtp_session->dtls->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool);
status = switch_sockaddr_info_get(&rtp_session->dtls->remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool);
}
}
@ -3529,9 +3528,13 @@ SWITCH_DECLARE(dtls_state_t) switch_rtp_dtls_state(switch_rtp_t *rtp_session, dt
{
dtls_state_t s = DS_OFF;
if (!rtp_session) {
return s;
}
switch_mutex_lock(rtp_session->ice_mutex);
if (!rtp_session || (!rtp_session->dtls && !rtp_session->rtcp_dtls)) {
if (!rtp_session->dtls && !rtp_session->rtcp_dtls) {
s = DS_OFF;
goto done;
}
@ -3556,9 +3559,13 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_del_dtls(switch_rtp_t *rtp_session, d
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
if (!rtp_session) {
return SWITCH_STATUS_FALSE;
}
switch_mutex_lock(rtp_session->ice_mutex);
if (!rtp_session || (!rtp_session->dtls && !rtp_session->rtcp_dtls)) {
if (!rtp_session->dtls && !rtp_session->rtcp_dtls) {
switch_goto_status(SWITCH_STATUS_FALSE, done);
}
@ -4764,11 +4771,12 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
if ((type & ICE_VANILLA)) {
switch_snprintf(ice_user, sizeof(ice_user), "%s:%s", login, rlogin);
switch_snprintf(user_ice, sizeof(user_ice), "%s:%s", rlogin, login);
switch_snprintf(luser_ice, sizeof(user_ice), "%s%s", rlogin, login);
switch_snprintf(luser_ice, sizeof(luser_ice), "%s%s", rlogin, login);
ice->ready = ice->rready = 0;
} else {
switch_snprintf(ice_user, sizeof(ice_user), "%s%s", login, rlogin);
switch_snprintf(user_ice, sizeof(user_ice), "%s%s", rlogin, login);
switch_snprintf(luser_ice, sizeof(luser_ice), "");
ice->ready = ice->rready = 1;
}
@ -4938,7 +4946,7 @@ SWITCH_DECLARE(void) switch_rtp_kill_socket(switch_rtp_t *rtp_session)
}
if (rtp_session->flags[SWITCH_RTP_FLAG_ENABLE_RTCP]) {
if (rtp_session->rtcp_sock_input && rtp_session->rtcp_sock_input != rtp_session->sock_input) {
if (rtp_session->sock_input && rtp_session->rtcp_sock_input && rtp_session->rtcp_sock_input != rtp_session->sock_input) {
ping_socket(rtp_session);
switch_socket_shutdown(rtp_session->rtcp_sock_input, SWITCH_SHUTDOWN_READWRITE);
}
@ -6966,13 +6974,10 @@ static void check_timeout(switch_rtp_t *rtp_session)
elapsed, rtp_session->media_timeout);
if (elapsed > rtp_session->media_timeout) {
if (rtp_session->session) {
switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session);
switch_channel_execute_on(channel, "execute_on_media_timeout");
switch_channel_hangup(channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
}
}
}

View File

@ -1243,15 +1243,17 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
if (runtime.sps <= 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Rate of %d!\n", runtime.sps_total);
}
/* These two mutexes must be held in exact order: session_hash_mutex and then throttle_mutex. See switch_core_session_request_uuid() */
switch_mutex_lock(runtime.session_hash_mutex);
switch_mutex_lock(runtime.throttle_mutex);
runtime.sps_last = runtime.sps_total - runtime.sps;
if (sps_interval_ticks >= 300) {
runtime.sps_peak_fivemin = 0;
sps_interval_ticks = 0;
switch_mutex_lock(runtime.session_hash_mutex);
/* This line is protected by runtime.session_hash_mutex */
runtime.sessions_peak_fivemin = session_manager.session_count;
switch_mutex_unlock(runtime.session_hash_mutex);
}
sps_interval_ticks++;
@ -1265,6 +1267,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime)
}
runtime.sps = runtime.sps_total;
switch_mutex_unlock(runtime.throttle_mutex);
switch_mutex_unlock(runtime.session_hash_mutex);
tick = 0;
}
#ifndef DISABLE_1MS_COND

View File

@ -1638,11 +1638,25 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file_simple(const char *file)
if ((fd = open(file, O_RDONLY, 0)) > -1) {
fstat(fd, &st);
if (!st.st_size) goto error;
if (!st.st_size) {
close(fd);
goto error;
}
m = switch_must_malloc(st.st_size);
if (!(0<(l = read(fd, m, st.st_size)))) goto error;
if (!(root = (switch_xml_root_t) switch_xml_parse_str((char *) m, l))) goto error;
if (!(0 < (l = read(fd, m, st.st_size)))) {
free(m);
close(fd);
goto error;
}
if (!(root = (switch_xml_root_t)switch_xml_parse_str((char*)m, l))) {
free(m);
close(fd);
goto error;
}
root->dynamic = 1;
close(fd);
return &root->xml;

View File

@ -457,7 +457,7 @@ SWITCH_DECLARE(void) switch_xml_config_cleanup(switch_xml_config_item_t *instruc
char **ptr = (char **) item->ptr;
switch_xml_config_string_options_t *string_options = (switch_xml_config_string_options_t *) item->data;
/* if (using_strdup) */
if (string_options && !string_options->pool && !string_options->length) {
if (!string_options || (!string_options->pool && !string_options->length)) {
switch_safe_free(*ptr);
}
}

View File

@ -95,6 +95,19 @@ FST_CORE_BEGIN("./conf")
FST_TEST_END()
#endif
FST_TEST_BEGIN(test_md5)
{
char digest[SWITCH_MD5_DIGEST_STRING_SIZE] = { 0 };
char test_string[] = "test";
switch_status_t status;
status = switch_md5_string(digest, (void *)test_string, strlen(test_string));
fst_check_int_equals(status, SWITCH_STATUS_SUCCESS);
fst_check_string_equals(digest, "098f6bcd4621d373cade4e832627b4f6");
}
FST_TEST_END()
FST_TEST_BEGIN(test_switch_event_add_header_leak)
{
switch_event_t* event;

View File

@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros">
<curlVersion>7.78.0</curlVersion>
<curlVersion>7.88.0</curlVersion>
</PropertyGroup>
<PropertyGroup>
<curlVersionImported>true</curlVersionImported>

View File

@ -4,7 +4,8 @@
<Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/>
</ImportGroup>
<PropertyGroup Label="UserMacros">
<libksVersion>1.8.0</libksVersion>
<libksVersion>1.8.2</libksVersion>
<libksBuildNumber>1</libksBuildNumber>
</PropertyGroup>
<PropertyGroup>
<libksVersionImported>true</libksVersionImported>

View File

@ -36,7 +36,7 @@
<Target Name="libksBinariesDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
<DownloadPackageTask
package="http://files.freeswitch.org/windows/packages/libks/$(libksVersion)/libks-$(libksVersion)-binaries-$(Platform.ToLower())-$(Configuration.ToLower()).zip"
package="http://files.freeswitch.org/windows/packages/libks/$(libksVersion)_$(libksBuildNumber)/libks-$(libksVersion)_$(libksBuildNumber)-binaries-$(Platform.ToLower())-$(Configuration.ToLower()).zip"
expectfileordirectory="$(libksDir)\binaries\$(Platform)\$(Configuration)\ks.dll"
outputfolder=""
outputfilename=""
@ -45,7 +45,7 @@
</Target>
<Target Name="libksHeadersDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
<DownloadPackageTask
package="http://files.freeswitch.org/windows/packages/libks/$(libksVersion)/libks-$(libksVersion)-headers.zip"
package="http://files.freeswitch.org/windows/packages/libks/$(libksVersion)_$(libksBuildNumber)/libks-$(libksVersion)_$(libksBuildNumber)-headers.zip"
expectfileordirectory="$(libksDir)\src\include\libks\ks.h"
outputfolder=""
outputfilename=""

View File

@ -4,7 +4,7 @@
<Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/>
</ImportGroup>
<PropertyGroup Label="UserMacros">
<libpqVersion>10.18</libpqVersion>
<libpqVersion>10.23</libpqVersion>
</PropertyGroup>
<PropertyGroup>
<libpqVersionImported>true</libpqVersionImported>

View File

@ -4,7 +4,7 @@
<Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/>
</ImportGroup>
<PropertyGroup Label="UserMacros">
<OpenSSLVersion>1.1.1l</OpenSSLVersion>
<OpenSSLVersion>1.1.1t</OpenSSLVersion>
<OpenSSLLibDir>$(BaseDir)libs\openssl-$(OpenSSLVersion)</OpenSSLLibDir>
</PropertyGroup>
<PropertyGroup>

View File

@ -68,7 +68,7 @@
<AdditionalIncludeDirectories>$(OpenSSLLibDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='Win32'">$(OpenSSLLibDir)\include_x86;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Platform)'=='x64'">$(OpenSSLLibDir)\include_x64;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>OPENSSL;HAVE_OPENSSL;HAVE_OPENSSL_DTLS_SRTP;HAVE_OPENSSL_DTLS;HAVE_OPENSSL_DTLSv1_2_method;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>HAVE_LIBCRYPTO;OPENSSL;HAVE_OPENSSL;HAVE_OPENSSL_DTLS_SRTP;HAVE_OPENSSL_DTLS;HAVE_OPENSSL_DTLSv1_2_method;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>$(OpenSSLLibDir)\binaries\$(Platform)\$(LibraryConfiguration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>

View File

@ -4,7 +4,7 @@
<Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/>
</ImportGroup>
<PropertyGroup Label="UserMacros">
<rabbitmq_cVersion>0.11.0</rabbitmq_cVersion>
<rabbitmq_cVersion>0.13.0</rabbitmq_cVersion>
</PropertyGroup>
<PropertyGroup>
<rabbitmq_cVersionImported>true</rabbitmq_cVersionImported>

View File

@ -4,7 +4,8 @@
<Import Project="basedir.props" Condition=" '$(BaseDirImported)' == ''"/>
</ImportGroup>
<PropertyGroup Label="UserMacros">
<signalwire-client-cVersion>1.3.0</signalwire-client-cVersion>
<signalwire-client-cVersion>1.3.2</signalwire-client-cVersion>
<signalwire-client-cBuildNumber>1</signalwire-client-cBuildNumber>
</PropertyGroup>
<PropertyGroup>
<signalwire-client-cVersionImported>true</signalwire-client-cVersionImported>

View File

@ -34,7 +34,7 @@
<Target Name="signalwire-client-cBinariesDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
<DownloadPackageTask
package="http://files.freeswitch.org/windows/packages/signalwire-client-c/$(signalwire-client-cVersion)/signalwire-client-c-$(signalwire-client-cVersion)-binaries-$(Platform.ToLower())-$(Configuration.ToLower()).zip"
package="http://files.freeswitch.org/windows/packages/signalwire-client-c/$(signalwire-client-cVersion)_$(signalwire-client-cBuildNumber)/signalwire-client-c-$(signalwire-client-cVersion)_$(signalwire-client-cBuildNumber)-binaries-$(Platform.ToLower())-$(Configuration.ToLower()).zip"
expectfileordirectory="$(signalwire-client-cDir)\binaries\$(Platform)\$(Configuration)\signalwire_client.dll"
outputfolder=""
outputfilename=""
@ -43,7 +43,7 @@
</Target>
<Target Name="signalwire-client-cHeadersDownloadTarget" BeforeTargets="CustomBuild" DependsOnTargets="7za">
<DownloadPackageTask
package="http://files.freeswitch.org/windows/packages/signalwire-client-c/$(signalwire-client-cVersion)/signalwire-client-c-$(signalwire-client-cVersion)-headers.zip"
package="http://files.freeswitch.org/windows/packages/signalwire-client-c/$(signalwire-client-cVersion)_$(signalwire-client-cBuildNumber)/signalwire-client-c-$(signalwire-client-cVersion)_$(signalwire-client-cBuildNumber)-headers.zip"
expectfileordirectory="$(signalwire-client-cDir)\include\signalwire-client-c\client.h"
outputfolder=""
outputfilename=""