Merge branch 'master' into v1.4
This commit is contained in:
commit
498f58677f
File diff suppressed because it is too large
Load Diff
|
@ -464,6 +464,7 @@ if test "${enable_debug}" = "yes"; then
|
|||
CFLAGS="$saved_CFLAGS"
|
||||
|
||||
if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
|
||||
APR_ADDTO(SWITCH_AM_CFLAGS, -Wno-unused-result)
|
||||
APR_ADDTO(SWITCH_AM_CFLAGS, -g -ggdb)
|
||||
export DEBUG_CFLAGS="-g -ggdb"
|
||||
fi
|
||||
|
|
|
@ -50,7 +50,8 @@ commit, perhaps your commit should be broken into smaller separate
|
|||
commits.
|
||||
|
||||
The commit body can be longer and can consist of multiple paragraphs.
|
||||
The text of the body should be hard wrapped to 68-72 characters.
|
||||
The text of the body should be hard wrapped to 68-72 characters. (In
|
||||
Emacs you can hard wrap text with `M-q`.)
|
||||
|
||||
When writing the commit body, describe in detail the problem that your
|
||||
commit aims to solve, how your commit solves the problem, and any
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -241,7 +241,7 @@ var callbacks = {
|
|||
docall();
|
||||
}
|
||||
} else {
|
||||
goto_page("login");
|
||||
goto_page("main");
|
||||
goto_dialog("login-error");
|
||||
}
|
||||
|
||||
|
|
|
@ -1430,9 +1430,13 @@
|
|||
var RTCcallbacks = {};
|
||||
|
||||
if (dialog.direction == $.verto.enum.direction.inbound) {
|
||||
|
||||
dialog.params.remote_caller_id_name = dialog.params.caller_id_name;
|
||||
dialog.params.remote_caller_id_number = dialog.params.caller_id_number;
|
||||
if (dialog.params.display_direction === "outbound") {
|
||||
dialog.params.remote_caller_id_name = dialog.params.caller_id_name;
|
||||
dialog.params.remote_caller_id_number = dialog.params.caller_id_number;
|
||||
} else {
|
||||
dialog.params.remote_caller_id_name = dialog.params.callee_id_name;
|
||||
dialog.params.remote_caller_id_number = dialog.params.callee_id_number;
|
||||
}
|
||||
|
||||
if (!dialog.params.remote_caller_id_name) {
|
||||
dialog.params.remote_caller_id_name = "Nobody";
|
||||
|
@ -1597,7 +1601,7 @@
|
|||
dialog.setState($.verto.enum.state.destroy);
|
||||
break;
|
||||
case $.verto.enum.state.destroy:
|
||||
delete verto.dialogs[dialog.callID];
|
||||
delete dialog.verto.dialogs[dialog.callID];
|
||||
dialog.rtc.stop();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ AC_C_CONST
|
|||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
AC_CHECK_FUNCS([memset memcpy malloc free])
|
||||
AC_CHECK_FUNCS([usleep])
|
||||
AC_CHECK_FUNCS([usleep nanosleep])
|
||||
AC_CHECK_FUNCS([fopen fread])
|
||||
AC_CHECK_FUNCS([pthread_mutex_lock pthread_mutex_unlock pthread_mutex_init pthread_mutex_destroy])
|
||||
AC_CHECK_FUNCS([pthread_attr_init pthread_attr_setdetachstate pthread_create])
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
* Viktor Krykun <v.krikun at zfoneproject.com>
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 199309L /* for struct timespec */
|
||||
#include "zrtp.h"
|
||||
|
||||
#if (defined(ZRTP_USE_BUILTIN_SCEHDULER) && (ZRTP_USE_BUILTIN_SCEHDULER ==1))
|
||||
|
@ -80,11 +81,15 @@ int zrtp_thread_create(zrtp_thread_routine_t start_routine, void *arg)
|
|||
}
|
||||
|
||||
#elif (ZRTP_PLATFORM == ZP_LINUX) || (ZRTP_PLATFORM == ZP_DARWIN) || (ZRTP_PLATFORM == ZP_BSD) || (ZRTP_PLATFORM == ZP_ANDROID)
|
||||
#if ZRTP_HAVE_UNISTD_H == 1
|
||||
/* POSIX.1-2008 removes usleep, so use nanosleep instead when available */
|
||||
#if ZRTP_HAVE_NANOSLEEP
|
||||
#include <time.h> /* for nanosleep */
|
||||
#elif ZRTP_HAVE_UNISTD_H == 1
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#error "Used environment dosn't have <unistd.h> - zrtp_scheduler can't be build."
|
||||
#endif
|
||||
|
||||
#if ZRTP_HAVE_PTHREAD_H == 1
|
||||
#include <pthread.h>
|
||||
#else
|
||||
|
@ -93,7 +98,14 @@ int zrtp_thread_create(zrtp_thread_routine_t start_routine, void *arg)
|
|||
|
||||
int zrtp_sleep(unsigned int msec)
|
||||
{
|
||||
#if ZRTP_HAVE_NANOSLEEP
|
||||
struct timespec delay;
|
||||
delay.tv_sec = msec / 1000;
|
||||
delay.tv_nsec = (msec % 1000) * 1000000;
|
||||
while (nanosleep(&delay, &delay));
|
||||
#else
|
||||
usleep(msec*1000);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Mon Aug 11 21:02:23 CDT 2014
|
||||
Sat Aug 16 01:34:24 CDT 2014
|
||||
|
|
|
@ -432,6 +432,8 @@ void *sub_alloc(su_home_t *home,
|
|||
if (size >= ((size_t)1) << SIZEBITS)
|
||||
return (void)(errno = ENOMEM), NULL;
|
||||
|
||||
if (!size) return NULL;
|
||||
|
||||
if (sub == NULL || 3 * sub->sub_used > 2 * sub->sub_n) {
|
||||
/* Resize the hash table */
|
||||
size_t i, n, n2;
|
||||
|
@ -474,7 +476,7 @@ void *sub_alloc(su_home_t *home,
|
|||
sub = b2;
|
||||
}
|
||||
|
||||
if (size && sub && zero < do_clone &&
|
||||
if (sub && zero < do_clone &&
|
||||
sub->sub_preload && size <= sub->sub_prsize) {
|
||||
/* Use preloaded memory */
|
||||
size_t prused = sub->sub_prused + size + MEMCHECK_EXTRA;
|
||||
|
|
|
@ -97,10 +97,18 @@ void init_ssl(void) {
|
|||
|
||||
OpenSSL_add_all_algorithms(); /* load & register cryptos */
|
||||
SSL_load_error_strings(); /* load all error messages */
|
||||
ws_globals.ssl_method = TLSv1_server_method(); /* create server instance */
|
||||
ws_globals.ssl_method = SSLv23_server_method(); /* create server instance */
|
||||
ws_globals.ssl_ctx = SSL_CTX_new(ws_globals.ssl_method); /* create context */
|
||||
assert(ws_globals.ssl_ctx);
|
||||
|
||||
|
||||
/* Disable SSLv2 */
|
||||
SSL_CTX_set_options(globals.ssl_ctx, SSL_OP_NO_SSLv2);
|
||||
/* Disable SSLv3 */
|
||||
SSL_CTX_set_options(globals.ssl_ctx, SSL_OP_NO_SSLv3);
|
||||
/* Disable TLSv1 */
|
||||
SSL_CTX_set_options(globals.ssl_ctx, SSL_OP_NO_TLSv1);
|
||||
/* Disable Compression CRIME (Compression Ratio Info-leak Made Easy) */
|
||||
SSL_CTX_set_options(globals.ssl_ctx, SSL_OP_NO_COMPRESSION);
|
||||
/* set the local certificate from CertFile */
|
||||
SSL_CTX_use_certificate_file(ws_globals.ssl_ctx, ws_globals.cert, SSL_FILETYPE_PEM);
|
||||
/* set the private key from KeyFile */
|
||||
|
|
|
@ -15,7 +15,6 @@ libsrtp_la_SOURCES = srtp/srtp.c srtp/ekt.c crypto/cipher/cipher.c crypto/cip
|
|||
crypto/math/datatypes.c crypto/math/stat.c \
|
||||
crypto/kernel/crypto_kernel.c crypto/kernel/alloc.c \
|
||||
crypto/kernel/key.c \
|
||||
crypto/rng/prng.c crypto/rng/ctr_prng.c \
|
||||
crypto/kernel/err.c \
|
||||
crypto/replay/rdb.c crypto/replay/rdbx.c crypto/replay/ut_sim.c
|
||||
|
||||
|
@ -30,6 +29,7 @@ libsrtp_la_SOURCES += crypto/hash/hmac_ossl.c
|
|||
else
|
||||
libsrtp_la_SOURCES += crypto/hash/sha1.c crypto/hash/hmac.c
|
||||
libsrtp_la_SOURCES += crypto/cipher/aes_icm.c crypto/cipher/aes.c crypto/cipher/aes_cbc.c
|
||||
libsrtp_la_SOURCES += crypto/rng/prng.c crypto/rng/ctr_prng.c
|
||||
if RNG_OBJS_LINUX
|
||||
libsrtp_la_SOURCES += crypto/rng/rand_linux_kernel.c
|
||||
EXTRA_DIST += crypto/rng/rand_source.c
|
||||
|
|
|
@ -985,6 +985,8 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thre
|
|||
#define SWITCH_SO_RCVBUF 128
|
||||
#define SWITCH_SO_DISCONNECTED 256
|
||||
#define SWITCH_SO_TCP_NODELAY 512
|
||||
#define SWITCH_SO_TCP_KEEPIDLE 520
|
||||
#define SWITCH_SO_TCP_KEEPINTVL 530
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -2141,6 +2141,42 @@ SWITCH_STANDARD_API(status_function)
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
#define UPTIME_SYNTAX "[us|ms|s|m|h|d|microseconds|milliseconds|seconds|minutes|hours|days]"
|
||||
SWITCH_STANDARD_API(uptime_function)
|
||||
{
|
||||
switch_time_t scale;
|
||||
|
||||
if (zstr(cmd)) {
|
||||
/* default to seconds */
|
||||
scale = 1000000;
|
||||
}
|
||||
else if (!strcasecmp(cmd, "microseconds") || !strcasecmp(cmd, "us")) {
|
||||
scale = 1;
|
||||
}
|
||||
else if (!strcasecmp(cmd, "milliseconds") || !strcasecmp(cmd, "ms")) {
|
||||
scale = 1000;
|
||||
}
|
||||
else if (!strcasecmp(cmd, "seconds") || !strcasecmp(cmd, "s")) {
|
||||
scale = 1000000;
|
||||
}
|
||||
else if (!strcasecmp(cmd, "minutes") || !strcasecmp(cmd, "m")) {
|
||||
scale = 60000000;
|
||||
}
|
||||
else if (!strcasecmp(cmd, "hours") || !strcasecmp(cmd, "h")) {
|
||||
scale = 3600000000;
|
||||
}
|
||||
else if (!strcasecmp(cmd, "days") || !strcasecmp(cmd, "d")) {
|
||||
scale = 86400000000;
|
||||
}
|
||||
else {
|
||||
stream->write_function(stream, "-USAGE: %s\n", UPTIME_SYNTAX);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
stream->write_function(stream, "%u\n", switch_core_uptime() / scale);
|
||||
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]]"
|
||||
SWITCH_STANDARD_API(ctl_function)
|
||||
{
|
||||
|
@ -6633,6 +6669,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
|||
SWITCH_ADD_API(commands_api_interface, "tone_detect", "Start tone detection on a channel", tone_detect_session_function, TONE_DETECT_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "unload", "Unload module", unload_function, UNLOAD_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "unsched_api", "Unschedule an api command", unsched_api_function, UNSCHED_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "uptime", "Show uptime", uptime_function, UPTIME_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "reg_url", "", reg_url_function, "<user>@<realm>");
|
||||
SWITCH_ADD_API(commands_api_interface, "url_decode", "Url decode a string", url_decode_function, "<string>");
|
||||
SWITCH_ADD_API(commands_api_interface, "url_encode", "Url encode a string", url_encode_function, "<string>");
|
||||
|
@ -6796,6 +6833,17 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
|||
switch_console_set_complete("add shutdown");
|
||||
switch_console_set_complete("add sql_escape");
|
||||
switch_console_set_complete("add unload ::console::list_loaded_modules");
|
||||
switch_console_set_complete("add uptime ms");
|
||||
switch_console_set_complete("add uptime s");
|
||||
switch_console_set_complete("add uptime m");
|
||||
switch_console_set_complete("add uptime h");
|
||||
switch_console_set_complete("add uptime d");
|
||||
switch_console_set_complete("add uptime microseconds");
|
||||
switch_console_set_complete("add uptime milliseconds");
|
||||
switch_console_set_complete("add uptime seconds");
|
||||
switch_console_set_complete("add uptime minutes");
|
||||
switch_console_set_complete("add uptime hours");
|
||||
switch_console_set_complete("add uptime days");
|
||||
switch_console_set_complete("add uuid_audio ::console::list_uuid start read mute");
|
||||
switch_console_set_complete("add uuid_audio ::console::list_uuid start read level");
|
||||
switch_console_set_complete("add uuid_audio ::console::list_uuid start write mute");
|
||||
|
|
|
@ -194,6 +194,7 @@ static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, c
|
|||
}
|
||||
|
||||
if (!strncasecmp(url, "https", 5)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not verifying TLS cert for %s; connection is not secure\n", url);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
}
|
||||
|
@ -357,6 +358,7 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data)
|
|||
|
||||
if (!strncasecmp(http_data->url, "https", 5))
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not verifying TLS cert for %s; connection is not secure\n", http_data->url);
|
||||
curl_easy_setopt(http_data->curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_easy_setopt(http_data->curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
}
|
||||
|
@ -400,8 +402,11 @@ static void http_sendfile_initialize_curl(http_sendfile_data_t *http_data)
|
|||
char *argv2[4] = { 0 };
|
||||
uint32_t argc2 = switch_separate_string(argv[count], '=', argv2, (sizeof(argv2) / sizeof(argv2[0])));
|
||||
|
||||
if(argc2 == 2)
|
||||
if(argc2 == 2) {
|
||||
switch_url_decode(argv2[0]);
|
||||
switch_url_decode(argv2[1]);
|
||||
curl_formadd(&http_data->formpost, &http_data->lastptr, CURLFORM_COPYNAME, argv2[0], CURLFORM_COPYCONTENTS, argv2[1], CURLFORM_END);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2214,9 +2214,9 @@ static void send_presence(fifo_node_t *node)
|
|||
}
|
||||
|
||||
if ((wait_count = node_caller_count(node)) > 0) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d waiting)", wait_count);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "force-status", "Active (%d waiting)", wait_count);
|
||||
} else {
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Idle");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "force-status", "Idle");
|
||||
}
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
|
||||
|
@ -2225,7 +2225,7 @@ static void send_presence(fifo_node_t *node)
|
|||
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", wait_count > 0 ? "CS_ROUTING" : "CS_HANGUP");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", node->name);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", wait_count > 0 ? "early" : "terminated");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", wait_count > 0 ? "confirmed" : "terminated");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", "inbound");
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
|
|
@ -105,6 +105,39 @@ char *aws_s3_signature(char *signature, int signature_length, const char *string
|
|||
return signature;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse string substring search
|
||||
*/
|
||||
static char *my_strrstr(const char *haystack, const char *needle)
|
||||
{
|
||||
char *s;
|
||||
size_t needle_len;
|
||||
size_t haystack_len;
|
||||
|
||||
if (zstr(haystack)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (zstr(needle)) {
|
||||
return (char *)haystack;
|
||||
}
|
||||
|
||||
needle_len = strlen(needle);
|
||||
haystack_len = strlen(haystack);
|
||||
if (needle_len > haystack_len) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s = (char *)(haystack + haystack_len - needle_len);
|
||||
do {
|
||||
if (!strncmp(s, needle, needle_len)) {
|
||||
return s;
|
||||
}
|
||||
} while (s-- != haystack);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse bucket and object from URL
|
||||
* @param url to parse. This value is modified.
|
||||
|
@ -113,7 +146,7 @@ char *aws_s3_signature(char *signature, int signature_length, const char *string
|
|||
*/
|
||||
void aws_s3_parse_url(char *url, char **bucket, char **object)
|
||||
{
|
||||
char *bucket_start;
|
||||
char *bucket_start = NULL;
|
||||
char *bucket_end;
|
||||
char *object_start;
|
||||
|
||||
|
@ -124,15 +157,18 @@ void aws_s3_parse_url(char *url, char **bucket, char **object)
|
|||
return;
|
||||
}
|
||||
|
||||
/* expect: http(s)://bucket.s3.amazonaws.com/object */
|
||||
bucket_start = strstr(url, "://");
|
||||
if (!bucket_start) {
|
||||
/* expect: http(s)://bucket.foo-bar.s3.amazonaws.com/object */
|
||||
if (!strncasecmp(url, "https://", 8)) {
|
||||
bucket_start = url + 8;
|
||||
} else if (!strncasecmp(url, "http://", 7)) {
|
||||
bucket_start = url + 7;
|
||||
}
|
||||
if (zstr(bucket_start)) {
|
||||
/* invalid URL */
|
||||
return;
|
||||
}
|
||||
bucket_start += 3;
|
||||
|
||||
bucket_end = strchr(bucket_start, '.');
|
||||
|
||||
bucket_end = my_strrstr(bucket_start, ".s3");
|
||||
if (!bucket_end) {
|
||||
/* invalid URL */
|
||||
return;
|
||||
|
|
|
@ -1395,17 +1395,19 @@ static switch_status_t do_config(url_cache_t *cache)
|
|||
http_profile_t *profile_obj;
|
||||
switch_xml_t domains;
|
||||
switch_xml_t s3 = switch_xml_child(profile, "aws-s3");
|
||||
const char *access_key_id = NULL;
|
||||
const char *secret_access_key = NULL;
|
||||
char *access_key_id = NULL;
|
||||
char *secret_access_key = NULL;
|
||||
if (s3) {
|
||||
switch_xml_t id = switch_xml_child(s3, "access-key-id");
|
||||
switch_xml_t secret = switch_xml_child(s3, "secret-access-key");
|
||||
if (id && secret) {
|
||||
access_key_id = switch_xml_txt(id);
|
||||
secret_access_key = switch_xml_txt(secret);
|
||||
if (!access_key_id || !secret_access_key) {
|
||||
access_key_id = switch_strip_whitespace(switch_xml_txt(id));
|
||||
secret_access_key = switch_strip_whitespace(switch_xml_txt(secret));
|
||||
if (zstr(access_key_id) || zstr(secret_access_key)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing aws s3 credentials for profile \"%s\"\n", name);
|
||||
switch_safe_free(access_key_id);
|
||||
access_key_id = NULL;
|
||||
switch_safe_free(secret_access_key);
|
||||
secret_access_key = NULL;
|
||||
}
|
||||
} else {
|
||||
|
@ -1414,6 +1416,8 @@ static switch_status_t do_config(url_cache_t *cache)
|
|||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Adding profile \"%s\" to cache\n", name);
|
||||
profile_obj = url_cache_http_profile_add(cache, name, access_key_id, secret_access_key);
|
||||
switch_safe_free(access_key_id);
|
||||
switch_safe_free(secret_access_key);
|
||||
|
||||
domains = switch_xml_child(profile, "domains");
|
||||
if (domains) {
|
||||
|
|
|
@ -111,6 +111,10 @@ static void test_parse_url(void)
|
|||
aws_s3_parse_url(strdup("https://my-bucket-with-dash.s3-us-west-2.amazonaws.com/greeting/file/1002/Lumino.mp3"), &bucket, &object);
|
||||
ASSERT_STRING_EQUALS("my-bucket-with-dash", bucket);
|
||||
ASSERT_STRING_EQUALS("greeting/file/1002/Lumino.mp3", object);
|
||||
|
||||
aws_s3_parse_url(strdup("http://quotes.s3.foo.bar.s3.amazonaws.com/greeting/file/1002/Lumino.mp3"), &bucket, &object);
|
||||
ASSERT_STRING_EQUALS("quotes.s3.foo.bar", bucket);
|
||||
ASSERT_STRING_EQUALS("greeting/file/1002/Lumino.mp3", object);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2023,7 +2023,7 @@ switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, c
|
|||
} else if (!strcasecmp(var, "digit-timeout")) {
|
||||
profile->digit_timeout = atoi(val);
|
||||
} else if (!strcasecmp(var, "date-format")) {
|
||||
strncpy(profile->date_format, val, 6);
|
||||
memcpy(profile->date_format, val, 6);
|
||||
} else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
|
||||
profile->odbc_dsn = switch_core_strdup(profile->pool, val);
|
||||
} else if (!strcasecmp(var, "debug")) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Skypopen, Skype Endpoint and Trunk
|
||||
Skypopen, Skype Endpoint and Trunk
|
||||
|
||||
All documentation on compiling, using, configuring,
|
||||
tricks and tweaks, possible problems at:
|
||||
|
|
|
@ -4319,9 +4319,9 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
|
|||
}
|
||||
|
||||
if (!strchr(dest, '@')) {
|
||||
tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s@%s", dest, sofia_glue_strip_proto(gateway_ptr->register_proxy));
|
||||
tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s%s@%s", gateway_ptr->destination_prefix, dest, sofia_glue_strip_proto(gateway_ptr->register_proxy));
|
||||
} else {
|
||||
tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s", dest);
|
||||
tech_pvt->dest = switch_core_session_sprintf(nsession, "sip:%s%s", gateway_ptr->destination_prefix, dest);
|
||||
}
|
||||
|
||||
if ((host = switch_core_session_strdup(nsession, tech_pvt->dest))) {
|
||||
|
|
|
@ -478,6 +478,7 @@ struct sofia_gateway {
|
|||
char *register_context;
|
||||
char *expires_str;
|
||||
char *register_url;
|
||||
char *destination_prefix;
|
||||
char *from_domain;
|
||||
sofia_transport_t register_transport;
|
||||
uint32_t freq;
|
||||
|
|
|
@ -3315,6 +3315,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
|||
gateway->ob_calls = 0;
|
||||
gateway->ib_failed_calls = 0;
|
||||
gateway->ob_failed_calls = 0;
|
||||
gateway->destination_prefix = "";
|
||||
|
||||
if ((x_params = switch_xml_child(gateway_tag, "variables"))) {
|
||||
param = switch_xml_child(x_params, "variable");
|
||||
|
@ -3416,6 +3417,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
|||
outbound_proxy = val;
|
||||
} else if (!strcmp(var, "distinct-to")) {
|
||||
distinct_to = switch_true(val);
|
||||
} else if (!strcmp(var, "destination-prefix")) {
|
||||
if (!zstr(val)) {
|
||||
gateway->destination_prefix = switch_core_strdup(gateway->pool, val);
|
||||
}
|
||||
} else if (!strcmp(var, "rfc-5626")) {
|
||||
rfc_5626 = switch_true(val);
|
||||
} else if (!strcmp(var, "reg-id")) {
|
||||
|
|
|
@ -963,33 +963,25 @@ static switch_bool_t check_auth(jsock_t *jsock, cJSON *params, int *code, char *
|
|||
static void set_call_params(cJSON *params, verto_pvt_t *tech_pvt) {
|
||||
const char *caller_id_name = NULL;
|
||||
const char *caller_id_number = NULL;
|
||||
const char *callee_id_name = NULL;
|
||||
const char *callee_id_number = NULL;
|
||||
|
||||
caller_id_name = switch_channel_get_variable(tech_pvt->channel, "caller_id_name");
|
||||
caller_id_number = switch_channel_get_variable(tech_pvt->channel, "caller_id_number");
|
||||
callee_id_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name");
|
||||
callee_id_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number");
|
||||
|
||||
if (caller_id_name) cJSON_AddItemToObject(params, "caller_id_name", cJSON_CreateString(caller_id_name));
|
||||
if (caller_id_number) cJSON_AddItemToObject(params, "caller_id_number", cJSON_CreateString(caller_id_number));
|
||||
|
||||
if (callee_id_name) cJSON_AddItemToObject(params, "callee_id_name", cJSON_CreateString(callee_id_name));
|
||||
if (callee_id_number) cJSON_AddItemToObject(params, "callee_id_number", cJSON_CreateString(callee_id_number));
|
||||
|
||||
if (switch_channel_outbound_display(tech_pvt->channel)) {
|
||||
caller_id_name = switch_channel_get_variable(tech_pvt->channel, "caller_id_name");
|
||||
caller_id_number = switch_channel_get_variable(tech_pvt->channel, "caller_id_number");
|
||||
} else {
|
||||
caller_id_name = switch_channel_get_variable(tech_pvt->channel, "verto_remote_caller_id_name");
|
||||
caller_id_number = switch_channel_get_variable(tech_pvt->channel, "verto_remote_caller_id_number");
|
||||
cJSON_AddItemToObject(params, "display_direction",
|
||||
cJSON_CreateString(switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound"));
|
||||
|
||||
if (!caller_id_name) {
|
||||
caller_id_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name");
|
||||
}
|
||||
|
||||
if (!caller_id_number) {
|
||||
caller_id_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number");
|
||||
}
|
||||
}
|
||||
|
||||
if (zstr(caller_id_name)) {
|
||||
caller_id_name = "Outbound Call";
|
||||
}
|
||||
|
||||
if (zstr(caller_id_number)) {
|
||||
caller_id_number = switch_channel_get_variable(tech_pvt->channel, "destination_number");
|
||||
}
|
||||
|
||||
cJSON_AddItemToObject(params, "caller_id_name", cJSON_CreateString(caller_id_name));
|
||||
cJSON_AddItemToObject(params, "caller_id_number", cJSON_CreateString(caller_id_number));
|
||||
}
|
||||
|
||||
static jsock_t *get_jsock(const char *uuid)
|
||||
|
@ -1655,10 +1647,10 @@ static switch_status_t verto_on_init(switch_core_session_t *session)
|
|||
{
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
verto_pvt_t *tech_pvt = switch_core_session_get_private_class(session, SWITCH_PVT_SECONDARY);
|
||||
|
||||
|
||||
if (switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING_BRIDGE) || switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING)) {
|
||||
int tries = 120;
|
||||
|
||||
|
||||
switch_core_session_clear_crypto(session);
|
||||
|
||||
while(--tries > 0) {
|
||||
|
@ -1883,8 +1875,12 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
|
|||
|
||||
if (name || number) {
|
||||
jmsg = jrpc_new_req("verto.display", tech_pvt->call_id, ¶ms);
|
||||
switch_ivr_eavesdrop_update_display(session, name, number);
|
||||
switch_channel_set_variable(tech_pvt->channel, "last_sent_display_name", name);
|
||||
switch_channel_set_variable(tech_pvt->channel, "last_sent_display_number", number);
|
||||
cJSON_AddItemToObject(params, "display_name", cJSON_CreateString(name));
|
||||
cJSON_AddItemToObject(params, "display_number", cJSON_CreateString(number));
|
||||
set_call_params(params, tech_pvt);
|
||||
jsock_queue_event(jsock, &jmsg, SWITCH_TRUE);
|
||||
}
|
||||
|
||||
|
@ -3235,6 +3231,18 @@ static int start_jsock(verto_profile_t *profile, int sock)
|
|||
/* no nagle please */
|
||||
setsockopt(jsock->client_socket, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(flag));
|
||||
|
||||
|
||||
#if defined(SO_KEEPALIVE)
|
||||
setsockopt(jsock->client_socket, SOL_SOCKET, SO_KEEPALIVE, (void *)&flag, sizeof(flag));
|
||||
#endif
|
||||
flag = 30;
|
||||
#if defined(TCP_KEEPIDLE)
|
||||
setsockopt(jsock->client_socket, IPPROTO_TCP, TCP_KEEPIDLE, (void *)&flag, sizeof(flag));
|
||||
#endif
|
||||
#if defined(TCP_KEEPINTVL)
|
||||
setsockopt(jsock->client_socket, IPPROTO_TCP, TCP_KEEPINTVL, (void *)&flag, sizeof(flag));
|
||||
#endif
|
||||
|
||||
td = switch_core_alloc(jsock->pool, sizeof(*td));
|
||||
|
||||
td->alloc = 0;
|
||||
|
|
|
@ -446,6 +446,8 @@ SWITCH_STANDARD_APP(socket_function)
|
|||
|
||||
switch_socket_opt_set(new_sock, SWITCH_SO_KEEPALIVE, 1);
|
||||
switch_socket_opt_set(new_sock, SWITCH_SO_TCP_NODELAY, 1);
|
||||
switch_socket_opt_set(new_sock, SWITCH_SO_TCP_KEEPIDLE, 30);
|
||||
switch_socket_opt_set(new_sock, SWITCH_SO_TCP_KEEPINTVL, 30);
|
||||
|
||||
if (switch_socket_connect(new_sock, sa) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Socket Error!\n");
|
||||
|
|
|
@ -11,5 +11,12 @@
|
|||
<param name="server-host" value="192.168.0.69"/>
|
||||
<param name="server-port" value="12201"/>
|
||||
<param name="loglevel" value="warning"/>
|
||||
|
||||
<!-- fields to add to every log associated w/ a session -->
|
||||
<fields>
|
||||
<!-- for example: channel variable "customer_account_number" will be the data source for the customer field in graylog2 -->
|
||||
<field name="customer" variable="customer_account_number"/>
|
||||
</fields>
|
||||
</settings>
|
||||
</configuration>
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ static struct {
|
|||
switch_thread_rwlock_t *shutdown_rwlock;
|
||||
/** log delivery queue */
|
||||
switch_queue_t *log_queue;
|
||||
/** Fields to automatically add to session logs */
|
||||
switch_event_t *session_fields;
|
||||
} globals;
|
||||
|
||||
/**
|
||||
|
@ -85,6 +87,7 @@ static char *to_gelf(const switch_log_node_t *node, switch_log_level_t log_level
|
|||
char *parsed_full_message = NULL;
|
||||
char *field_name = NULL;
|
||||
switch_event_t *log_fields = NULL;
|
||||
switch_core_session_t *session = NULL;
|
||||
|
||||
cJSON_AddItemToObject(gelf, "version", cJSON_CreateString("1.1"));
|
||||
if ((hostname = switch_core_get_variable("hostname")) && !zstr(hostname)) {
|
||||
|
@ -117,27 +120,47 @@ static char *to_gelf(const switch_log_node_t *node, switch_log_level_t log_level
|
|||
full_message++;
|
||||
}
|
||||
|
||||
/* parse list of fields, if any */
|
||||
if (strncmp(full_message, "LOG_FIELDS", 10) == 0) {
|
||||
if (switch_event_create_brackets(full_message+10, '[', ']', ',', &log_fields, &parsed_full_message, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
switch_event_header_t *hp;
|
||||
for (hp = log_fields->headers; hp; hp = hp->next) {
|
||||
if (!zstr(hp->name) && !zstr(hp->value)) {
|
||||
if (strncmp(hp->name, "@#", 2) == 0) {
|
||||
field_name = switch_mprintf("_%s", hp->name + 2);
|
||||
cJSON_AddItemToObject(gelf, field_name, cJSON_CreateNumber(strtod(hp->value, NULL)));
|
||||
} else {
|
||||
field_name = switch_mprintf("_%s", hp->name);
|
||||
cJSON_AddItemToObject(gelf, field_name, cJSON_CreateString(hp->value));
|
||||
/* get fields from channel data, if configured */
|
||||
if (!zstr(node->userdata) && (session = switch_core_session_locate(node->userdata))) {
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
switch_event_header_t *hp;
|
||||
/* session_fields name mapped to variable name */
|
||||
for (hp = globals.session_fields->headers; hp; hp = hp->next) {
|
||||
if (!zstr(hp->name) && !zstr(hp->value)) {
|
||||
const char *val = switch_channel_get_variable(channel, hp->value);
|
||||
if (!zstr(val)) {
|
||||
if (!log_fields) {
|
||||
switch_event_create_plain(&log_fields, SWITCH_EVENT_CHANNEL_DATA);
|
||||
}
|
||||
free(field_name);
|
||||
switch_event_add_header_string(log_fields, SWITCH_STACK_BOTTOM, hp->name, val);
|
||||
}
|
||||
}
|
||||
|
||||
switch_event_destroy(&log_fields);
|
||||
full_message = parsed_full_message;
|
||||
}
|
||||
switch_core_session_rwunlock(session);
|
||||
}
|
||||
|
||||
/* parse list of fields from message text, if any */
|
||||
if (strncmp(full_message, "LOG_FIELDS", 10) == 0) {
|
||||
switch_event_create_brackets(full_message+10, '[', ']', ',', &log_fields, &parsed_full_message, SWITCH_TRUE);
|
||||
full_message = parsed_full_message;
|
||||
}
|
||||
|
||||
/* add additional fields */
|
||||
if (log_fields) {
|
||||
switch_event_header_t *hp;
|
||||
for (hp = log_fields->headers; hp; hp = hp->next) {
|
||||
if (!zstr(hp->name) && !zstr(hp->value)) {
|
||||
if (strncmp(hp->name, "@#", 2) == 0) {
|
||||
field_name = switch_mprintf("_%s", hp->name + 2);
|
||||
cJSON_AddItemToObject(gelf, field_name, cJSON_CreateNumber(strtod(hp->value, NULL)));
|
||||
} else {
|
||||
field_name = switch_mprintf("_%s", hp->name);
|
||||
cJSON_AddItemToObject(gelf, field_name, cJSON_CreateString(hp->value));
|
||||
}
|
||||
free(field_name);
|
||||
}
|
||||
}
|
||||
switch_event_destroy(&log_fields);
|
||||
}
|
||||
|
||||
cJSON_AddItemToObject(gelf, "full_message", cJSON_CreateString(full_message));
|
||||
|
@ -293,6 +316,7 @@ static switch_status_t do_config(void)
|
|||
|
||||
if ((settings = switch_xml_child(cfg, "settings"))) {
|
||||
switch_xml_t param;
|
||||
switch_xml_t fields;
|
||||
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
|
||||
char *name = (char *) switch_xml_attr_soft(param, "name");
|
||||
char *value = (char *) switch_xml_attr_soft(param, "value");
|
||||
|
@ -333,6 +357,25 @@ static switch_status_t do_config(void)
|
|||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring unknown param: \"%s\"\n", name);
|
||||
}
|
||||
}
|
||||
|
||||
/* map session fields to channel variables */
|
||||
if ((fields = switch_xml_child(settings, "fields"))) {
|
||||
switch_xml_t field;
|
||||
for (field = switch_xml_child(fields, "field"); field; field = field->next) {
|
||||
char *name = (char *) switch_xml_attr_soft(field, "name");
|
||||
char *variable = (char *) switch_xml_attr_soft(field, "variable");
|
||||
if (zstr(name)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring unnamed session field\n");
|
||||
continue;
|
||||
}
|
||||
if (zstr(variable)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring empty channel variable for session field \"%s\"\n", name);
|
||||
continue;
|
||||
}
|
||||
switch_event_add_header_string(globals.session_fields, SWITCH_STACK_BOTTOM,
|
||||
switch_core_strdup(globals.pool, name), switch_core_strdup(globals.pool, variable));
|
||||
}
|
||||
}
|
||||
}
|
||||
switch_xml_free(xml);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
@ -345,6 +388,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_graylog2_load)
|
|||
memset(&globals, 0, sizeof(globals));
|
||||
globals.pool = pool;
|
||||
|
||||
switch_event_create_plain(&globals.session_fields, SWITCH_EVENT_CHANNEL_DATA);
|
||||
|
||||
if (do_config() != SWITCH_STATUS_SUCCESS) {
|
||||
return SWITCH_STATUS_TERM;
|
||||
}
|
||||
|
@ -362,7 +407,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_graylog2_shutdown)
|
|||
{
|
||||
switch_log_unbind_logger(mod_graylog2_logger);
|
||||
stop_deliver_graylog2_thread();
|
||||
|
||||
if (globals.session_fields) {
|
||||
switch_event_destroy(&globals.session_fields);
|
||||
}
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -362,6 +362,7 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
|
|||
char *variable = (char *) switch_xml_attr(param, "variable");
|
||||
char *variable_secondary = (char *) switch_xml_attr(param, "variable_secondary");
|
||||
char *val_default = (char *) switch_xml_attr(param, "default");
|
||||
char *skip_if_set = (char *) switch_xml_attr(param, "skip_if_set");
|
||||
char *format = (char *) switch_xml_attr(param, "format");
|
||||
char *other_leg = (char *) switch_xml_attr(param, "other_leg");
|
||||
|
||||
|
@ -399,6 +400,9 @@ switch_status_t mod_xml_radius_add_params(switch_core_session_t *session, switch
|
|||
if ( var ) {
|
||||
if ( session ) {
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
if ( skip_if_set && switch_channel_get_variable(channel, skip_if_set) ) {
|
||||
goto end_loop;
|
||||
}
|
||||
|
||||
/* Accounting only */
|
||||
if ( strncmp( var, "h323-setup-time", 15) == 0 ) {
|
||||
|
|
10
src/switch.c
10
src/switch.c
|
@ -251,7 +251,7 @@ static int check_fd(int fd, int ms)
|
|||
|
||||
if ((pfds[0].revents & POLLIN)) {
|
||||
if ((i = read(fd, &r, sizeof(r))) > -1) {
|
||||
i = write(fd, &r, sizeof(r));
|
||||
(void)write(fd, &r, sizeof(r));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -962,7 +962,7 @@ int main(int argc, char *argv[])
|
|||
else if (!strcmp(local_argv[x], "-certs")) {
|
||||
x++;
|
||||
if (switch_strlen_zero(local_argv[x]) || is_option(local_argv[x])) {
|
||||
fprintf(stderr, "When using -certs you must specify a grammar directory\n");
|
||||
fprintf(stderr, "When using -certs you must specify a certificates directory\n");
|
||||
return 255;
|
||||
}
|
||||
|
||||
|
@ -1053,7 +1053,7 @@ int main(int argc, char *argv[])
|
|||
setrlimit(RLIMIT_STACK, &rlp);
|
||||
|
||||
apr_terminate();
|
||||
ret = (int) execv(argv[0], argv);
|
||||
if (argv) ret = (int) execv(argv[0], argv);
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[i]);
|
||||
|
@ -1189,7 +1189,7 @@ int main(int argc, char *argv[])
|
|||
if ((i = write(fds[1], &v, sizeof(v))) < 0) {
|
||||
fprintf(stderr, "System Error [%s]\n", strerror(errno));
|
||||
} else {
|
||||
i = read(fds[1], &v, sizeof(v));
|
||||
(void)read(fds[1], &v, sizeof(v));
|
||||
}
|
||||
|
||||
shutdown(fds[1], 2);
|
||||
|
@ -1215,7 +1215,7 @@ int main(int argc, char *argv[])
|
|||
int j = 0;
|
||||
|
||||
switch_sleep(1000000);
|
||||
if (execv(argv[0], argv) == -1) {
|
||||
if (!argv || execv(argv[0], argv) == -1) {
|
||||
fprintf(stderr, "Restart Failed [%s] resorting to plan b\n", strerror(errno));
|
||||
for (j = 0; j < argc; j++) {
|
||||
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[j]);
|
||||
|
|
|
@ -789,6 +789,34 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa
|
|||
|
||||
SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t *sock, int32_t opt, int32_t on)
|
||||
{
|
||||
if (opt == SWITCH_SO_TCP_KEEPIDLE) {
|
||||
int r = -10;
|
||||
|
||||
#if defined(TCP_KEEPIDLE)
|
||||
r = setsockopt(jsock->client_socket, SOL_TCP, TCP_KEEPIDLE, (void *)&on, sizeof(on));
|
||||
#endif
|
||||
if (r == -10) {
|
||||
return SWITCH_STATUS_NOTIMPL;
|
||||
}
|
||||
|
||||
|
||||
return r ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (opt == SWITCH_SO_TCP_KEEPINTVL) {
|
||||
int r = -10;
|
||||
|
||||
#if defined(TCP_KEEPINTVL)
|
||||
r = setsockopt(jsock->client_socket, SOL_TCP, TCP_KEEPINTVL, (void *)&on, sizeof(on));
|
||||
#endif
|
||||
|
||||
if (r == -10) {
|
||||
return SWITCH_STATUS_NOTIMPL;
|
||||
}
|
||||
|
||||
return r ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return apr_socket_opt_set(sock, opt, on);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,14 +109,35 @@ static void check_ip(void)
|
|||
char old_ip6[256] = "";
|
||||
int ok4 = 1, ok6 = 1;
|
||||
int mask = 0;
|
||||
switch_status_t check6, check4;
|
||||
switch_event_t *event;
|
||||
char *hostname = switch_core_get_variable("hostname");
|
||||
|
||||
gethostname(runtime.hostname, sizeof(runtime.hostname));
|
||||
switch_core_set_variable("hostname", runtime.hostname);
|
||||
|
||||
switch_find_local_ip(guess_ip4, sizeof(guess_ip4), &mask, AF_INET);
|
||||
switch_find_local_ip(guess_ip6, sizeof(guess_ip6), NULL, AF_INET6);
|
||||
if (zstr(hostname)) {
|
||||
switch_core_set_variable("hostname", runtime.hostname);
|
||||
} 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, "new-hostname", runtime.hostname);
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
if (!*main_ip4) {
|
||||
switch_core_set_variable("hostname", runtime.hostname);
|
||||
}
|
||||
|
||||
check4 = switch_find_local_ip(guess_ip4, sizeof(guess_ip4), &mask, AF_INET);
|
||||
check6 = switch_find_local_ip(guess_ip6, sizeof(guess_ip6), NULL, AF_INET6);
|
||||
|
||||
if (check6 != SWITCH_STATUS_SUCCESS && (zstr(main_ip6) || !strcasecmp(main_ip6, "::1"))) {
|
||||
check6 = SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
if (check4 != SWITCH_STATUS_SUCCESS) {
|
||||
ok4 = 2;
|
||||
} else if (!*main_ip4) {
|
||||
switch_set_string(main_ip4, guess_ip4);
|
||||
} else {
|
||||
if (!(ok4 = !strcmp(main_ip4, guess_ip4))) {
|
||||
|
@ -130,7 +151,9 @@ static void check_ip(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (!*main_ip6) {
|
||||
if (check6 != SWITCH_STATUS_SUCCESS) {
|
||||
ok6 = 2;
|
||||
} else if (!*main_ip6) {
|
||||
switch_set_string(main_ip6, guess_ip6);
|
||||
} else {
|
||||
if (!(ok6 = !strcmp(main_ip6, guess_ip6))) {
|
||||
|
@ -141,8 +164,6 @@ static void check_ip(void)
|
|||
}
|
||||
|
||||
if (!ok4 || !ok6) {
|
||||
switch_event_t *event;
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_TRAP) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "condition", "network-address-change");
|
||||
if (!ok4) {
|
||||
|
@ -156,6 +177,21 @@ static void check_ip(void)
|
|||
switch_event_fire(&event);
|
||||
}
|
||||
}
|
||||
|
||||
if (ok4 == 2 || ok6 == 2) {
|
||||
if (switch_event_create(&event, SWITCH_EVENT_TRAP) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "condition", "network-outage");
|
||||
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "network-status-v4", ok4 == 2 ? "disconnected" : "active");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "network-address-v4", main_ip4);
|
||||
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "network-status-v6", ok6 == 2 ? "disconnected" : "active");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "network-address-v6", main_ip6);
|
||||
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_SCHED_FUNC(heartbeat_callback)
|
||||
|
|
|
@ -752,6 +752,7 @@ static const char *message_names[] = {
|
|||
"STUN_ERROR",
|
||||
"MEDIA_RENEG",
|
||||
"KEEPALIVE",
|
||||
"REFER_EVENT",
|
||||
"ANSWER_EVENT",
|
||||
"PROGRESS_EVENT",
|
||||
"RING_EVENT",
|
||||
|
|
|
@ -2308,6 +2308,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_
|
|||
}
|
||||
|
||||
switch_xml_set_attr_d(cdr, "core-uuid", switch_core_get_uuid());
|
||||
switch_xml_set_attr_d(cdr, "switchname", switch_core_get_switchname());
|
||||
|
||||
if (!(x_channel_data = switch_xml_add_child_d(cdr, "channel_data", cdr_off++))) {
|
||||
goto error;
|
||||
|
@ -2681,7 +2682,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_json_cdr(switch_core_session
|
|||
char tmp[512], *f;
|
||||
|
||||
cJSON_AddItemToObject(cdr, "core-uuid", cJSON_CreateString(switch_core_get_uuid()));
|
||||
|
||||
cJSON_AddItemToObject(cdr, "switchname", cJSON_CreateString(switch_core_get_switchname()));
|
||||
j_channel_data = cJSON_CreateObject();
|
||||
|
||||
cJSON_AddItemToObject(cdr, "channel_data", j_channel_data);
|
||||
|
|
|
@ -1691,7 +1691,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_uuid_bridge(const char *originator_uu
|
|||
|
||||
|
||||
if (switch_channel_direction(originator_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(originator_channel, CF_DIALPLAN)) {
|
||||
switch_channel_flip_cid(originator_channel);
|
||||
if (!switch_channel_test_flag(originator_channel, CF_RECOVERING_BRIDGE)) {
|
||||
switch_channel_flip_cid(originator_channel);
|
||||
}
|
||||
switch_channel_set_flag(originator_channel, CF_DIALPLAN);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ static void release_backend(switch_limit_interface_t *limit) {
|
|||
|
||||
SWITCH_DECLARE(void) switch_limit_init(switch_memory_pool_t *pool) {
|
||||
if (switch_event_reserve_subclass(LIMIT_EVENT_USAGE) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldnt register event subclass \"%s\"", LIMIT_EVENT_USAGE);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register event subclass \"%s\"", LIMIT_EVENT_USAGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ SWITCH_DECLARE(switch_status_t) switch_resample_perform_create(switch_audio_resa
|
|||
resampler->factor = (lto_rate / lfrom_rate);
|
||||
resampler->rfactor = (lfrom_rate / lto_rate);
|
||||
resampler->to_size = resample_buffer(to_rate, from_rate, (uint32_t) to_size);
|
||||
resampler->to = malloc(resampler->to_size * sizeof(int16_t) * channels);
|
||||
resampler->to = malloc(resampler->to_size * sizeof(int16_t) * (channels ? channels : 1));
|
||||
resampler->channels = channels;
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
|
|
@ -1056,6 +1056,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
|
|||
char ipbuf[25];
|
||||
switch_sockaddr_t *from_addr = rtp_session->from_addr;
|
||||
switch_socket_t *sock_output = rtp_session->sock_output;
|
||||
uint8_t hosts_set = 0;
|
||||
|
||||
if (is_rtcp) {
|
||||
from_addr = rtp_session->rtcp_from_addr;
|
||||
|
@ -1078,6 +1079,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
|
|||
switch_stun_packet_attribute_add_xor_binded_address(rpacket, (char *) remote_ip, switch_sockaddr_get_port(from_addr));
|
||||
|
||||
if (!switch_cmp_addr(from_addr, ice->addr)) {
|
||||
hosts_set++;
|
||||
host = switch_get_addr(buf, sizeof(buf), from_addr);
|
||||
port = switch_sockaddr_get_port(from_addr);
|
||||
host2 = switch_get_addr(buf2, sizeof(buf2), ice->addr);
|
||||
|
@ -1088,7 +1090,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
|
|||
switch_stun_packet_attribute_add_integrity(rpacket, ice->pass);
|
||||
switch_stun_packet_attribute_add_fingerprint(rpacket);
|
||||
} else {
|
||||
if (!switch_cmp_addr(from_addr, ice->addr)) {
|
||||
if (hosts_set) {
|
||||
switch_sockaddr_info_get(&ice->addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE,
|
||||
|
@ -1111,7 +1113,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
|
|||
|
||||
bytes = switch_stun_packet_length(rpacket);
|
||||
|
||||
if (!ice->rready && (ice->type & ICE_VANILLA) && ice->ice_params && !switch_cmp_addr(from_addr, ice->addr)) {
|
||||
if (!ice->rready && (ice->type & ICE_VANILLA) && ice->ice_params && hosts_set && !switch_cmp_addr(from_addr, ice->addr)) {
|
||||
int i = 0;
|
||||
|
||||
ice->missed_count = 0;
|
||||
|
|
|
@ -167,7 +167,7 @@ void stfu_global_set_default_logger(int level)
|
|||
|
||||
static stfu_status_t stfu_n_resize_aqueue(stfu_queue_t *queue, uint32_t qlen)
|
||||
{
|
||||
unsigned char *m;
|
||||
struct stfu_frame *m;
|
||||
|
||||
if (qlen <= queue->real_array_size) {
|
||||
queue->array_size = qlen;
|
||||
|
@ -177,8 +177,8 @@ static stfu_status_t stfu_n_resize_aqueue(stfu_queue_t *queue, uint32_t qlen)
|
|||
} else {
|
||||
m = realloc(queue->array, qlen * sizeof(struct stfu_frame));
|
||||
assert(m);
|
||||
memset(m + queue->array_size * sizeof(struct stfu_frame), 0, (qlen * sizeof(struct stfu_frame)) - (queue->array_size * sizeof(struct stfu_frame)));
|
||||
queue->array = (struct stfu_frame *) m;
|
||||
memset(m + queue->array_size, 0, (qlen - queue->array_size) * sizeof(struct stfu_frame));
|
||||
queue->array = m;
|
||||
queue->real_array_size = queue->array_size = qlen;
|
||||
}
|
||||
|
||||
|
|
|
@ -1569,7 +1569,6 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma
|
|||
doh:
|
||||
if (tmp_socket > 0) {
|
||||
close(tmp_socket);
|
||||
tmp_socket = -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2994,21 +2993,19 @@ SWITCH_DECLARE(int) switch_fulldate_cmp(const char *exp, switch_time_t *ts)
|
|||
char *dup = strdup(exp);
|
||||
char *sStart;
|
||||
char *sEnd;
|
||||
char *sDate;
|
||||
char *sTime;
|
||||
switch_time_t tsStart;
|
||||
switch_time_t tsEnd;
|
||||
struct tm tmTmp;
|
||||
int year, month, day;
|
||||
int hour, min, sec;
|
||||
|
||||
switch_assert(dup);
|
||||
|
||||
sStart = dup;
|
||||
if ((sEnd=strchr(dup, '~'))) {
|
||||
char *sDate = sStart;
|
||||
char *sTime;
|
||||
*sEnd++ = '\0';
|
||||
sDate = sStart;
|
||||
if ((sTime=strchr(sStart, ' '))) {
|
||||
switch_time_t tsStart;
|
||||
struct tm tmTmp;
|
||||
int year = 1970, month = 1, day = 1;
|
||||
int hour = 0, min = 0, sec = 0;
|
||||
*sTime++ = '\0';
|
||||
|
||||
memset(&tmTmp, 0, sizeof(tmTmp));
|
||||
|
@ -3026,6 +3023,10 @@ SWITCH_DECLARE(int) switch_fulldate_cmp(const char *exp, switch_time_t *ts)
|
|||
|
||||
sDate = sEnd;
|
||||
if ((sTime=strchr(sEnd, ' '))) {
|
||||
switch_time_t tsEnd;
|
||||
struct tm tmTmp;
|
||||
int year = 1970, month = 1, day = 1;
|
||||
int hour = 0, min = 0, sec = 0;
|
||||
*sTime++ = '\0';
|
||||
|
||||
memset(&tmTmp, 0, sizeof(tmTmp));
|
||||
|
|
|
@ -1376,7 +1376,7 @@ static int preprocess(const char *cwd, const char *file, FILE *write_fd, int rle
|
|||
|
||||
if (!(read_fd = fopen(file, "r"))) {
|
||||
const char *reason = strerror(errno);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldnt open %s (%s)\n", file, reason);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't open %s (%s)\n", file, reason);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue