Merge branch 'master' of git://git.freeswitch.org/freeswitch

This commit is contained in:
Seven Du 2014-03-12 09:40:59 +08:00
commit 60bb1602d2
36 changed files with 206 additions and 87 deletions

3
.gitignore vendored
View File

@ -214,6 +214,9 @@ ipch/
/src/mod/languages/mod_managed/Win32/Debug_CLR/mod_managed.*.log
/src/mod/languages/mod_managed/Win32/Release_CLR/mod_managed.*.log
/src/.dirstamp
/src/mod/languages/mod_v8/src/.dirstamp
libs/libsndfile/Scripts/build-test-tarball.mk
libs/libsndfile/doc/libsndfile.css
libs/libsndfile/echo-install-dirs

View File

@ -139,7 +139,7 @@ endif
if HAVE_LIBEDIT
CORE_CFLAGS += -I$(switch_srcdir)/libs/libedit/src -DSWITCH_HAVE_LIBEDIT
CORE_LIBS += libs/libedit/src/.libs/libedit.a $(TINFO_LIBS)
CORE_LIBS += libs/libedit/src/.libs/libedit.a
endif
if ENABLE_TIMERFD_WRAPPER
@ -159,6 +159,10 @@ libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_LDF
libfreeswitch_la_LIBADD = $(CORE_LIBS) $(APR_LIBS) $(PLATFORM_CORE_LIBS)
libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES)
if HAVE_LIBEDIT
libfreeswitch_la_LIBADD += $(TINFO_LIBS)
endif
if HAVE_ODBC
libfreeswitch_la_LDFLAGS += $(ODBC_LIB_FLAGS)
endif

View File

@ -2,6 +2,9 @@ AUTOMAKE_OPTIONS = foreign subdir-objects
AM_CFLAGS = $(SWITCH_AM_CFLAGS) $(SWITCH_ANSI_CFLAGS)
AM_CPPFLAGS = $(SWITCH_AM_CXXFLAGS)
AM_LDFLAGS = $(SWITCH_AM_LDFLAGS)
DEFAULT_VARS = CFLAGS="$(CFLAGS)" CPPFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CC="$(CC)" CXX="$(CXX)"
DEFAULT_ARGS = --build=$(build) --host=$(host) --target=$(target) --prefix="$(prefix)" --exec_prefix="$(exec_prefix)" --libdir="$(libdir)" --disable-shared --with-pic
#we should set all these vars from configure, no reason to have these in each Makefile.am
LIBTOOL = echo "`link=\`echo $@|grep .la;echo $@|grep .so;echo $@|grep .dll\`;if test -n "$$link"; then echo Creating $@;fi`";`if test -z "$(VERBOSE)" ; \
then echo $(SHELL) $(switch_builddir)/quiet_libtool ;else echo $(SHELL) $(switch_builddir)/libtool; fi`

7
libs/.gitignore vendored
View File

@ -19,6 +19,11 @@ opal
*_manifest.rc
*.pc
*/.dirstamp
*/*/.dirstamp
*/*/*/.dirstamp
*/*/*/*/.dirstamp
/*.tar.*
/*/*.dSYM/
@ -978,6 +983,8 @@ opal
/yaml/tests/run-parser
/yaml/tests/run-scanner
/broadvoice/broadvoice.spec
/zeromq-*/
/jpeg-8d/
/v8-*/

View File

@ -1,4 +1,4 @@
#! /bin/sh
srcpath=$(dirname $0 2>/dev/null ) || srcpath="."
$srcpath/configure "$@" --with-apr=../apr --without-sqlite2 --without-sqlite3 --with-expat=builtin
$srcpath/configure "$@" --with-apr=../apr --disable-shared --with-pic --without-sqlite2 --without-sqlite3 --with-expat=builtin

View File

@ -1 +1 @@
Thu Mar 6 00:30:51 CDT 2014
Tue Mar 11 18:16:09 CDT 2014

View File

@ -11176,7 +11176,6 @@ nta_reliable_t *reliable_find(nta_agent_t const *agent,
if (rel->rel_rseq == rack->ra_response)
return (nta_reliable_t *)rel;
return NULL;
}
}

View File

@ -1,6 +1,6 @@
MAINTAINERCLEANFILES = Makefile.in
AM_CPPFLAG = -I$(top_srcdir)/libs/mrcpv2-transport/include \
AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcpv2-transport/include \
-I$(top_srcdir)/libs/mrcp/include \
-I$(top_srcdir)/libs/mrcp/message/include \
-I$(top_srcdir)/libs/mrcp/control/include \

View File

@ -199,6 +199,11 @@ static inline int switch_hash_equalkeys(void *k1, void *k2)
return strcmp((char *) k1, (char *) k2) ? 0 : 1;
}
static inline int switch_hash_equalkeys_ci(void *k1, void *k2)
{
return strcasecmp((char *) k1, (char *) k2) ? 0 : 1;
}
static inline uint32_t switch_hash_default(void *ky)
{
unsigned char *str = (unsigned char *) ky;

View File

@ -16,7 +16,7 @@ BUILT_SOURCES=$(LDNS_BUILDDIR)/ldns/util.h
$(LDNS_BUILDDIR)/ldns/util.h $(LDNS_BUILDDIR)/Makefile: $(LDNS_DIR)/Makefile.in
mkdir -p $(LDNS_BUILDDIR)
cd $(LDNS_BUILDDIR) && $(DEFAULT_VARS) $(LDNS_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(LDNS_DIR) --disable-gost --without-ssl --disable-sha2
cd $(LDNS_BUILDDIR) && $(DEFAULT_VARS) $(LDNS_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(LDNS_DIR) --disable-gost --without-ssl --disable-sha2 --disable-shared --with-pic
$(TOUCH_TARGET)
$(LDNS_LA): $(LDNS_BUILDDIR)/Makefile

View File

@ -2317,9 +2317,23 @@ SWITCH_STANDARD_APP(httapi_function)
/* HTTP FILE INTERFACE */
static const char *find_ext(const char *in)
{
const char *p = in + (strlen(in) - 1);
while(p >= in && *p) {
if (*p == '/') return NULL;
if (*p == '.') return (p+1);
p--;
}
return NULL;
}
static char *load_cache_data(http_file_context_t *context, const char *url)
{
char *ext = NULL, *dext = NULL, *p;
const char *ext = NULL;
char *dext = NULL, *p;
char digest[SWITCH_MD5_DIGEST_STRING_SIZE] = { 0 };
char meta_buffer[1024] = "";
int fd;
@ -2332,11 +2346,7 @@ static char *load_cache_data(http_file_context_t *context, const char *url)
}
if (zstr(ext)) {
if ((ext = strrchr(url, '.'))) {
ext++;
} else {
ext = "wav";
}
ext = find_ext(url);
}
if (ext && (p = strchr(ext, '?'))) {
@ -2348,9 +2358,8 @@ static char *load_cache_data(http_file_context_t *context, const char *url)
}
context->cache_file_base = switch_core_sprintf(context->pool, "%s%s%s", globals.cache_path, SWITCH_PATH_SEPARATOR, digest);
context->cache_file = switch_core_sprintf(context->pool, "%s%s%s.%s", globals.cache_path, SWITCH_PATH_SEPARATOR, digest, ext);
context->meta_file = switch_core_sprintf(context->pool, "%s.meta", context->cache_file);
context->lock_file = switch_core_sprintf(context->pool, "%s.lock", context->cache_file);
context->meta_file = switch_core_sprintf(context->pool, "%s%s%s.meta", globals.cache_path, SWITCH_PATH_SEPARATOR, digest);
context->lock_file = switch_core_sprintf(context->pool, "%s%s%s.lock", globals.cache_path, SWITCH_PATH_SEPARATOR, digest);
if (switch_file_exists(context->meta_file, context->pool) == SWITCH_STATUS_SUCCESS && ((fd = open(context->meta_file, O_RDONLY, 0)) > -1)) {
if ((bytes = read(fd, meta_buffer, sizeof(meta_buffer))) > 0) {
@ -2363,10 +2372,20 @@ static char *load_cache_data(http_file_context_t *context, const char *url)
}
context->metadata = switch_core_strdup(context->pool, p);
}
if ((p = strrchr(context->metadata, ':'))) {
p++;
if (!zstr(p)) {
ext = p;
}
}
}
close(fd);
}
context->cache_file = switch_core_sprintf(context->pool, "%s%s%s%s%s", globals.cache_path, SWITCH_PATH_SEPARATOR, digest, ext ? "." : "", ext ? ext : "");
switch_safe_free(dext);
return context->cache_file;
@ -2626,6 +2645,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
switch_status_t status = SWITCH_STATUS_FALSE;
time_t now = switch_epoch_time_now(NULL);
char *metadata;
const char *ext = NULL;
load_cache_data(context, url);
@ -2635,6 +2655,10 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
lock_file(context, SWITCH_TRUE);
if (context->url_params) {
ext = switch_event_get_header(context->url_params, "ext");
}
if (!context->url_params || !switch_true(switch_event_get_header(context->url_params, "nohead"))) {
const char *ct = NULL;
const char *newext = NULL;
@ -2650,8 +2674,7 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
}
}
if ((!context->url_params || !switch_event_get_header(context->url_params, "ext"))
&& headers && (ct = switch_event_get_header(headers, "content-type"))) {
if (zstr(ext) && headers && (ct = switch_event_get_header(headers, "content-type"))) {
if (switch_strcasecmp_any(ct, "audio/mpeg", "audio/x-mpeg", "audio/mp3", "audio/x-mp3", "audio/mpeg3",
"audio/x-mpeg3", "audio/mpg", "audio/x-mpg", "audio/x-mpegaudio", NULL)) {
newext = "mp3";
@ -2660,14 +2683,14 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
}
}
if (newext) {
ext = newext;
} else if (zstr(ext)) {
ext = find_ext(context->cache_file);
}
if (newext) {
char *p;
if ((p = strrchr(context->cache_file, '.'))) {
*p = '\0';
}
context->cache_file = switch_core_sprintf(context->pool, "%s.%s", context->cache_file, newext);
}
@ -2678,11 +2701,12 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
}
if (!unreachable && !zstr(context->metadata)) {
metadata = switch_core_sprintf(context->pool, "%s:%s:%s:%s",
metadata = switch_core_sprintf(context->pool, "%s:%s:%s:%s:%s",
url,
switch_event_get_header_nil(headers, "last-modified"),
switch_event_get_header_nil(headers, "etag"),
switch_event_get_header_nil(headers, "content-length")
switch_event_get_header_nil(headers, "content-length"),
ext
);
if (!strcmp(metadata, context->metadata)) {
@ -2701,11 +2725,12 @@ static switch_status_t locate_url_file(http_file_context_t *context, const char
}
metadata = switch_core_sprintf(context->pool, "%s:%s:%s:%s",
metadata = switch_core_sprintf(context->pool, "%s:%s:%s:%s:%s",
url,
switch_event_get_header_nil(headers, "last-modified"),
switch_event_get_header_nil(headers, "etag"),
switch_event_get_header_nil(headers, "content-length")
switch_event_get_header_nil(headers, "content-length"),
ext
);
write_meta_file(context, metadata, headers);

View File

@ -1633,7 +1633,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load)
gcache.pool = pool;
switch_core_hash_init(&gcache.map);
switch_core_hash_init(&gcache.profiles);
switch_core_hash_init_nocase(&gcache.fqdn_profiles, gcache.pool);
switch_core_hash_init_nocase(&gcache.fqdn_profiles);
switch_mutex_init(&gcache.mutex, SWITCH_MUTEX_UNNESTED, gcache.pool);
switch_thread_rwlock_create(&gcache.shutdown_lock, gcache.pool);

View File

@ -2047,11 +2047,11 @@ static switch_status_t synth_load(switch_loadable_module_interface_t *module_int
mrcp_client_application_register(globals.mrcp_client, globals.synth.app, "synth");
/* map FreeSWITCH params to MRCP param */
switch_core_hash_init_nocase(&globals.synth.fs_param_map, pool);
switch_core_hash_init_nocase(&globals.synth.fs_param_map);
switch_core_hash_insert(globals.synth.fs_param_map, "voice", "voice-name");
/* map MRCP params to UniMRCP ID */
switch_core_hash_init_nocase(&globals.synth.param_id_map, pool);
switch_core_hash_init_nocase(&globals.synth.param_id_map);
switch_core_hash_insert(globals.synth.param_id_map, "jump-size", unimrcp_param_id_create(SYNTHESIZER_HEADER_JUMP_SIZE, pool));
switch_core_hash_insert(globals.synth.param_id_map, "kill-on-barge-in", unimrcp_param_id_create(SYNTHESIZER_HEADER_KILL_ON_BARGE_IN, pool));
switch_core_hash_insert(globals.synth.param_id_map, "speaker-profile", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEAKER_PROFILE, pool));
@ -3794,12 +3794,12 @@ static switch_status_t recog_load(switch_loadable_module_interface_t *module_int
mrcp_client_application_register(globals.mrcp_client, globals.recog.app, "recog");
/* map FreeSWITCH params or old params to MRCPv2 param */
switch_core_hash_init_nocase(&globals.recog.fs_param_map, pool);
switch_core_hash_init_nocase(&globals.recog.fs_param_map);
/* MRCPv1 param */
switch_core_hash_insert(globals.recog.fs_param_map, "recognizer-start-timers", "start-input-timers");
/* map MRCP params to UniMRCP ID */
switch_core_hash_init_nocase(&globals.recog.param_id_map, pool);
switch_core_hash_init_nocase(&globals.recog.param_id_map);
switch_core_hash_insert(globals.recog.param_id_map, "Confidence-Threshold", unimrcp_param_id_create(RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD, pool));
switch_core_hash_insert(globals.recog.param_id_map, "Sensitivity-Level", unimrcp_param_id_create(RECOGNIZER_HEADER_SENSITIVITY_LEVEL, pool));
switch_core_hash_insert(globals.recog.param_id_map, "Speed-Vs-Accuracy", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEED_VS_ACCURACY, pool));
@ -4332,7 +4332,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load)
memset(&globals, 0, sizeof(globals));
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_UNNESTED, pool);
globals.speech_channel_number = 0;
switch_core_hash_init_nocase(&globals.profiles, pool);
switch_core_hash_init_nocase(&globals.profiles);
/* get MRCP module configuration */
mod_unimrcp_do_config();

View File

@ -19,7 +19,7 @@ $(CELT_DIR):
$(CELT_BUILDDIR)/Makefile: $(CELT_DIR)
mkdir -p $(CELT_BUILDDIR)
cd $(CELT_BUILDDIR) && $(DEFAULT_VARS) $(CELT_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(CELT_DIR)
cd $(CELT_BUILDDIR) && $(DEFAULT_VARS) $(CELT_DIR)/configure $(DEFAULT_ARGS) --disable-shared --with-pic --srcdir=$(CELT_DIR)
$(TOUCH_TARGET)
$(CELT_LA): $(CELT_BUILDDIR)/Makefile

View File

@ -6,7 +6,7 @@ SILK_BUILDDIR=$(switch_builddir)/libs/silk
SILK_LA=$(SILK_BUILDDIR)/.libs/libSKP_SILK_SDK.la
mod_LTLIBRARIES = mod_silk.la
mod_silk_la_SOURCES = mod_silk.c $(switch_srcdir)/libs/stfu/stfu.c
mod_silk_la_SOURCES = mod_silk.c ../../../../libs/stfu/stfu.c
mod_silk_la_CFLAGS = $(AM_CFLAGS) -I$(SILK_DIR)/src -I$(SILK_DIR)/interface
mod_silk_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SILK_LA)
mod_silk_la_LDFLAGS = -avoid-version -module -no-undefined -shared

View File

@ -6,7 +6,7 @@ IKS_LA=$(IKS_BUILDDIR)/src/libiksemel.la
DING_DIR=$(switch_srcdir)/libs/libdingaling
mod_LTLIBRARIES = mod_dingaling.la
mod_dingaling_la_SOURCES = mod_dingaling.c $(DING_DIR)/src/libdingaling.c $(DING_DIR)/src/sha1.c
mod_dingaling_la_SOURCES = mod_dingaling.c ../../../../libs/libdingaling/src/libdingaling.c ../../../../libs/libdingaling/src/sha1.c
mod_dingaling_la_CFLAGS = $(AM_CFLAGS)
mod_dingaling_la_CFLAGS += `$(switch_srcdir)/libs/apr/apr-1-config --cflags --cppflags --includes`
mod_dingaling_la_CFLAGS += `$(switch_srcdir)/libs/apr-util/apu-1-config --includes`

View File

@ -1142,7 +1142,7 @@ switch_status_t channel_answer_channel(switch_core_session_t *session)
/* Wait for media */
while(!switch_test_flag(tech_pvt, TFLAG_IO)) {
switch_cond_next();
if (++x > 1000) {
if (++x > 5000) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Wait tooo long to answer %s:%s\n",
switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"));
return SWITCH_STATUS_FALSE;

View File

@ -911,6 +911,7 @@ switch_status_t perform_send_open_receive_channel(listener_t *listener,
message->data.open_receive_channel.echo_cancel_type = echo_cancel_type;
message->data.open_receive_channel.g723_bitrate = g723_bitrate;
message->data.open_receive_channel.conference_id2 = conference_id2;
message->data.open_receive_channel.rtptimeout = htonl(0x0a);
/*
message->data.open_receive_channel.reserved[0] = reserved[0];
message->data.open_receive_channel.reserved[1] = reserved[1];

View File

@ -458,7 +458,7 @@ struct PACKED dialed_phone_book_message {
struct PACKED accessory_status_message {
uint32_t accessory_id;
uint32_t accessory_status;
uint32_t unknown;
/* uint32_t unknown; */ /* this field is missing in 7925G */
};
/* RegisterAckMessage */
@ -683,7 +683,9 @@ struct PACKED open_receive_channel_message {
uint32_t echo_cancel_type;
uint32_t g723_bitrate;
uint32_t conference_id2;
uint32_t reserved[10];
uint32_t reserved[14];
uint32_t rtpdtmfpayload;
uint32_t rtptimeout;
};
/* CloseReceiveChannelMessage */

View File

@ -802,7 +802,7 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste
SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */
0, /* uint32_t echo_cancel_type, */
0, /* uint32_t g723_bitrate, */
0, /* uint32_t conference_id2, */
tech_pvt->call_id, /* uint32_t conference_id2, */
0 /* uint32_t reserved[10] */
);
}
@ -868,7 +868,7 @@ switch_status_t skinny_session_unhold_line(switch_core_session_t *session, liste
SKINNY_CODEC_ULAW_64K, /* uint32_t payload_capacity, */
0, /* uint32_t echo_cancel_type, */
0, /* uint32_t g723_bitrate, */
0, /* uint32_t conference_id2, */
tech_pvt->call_id, /* uint32_t conference_id2, */
0 /* uint32_t reserved[10] */
);

View File

@ -270,6 +270,9 @@ typedef enum {
PFLAG_MESSAGES_RESPOND_200_OK,
PFLAG_SUBSCRIBE_RESPOND_200_OK,
PFLAG_PARSE_ALL_INVITE_HEADERS,
PFLAG_TCP_UNREG_ON_SOCKET_CLOSE,
PFLAG_TLS_ALWAYS_NAT,
PFLAG_TCP_ALWAYS_NAT,
/* No new flags below this line */
PFLAG_MAX
} PFLAGS;

View File

@ -4103,6 +4103,24 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
} else {
sofia_clear_pflag(profile, PFLAG_MWI_USE_REG_CALLID);
}
} else if (!strcasecmp(var, "tcp-unreg-on-socket-close")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_TCP_UNREG_ON_SOCKET_CLOSE);
} else {
sofia_clear_pflag(profile, PFLAG_TCP_UNREG_ON_SOCKET_CLOSE);
}
} else if (!strcasecmp(var, "tcp-always-nat")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_TCP_ALWAYS_NAT);
} else {
sofia_clear_pflag(profile, PFLAG_TCP_ALWAYS_NAT);
}
} else if (!strcasecmp(var, "tls-always-nat")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_TCP_ALWAYS_NAT);
} else {
sofia_clear_pflag(profile, PFLAG_TCP_ALWAYS_NAT);
}
} else if (!strcasecmp(var, "presence-proto-lookup")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_PRESENCE_MAP);
@ -8195,7 +8213,24 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
char *sql = NULL;
char *acl_context = NULL;
const char *r_sdp = NULL;
int broken_device = 0;
int is_tcp = 0, is_tls = 0;
const char *uparams = NULL;
if (sip && sip->sip_contact && sip->sip_contact->m_url && sip->sip_contact->m_url->url_params) {
uparams = sip->sip_contact->m_url->url_params;
} else {
uparams = NULL;
}
if (uparams) {
if (switch_stristr("transport=tcp", uparams)) {
is_tcp = 1;
} else if (switch_stristr("transport=tls", uparams)) {
is_tls = 1;
}
}
profile->ib_calls++;
@ -8239,14 +8274,13 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia
}
if (!switch_check_network_list_ip(network_ip, profile->local_network) &&
profile->server_rport_level >= 2 && sip->sip_user_agent && sip->sip_user_agent->g_string &&
(!strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7) ||
!strncasecmp(sip->sip_user_agent->g_string, "KIRK Wireless Server", 20) )) {
broken_device = 1;
}
if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) || broken_device) {
if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ||
(sofia_test_pflag(profile, PFLAG_TLS_ALWAYS_NAT) && (is_tcp || is_tls)) ||
(!is_tcp && !is_tls && (zstr(network_ip) || !switch_check_network_list_ip(network_ip, profile->local_network)) &&
profile->server_rport_level >= 2 && sip->sip_user_agent &&
sip->sip_user_agent->g_string &&
(!strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7) || !strncasecmp(sip->sip_user_agent->g_string, "KIRK Wireless Server", 20)))
) {
if (sip && sip->sip_via) {
const char *port = sip->sip_via->v_port;
const char *host = sip->sip_via->v_host;

View File

@ -2180,8 +2180,8 @@ int sofia_glue_init_sql(sofia_profile_t *profile)
}
test_sql = switch_mprintf("delete from sip_registrations where (sub_host is null or contact like '%%TCP%%' "
"or status like '%%TCP%%' or status like '%%TLS%%') and hostname='%q' "
test_sql = switch_mprintf("delete from sip_registrations where sub_host is null "
"and hostname='%q' "
"and network_ip like '%%' and network_port like '%%' and sip_username "
"like '%%' and mwi_user like '%%' and mwi_host like '%%' "
"and orig_server_host like '%%' and orig_hostname like '%%'", mod_sofia_globals.hostname);

View File

@ -1187,10 +1187,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
if (sip && sip->sip_via && (vproto = sip->sip_via->v_protocol)) {
if (!strcasecmp(vproto, "sip/2.0/ws")) {
is_ws = 1;
is_nat++;
is_nat = "ws";
} else if (!strcasecmp(vproto, "sip/2.0/wss")) {
is_wss = 1;
is_nat++;
is_nat = "wss";
if (uparams && (p = switch_stristr("transport=ws", uparams))) {
if (p[12] != 's') {
@ -1269,24 +1269,29 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
if (uparams && switch_stristr("transport=tls", uparams)) {
is_tls += 1;
is_nat++;
if (sofia_test_pflag(profile, PFLAG_TLS_ALWAYS_NAT)) {
is_nat = "tls";
}
}
if (!is_wss && !is_ws && uparams && switch_stristr("transport=ws", uparams)) {
is_nat++;
is_nat = "ws";
is_ws += 1;
}
if (sip->sip_contact->m_url->url_type == url_sips) {
proto = "sips";
is_tls += 2;
is_nat++;
if (sofia_test_pflag(profile, PFLAG_TLS_ALWAYS_NAT)) {
is_nat = "tls";
}
}
if (uparams && switch_stristr("transport=tcp", uparams)) {
is_tcp = 1;
is_nat++;
if (sofia_test_pflag(profile, PFLAG_TCP_ALWAYS_NAT)) {
is_nat = "tcp";
}
}
display = contact->m_display;
@ -1464,7 +1469,8 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
to_user = force_user;
}
if (profile->server_rport_level >= 2 && sip->sip_user_agent &&
if (!is_tcp && !is_tls && (zstr(network_ip) || !switch_check_network_list_ip(network_ip, profile->local_network)) &&
profile->server_rport_level >= 2 && sip->sip_user_agent &&
sip->sip_user_agent->g_string &&
( !strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7) || !strncasecmp(sip->sip_user_agent->g_string, "KIRK Wireless Server", 20) )) {
if (sip && sip->sip_via) {
@ -1737,9 +1743,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
switch_safe_free(url);
switch_safe_free(contact);
if ((is_wss || is_ws || is_tcp || is_tls) && !sofia_private && call_id) {
if ((is_wss || is_ws || (sofia_test_pflag(profile, PFLAG_TCP_UNREG_ON_SOCKET_CLOSE) && (is_tcp || is_tls))) && !sofia_private && call_id) {
char key[256] = "";
nua_handle_t *hnh;
switch_snprintf(key, sizeof(key), "%s%s%s", call_id, network_ip, network_port_c);

View File

@ -2,7 +2,7 @@ include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_cdr_mongodb
MONGODB_DRIVER=./driver/src
mod_LTLIBRARIES = mod_cdr_mongodb.la
mod_cdr_mongodb_la_SOURCES = mod_cdr_mongodb.c $(MONGODB_DRIVER)/encoding.c $(MONGODB_DRIVER)/env_posix.c $(MONGODB_DRIVER)/bson.c $(MONGODB_DRIVER)/md5.c $(MONGODB_DRIVER)/mongo.c $(MONGODB_DRIVER)/numbers.c
mod_cdr_mongodb_la_SOURCES = mod_cdr_mongodb.c ./driver/src/encoding.c ./driver/src/env_posix.c ./driver/src/bson.c ./driver/src/md5.c ./driver/src/mongo.c ./driver/src/numbers.c
mod_cdr_mongodb_la_CFLAGS = $(AM_CFLAGS)
mod_cdr_mongodb_la_CPPFLAGS = -I$(MONGODB_DRIVER) -I$(switch_srcdir)/libs/stfu/ -I$(switch_srcdir)/libs/libteletone/src/ -D_GNU_SOURCE
mod_cdr_mongodb_la_LIBADD = $(switch_builddir)/libfreeswitch.la

View File

@ -755,7 +755,7 @@ static int check_log_queue(listener_t *listener)
/* send out any pending crap in the log queue */
if (switch_test_flag(listener, LFLAG_LOG)) {
while (msgs_sent < 100 && switch_queue_trypop(listener->log_queue, &pop) == SWITCH_STATUS_SUCCESS) {
while (msgs_sent < prefs.max_log_bulk && switch_queue_trypop(listener->log_queue, &pop) == SWITCH_STATUS_SUCCESS) {
switch_log_node_t *dnode = (switch_log_node_t *) pop;
if (dnode->data) {
@ -817,7 +817,7 @@ static int check_event_queue(listener_t *listener)
/* send out any pending crap in the event queue */
if (switch_test_flag(listener, LFLAG_EVENTS)) {
while (msgs_sent < 100 && switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
while (msgs_sent < prefs.max_event_bulk && switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
switch_event_t *pevent = (switch_event_t *) pop;
@ -998,7 +998,7 @@ static void listener_main_loop(listener_t *listener)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%d messages sent in a loop\n", msgs_sent);
#endif
} else { /* no more messages right now, relax */
switch_yield(100000);
switch_yield(10000);
}
}
if (prefs.done) {
@ -1157,6 +1157,9 @@ static int config(void)
prefs.shortname = SWITCH_TRUE;
prefs.encoding = ERLANG_STRING;
prefs.compat_rel = 0;
prefs.max_event_bulk = 1;
prefs.max_log_bulk = 1;
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
@ -1199,6 +1202,10 @@ static int config(void)
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Max acl records of %d reached\n", MAX_ACL);
}
} else if (!strcasecmp(var, "max-event-bulk") && !zstr(val)) {
prefs.max_event_bulk = atoi(val);
} else if (!strcasecmp(var, "max-log-bulk") && !zstr(val)) {
prefs.max_log_bulk = atoi(val);
}
}
}

View File

@ -216,6 +216,8 @@ struct prefs_struct {
uint32_t id;
erlang_encoding_t encoding;
int compat_rel;
int max_event_bulk;
int max_log_bulk;
};
typedef struct prefs_struct prefs_t;

View File

@ -763,6 +763,7 @@ static void stop_deliver_message_threads(void)
*/
void rayo_message_send(struct rayo_actor *from, const char *to, iks *payload, int dup, int reply, const char *file, int line)
{
const char *msg_name;
struct rayo_message *msg = malloc(sizeof(*msg));
if (dup) {
msg->payload = iks_copy(payload);
@ -783,6 +784,21 @@ void rayo_message_send(struct rayo_actor *from, const char *to, iks *payload, in
msg->file = strdup(file);
msg->line = line;
/* add timestamp to presence events */
msg_name = iks_name(msg->payload);
if (!zstr(msg_name) && !strcmp("presence", msg_name)) {
iks *delay = iks_insert(msg->payload, "delay");
switch_time_exp_t tm;
char timestamp[80];
switch_size_t retsize;
iks_insert_attrib(delay, "xmlns", "urn:xmpp:delay");
switch_time_exp_tz(&tm, switch_time_now(), 0);
switch_strftime_nocheck(timestamp, &retsize, sizeof(timestamp), "%Y-%m-%dT%TZ", &tm);
iks_insert_attrib_printf(delay, "stamp", "%s", timestamp);
}
if (switch_queue_trypush(globals.msg_queue, msg) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "failed to queue message!\n");
rayo_message_destroy(msg);
@ -1973,7 +1989,7 @@ static iks *join_call(struct rayo_call *call, switch_core_session_t *session, st
struct rayo_call *b_call = RAYO_CALL_LOCATE(call_uri);
if (!b_call) {
/* not a rayo call */
response = iks_new_error_detailed(node, STANZA_ERROR_SERVICE_UNAVAILABLE, "b-leg is not a rayo call");
response = iks_new_error_detailed(node, STANZA_ERROR_SERVICE_UNAVAILABLE, "b-leg is gone");
} else if (!has_call_control(b_call, msg)) {
/* not allowed to join to this call */
response = iks_new_error(node, STANZA_ERROR_NOT_ALLOWED);
@ -1990,7 +2006,7 @@ static iks *join_call(struct rayo_call *call, switch_core_session_t *session, st
call->pending_join_request = iks_copy(node);
if (switch_ivr_uuid_bridge(rayo_call_get_uuid(call), rayo_call_get_uuid(b_call)) != SWITCH_STATUS_SUCCESS) {
iks *request = call->pending_join_request;
iks *result = iks_new_error_detailed(request, STANZA_ERROR_ITEM_NOT_FOUND, "failed to bridge call");
iks *result = iks_new_error(request, STANZA_ERROR_SERVICE_UNAVAILABLE);
call->pending_join_request = NULL;
RAYO_SEND_REPLY(call, iks_find_attrib_soft(request, "from"), result);
iks_delete(call->pending_join_request);

View File

@ -514,9 +514,13 @@ static iks *start_call_voice_input(struct input_component *component, switch_cor
/* start speech detection */
switch_channel_set_variable(switch_core_session_get_channel(session), "fire_asr_events", "true");
switch_mutex_unlock(handler->mutex); /* unlock handler mutex, otherwise deadlock will happen when switch_ivr_detect_speech adds a new media bug */
if (switch_ivr_detect_speech(session, component->recognizer, grammar.data, "mod_rayo_grammar", "", NULL) != SWITCH_STATUS_SUCCESS) {
switch_mutex_lock(handler->mutex);
handler->voice_component = NULL;
rayo_component_send_complete(RAYO_COMPONENT(component), COMPONENT_COMPLETE_ERROR);
} else {
switch_mutex_lock(handler->mutex);
}
switch_safe_free(grammar.data);

View File

@ -6,7 +6,7 @@ PALA=$(switch_builddir)/libs/portaudio/lib/libportaudio.la
MODPA_DIR=$(switch_srcdir)/src/mod/endpoints/mod_portaudio
mod_LTLIBRARIES = mod_portaudio_stream.la
mod_portaudio_stream_la_SOURCES = mod_portaudio_stream.c $(MODPA_DIR)/pablio.c $(MODPA_DIR)/pa_ringbuffer.c
mod_portaudio_stream_la_SOURCES = mod_portaudio_stream.c ../../endpoints/mod_portaudio/pablio.c ../../endpoints/mod_portaudio/pa_ringbuffer.c
mod_portaudio_stream_la_CFLAGS = -I. -I$(PA_DIR)/include -D__EXTENSION__=1 -I$(MODPA_DIR) $(AM_CFLAGS)
mod_portaudio_stream_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(PALA)
mod_portaudio_stream_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(PA_LIBS)

View File

@ -31,7 +31,7 @@ $(MPG123_DIR):
$(MPG123_BUILDDIR)/Makefile: $(MPG123_DIR)
mkdir -p $(MPG123_BUILDDIR)
cd $(MPG123_BUILDDIR) && $(DEFAULT_VARS) $(MPG123_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(MPG123_DIR) CPPFLAGS= LDFLAGS=
cd $(MPG123_BUILDDIR) && $(DEFAULT_VARS) $(MPG123_DIR)/configure $(DEFAULT_ARGS) --disable-shared --with-pic --srcdir=$(MPG123_DIR) CPPFLAGS= LDFLAGS=
$(TOUCH_TARGET)
$(MPG123LA): $(MPG123_BUILDDIR)/Makefile
@ -43,7 +43,7 @@ $(LAME_DIR):
$(LAME_BUILDDIR)/Makefile: $(LAME_DIR)
mkdir -p $(LAME_BUILDDIR)
cd $(LAME_BUILDDIR) && $(DEFAULT_VARS) $(LAME_DIR)/configure $(DEFAULT_ARGS) --disable-decoder --srcdir=$(LAME_DIR) CPPFLAGS= LDFLAGS=
cd $(LAME_BUILDDIR) && $(DEFAULT_VARS) $(LAME_DIR)/configure $(DEFAULT_ARGS) --disable-shared --with-pic --disable-decoder --srcdir=$(LAME_DIR) CPPFLAGS= LDFLAGS=
$(TOUCH_TARGET)
$(LAMELA): $(LAME_BUILDDIR)/Makefile
@ -56,7 +56,7 @@ $(SHOUT_DIR):
$(SHOUT_BUILDDIR)/Makefile: $(SHOUT_DIR)
mkdir -p $(SHOUT_BUILDDIR)
cd $(SHOUT_BUILDDIR) && $(DEFAULT_VARS) $(SHOUT_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(SHOUT_DIR) --without-speex --without-vorbis --without-ogg CPPFLAGS= LDFLAGS=
cd $(SHOUT_BUILDDIR) && $(DEFAULT_VARS) $(SHOUT_DIR)/configure $(DEFAULT_ARGS) --disable-shared --with-pic --srcdir=$(SHOUT_DIR) --without-speex --without-vorbis --without-ogg CPPFLAGS= LDFLAGS=
$(TOUCH_TARGET)
$(SHOUTLA): $(SHOUT_BUILDDIR)/Makefile

View File

@ -78,6 +78,7 @@ BUILT_SOURCES=$(XMLRPC_DIR)/version.h $(XMLRPC_DIR)/lib/expat/xmltok/nametab.h
$(XMLRPC_DIR)/lib/expat/xmltok/xmltok.o: $(XMLRPC_DIR)/lib/expat/xmltok/nametab.h
$(XMLRPC_DIR)/lib/expat/xmltok/nametab.h:
cd $(XMLRPC_DIR)/lib/expat/gennmtab && $(MAKE) dep
cd $(XMLRPC_DIR)/lib/expat/gennmtab && $(MAKE)
cd $(XMLRPC_DIR)/lib/expat/xmltok && ../gennmtab/gennmtab > nametab.h

View File

@ -38,7 +38,11 @@
SWITCH_DECLARE(switch_status_t) switch_core_hash_init_case(switch_hash_t **hash, switch_bool_t case_sensitive)
{
return switch_create_hashtable(hash, 16, case_sensitive ? switch_hash_default : switch_hash_default_ci, switch_hash_equalkeys);
if (case_sensitive) {
return switch_create_hashtable(hash, 16, switch_hash_default, switch_hash_equalkeys);
} else {
return switch_create_hashtable(hash, 16, switch_hash_default_ci, switch_hash_equalkeys_ci);
}
}

View File

@ -2797,7 +2797,7 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_
}
if (engine->ice_in.cands[engine->ice_in.chosen[1]][1].ready) {
if (!strcmp(engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr, engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_addr)
if (engine->rtcp_mux > 0 && !strcmp(engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_addr, engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_addr)
&& engine->ice_in.cands[engine->ice_in.chosen[1]][1].con_port == engine->ice_in.cands[engine->ice_in.chosen[0]][0].con_port) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_INFO, "Skipping %s RTCP ICE (Same as RTP)\n", type2str(type));
} else {
@ -5058,7 +5058,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
}
if (a_engine->ice_in.cands[a_engine->ice_in.chosen[1]][1].ready) {
if (!strcmp(a_engine->ice_in.cands[a_engine->ice_in.chosen[1]][1].con_addr, a_engine->ice_in.cands[a_engine->ice_in.chosen[0]][0].con_addr)
if (a_engine->rtcp_mux > 0 && !strcmp(a_engine->ice_in.cands[a_engine->ice_in.chosen[1]][1].con_addr, a_engine->ice_in.cands[a_engine->ice_in.chosen[0]][0].con_addr)
&& a_engine->ice_in.cands[a_engine->ice_in.chosen[1]][1].con_port == a_engine->ice_in.cands[a_engine->ice_in.chosen[0]][0].con_port) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Skipping RTCP ICE (Same as RTP)\n");
} else {
@ -5475,7 +5475,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_activate_rtp(switch_core_sessi
if (v_engine->ice_in.cands[v_engine->ice_in.chosen[1]][1].ready) {
if (!strcmp(v_engine->ice_in.cands[v_engine->ice_in.chosen[1]][1].con_addr, v_engine->ice_in.cands[v_engine->ice_in.chosen[0]][0].con_addr)
if (v_engine->rtcp_mux > 0 && !strcmp(v_engine->ice_in.cands[v_engine->ice_in.chosen[1]][1].con_addr, v_engine->ice_in.cands[v_engine->ice_in.chosen[0]][0].con_addr)
&& v_engine->ice_in.cands[v_engine->ice_in.chosen[1]][1].con_port == v_engine->ice_in.cands[v_engine->ice_in.chosen[0]][0].con_port) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Skipping VIDEO RTCP ICE (Same as VIDEO RTP)\n");
} else {

View File

@ -3158,7 +3158,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from aliases", "DROP TABLE aliases", create_alias_sql);
switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from complete", "DROP TABLE complete", create_complete_sql);
switch_cache_db_test_reactive(sql_manager.dbh, "select hostname from nat", "DROP TABLE nat", create_nat_sql);
switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'",
switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user=''",
"DROP TABLE registrations", create_registrations_sql);
switch_cache_db_test_reactive(sql_manager.dbh, "select metadata from registrations", NULL, "ALTER TABLE registrations ADD COLUMN metadata VARCHAR(256)");
@ -3185,11 +3185,11 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
switch_cache_db_test_reactive(sql_manager.dbh, "select * from basic_calls where sent_callee_name=''", "DROP VIEW basic_calls", basic_calls_sql);
switch_cache_db_test_reactive(sql_manager.dbh, "select call_uuid from calls", "DROP TABLE calls", create_calls_sql);
if (runtime.odbc_dbtype == DBTYPE_DEFAULT) {
switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'",
switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user=''",
"DROP TABLE registrations", create_registrations_sql);
} else {
char *tmp = switch_string_replace(create_registrations_sql, "url TEXT", "url VARCHAR(max)");
switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user='' or network_proto='tcp' or network_proto='tls'",
switch_cache_db_test_reactive(sql_manager.dbh, "delete from registrations where reg_user=''",
"DROP TABLE registrations", tmp);
free(tmp);
}

View File

@ -660,10 +660,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
rtp_session->dtmf_data.in_digit_ts = 0;
rtp_session->dtmf_data.in_digit_sanity = 0;
rtp_session->dtmf_data.in_digit_queued = 0;
if (!switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
*do_cng = 1;
}
*do_cng = 1;
} else {
if (!switch_rtp_ready(rtp_session)) {
return RESULT_GOTO_END;
@ -708,9 +705,7 @@ static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_
return RESULT_GOTO_RECVFROM;
}
} else {
if (switch_rtp_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) {
*do_cng = 1;
}
*do_cng = 1;
return RESULT_GOTO_TIMERCHECK;
}
}