Merge branch 'signalwire:master' into patch-1
This commit is contained in:
commit
f49ee553ef
|
@ -9,11 +9,11 @@
|
|||
|
||||
Before you start to modify this default please visit this wiki page:
|
||||
|
||||
http://wiki.freeswitch.org/wiki/Getting_Started_Guide#Some_stuff_to_try_out.21
|
||||
https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Configuration/Default-Configuration_6587388/#6-configuration-files
|
||||
|
||||
If all else fails you can read our FAQ located at:
|
||||
|
||||
http://wiki.freeswitch.org/wiki/FreeSwitch_FAQ
|
||||
https://developer.signalwire.com/freeswitch/FreeSWITCH-Explained/Miscellaneous/FAQ/
|
||||
|
||||
NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE
|
||||
-->
|
||||
|
|
|
@ -627,13 +627,27 @@ switch_status_t mariadb_send_query(mariadb_handle_t *handle, const char* sql)
|
|||
{
|
||||
char *err_str;
|
||||
int ret;
|
||||
unsigned retries = 60; /* 60 tries, will take 30 to 60 seconds at worst */
|
||||
|
||||
switch_safe_free(handle->sql);
|
||||
handle->sql = strdup(sql);
|
||||
again:
|
||||
handle->stored_results = 0;
|
||||
ret = mysql_real_query(&handle->con, sql, (unsigned long)strlen(sql));
|
||||
if (ret) {
|
||||
err_str = mariadb_handle_get_error(handle);
|
||||
if (strstr(err_str, "Deadlock found when trying to get lock; try restarting transaction")) {
|
||||
if (--retries > 0) {
|
||||
switch_safe_free(err_str);
|
||||
/* We are waiting for 500 ms and random time is not more than 500 ms.
|
||||
This is necessary so that the delay on the primary and secondary servers does not coincide and deadlock does not occur again. */
|
||||
switch_yield(500 + (rand() & 511));
|
||||
goto again;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "DeadLock. The retries are over.\n");
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to send query (%s) to database: %s\n", sql, err_str);
|
||||
switch_safe_free(err_str);
|
||||
mariadb_finish_results(handle);
|
||||
|
|
|
@ -3865,6 +3865,15 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
|
|||
cJSON *i, *indialog = cJSON_GetObjectItem(msg, "inDialog");
|
||||
const char *body = cJSON_GetObjectCstr(msg, "body");
|
||||
switch_bool_t is_dialog = indialog && (indialog->type == cJSON_True || (indialog->type == cJSON_String && switch_true(indialog->valuestring)));
|
||||
const char *context = NULL;
|
||||
|
||||
switch_mutex_lock(jsock->flag_mutex);
|
||||
|
||||
if (!(context = switch_event_get_header(jsock->vars, "user_context"))) {
|
||||
context = switch_either(jsock->context, jsock->profile->context);
|
||||
}
|
||||
|
||||
switch_mutex_unlock(jsock->flag_mutex);
|
||||
|
||||
if (!zstr(to)) {
|
||||
if (strchr(to, '+')) {
|
||||
|
@ -3901,6 +3910,8 @@ static switch_bool_t verto__info_func(const char *method, cJSON *params, jsock_t
|
|||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call_id", call_id);
|
||||
}
|
||||
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "context", context);
|
||||
|
||||
switch_event_add_body(event, "%s", body);
|
||||
|
||||
if (strcasecmp(proto, VERTO_CHAT_PROTO)) {
|
||||
|
|
|
@ -98,6 +98,8 @@ static switch_status_t mod_logfile_openlogfile(logfile_profile_t *profile, switc
|
|||
|
||||
stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_OS_DEFAULT, module_pool);
|
||||
if (stat != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "logfile %s open error, status=%d\n", profile->logfile, stat);
|
||||
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
|
@ -459,7 +461,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_logfile_load)
|
|||
if ((profiles = switch_xml_child(cfg, "profiles"))) {
|
||||
for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) {
|
||||
if (load_profile(xprofile) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error loading profile.");
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error loading profile.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1849,7 +1849,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)
|
|||
SWITCH_STANDARD_STREAM(mystream);
|
||||
|
||||
if (!strcasecmp(argv[0], "stickyadd")) {
|
||||
mystream.write_function(&mystream, "insert into complete values (1,");
|
||||
mystream.write_function(&mystream, "insert into complete (sticky, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, hostname) values (1,");
|
||||
for (x = 0; x < 10; x++) {
|
||||
if (argv[x + 1] && !strcasecmp(argv[x + 1], "_any_")) {
|
||||
mystream.write_function(&mystream, "%s", "'', ");
|
||||
|
@ -1865,7 +1865,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)
|
|||
switch_core_sql_exec(mystream.data);
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
} else if (!strcasecmp(argv[0], "add")) {
|
||||
mystream.write_function(&mystream, "insert into complete values (0,");
|
||||
mystream.write_function(&mystream, "insert into complete (sticky, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, hostname) values (0,");
|
||||
for (x = 0; x < 10; x++) {
|
||||
if (argv[x + 1] && !strcasecmp(argv[x + 1], "_any_")) {
|
||||
mystream.write_function(&mystream, "%s", "'', ");
|
||||
|
|
|
@ -4499,19 +4499,28 @@ struct matches {
|
|||
int codec_idx;
|
||||
};
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
static void greedy_sort(switch_media_handle_t *smh, struct matches *matches, int m_idx, const switch_codec_implementation_t **codec_array, int total_codecs)
|
||||
{
|
||||
int j = 0, f = 0, g;
|
||||
struct matches mtmp[MAX_MATCHES] = { { 0 } };
|
||||
|
||||
m_idx = MIN(m_idx, MAX_MATCHES);
|
||||
|
||||
for(j = 0; j < m_idx; j++) {
|
||||
*&mtmp[j] = *&matches[j];
|
||||
}
|
||||
for (g = 0; g < smh->mparams->num_codecs && g < total_codecs; g++) {
|
||||
}
|
||||
|
||||
for (g = 0; g < smh->mparams->num_codecs && g < total_codecs && f < MAX_MATCHES; g++) {
|
||||
const switch_codec_implementation_t *imp = codec_array[g];
|
||||
|
||||
for(j = 0; j < m_idx; j++) {
|
||||
if (mtmp[j].imp == imp) {
|
||||
if (mtmp[j].imp && mtmp[j].imp == imp) {
|
||||
*&matches[f++] = *&mtmp[j];
|
||||
mtmp[j].imp = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5545,6 +5554,13 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
|
|||
/* ptime does not match */
|
||||
match = 0;
|
||||
|
||||
if (nm_idx >= MAX_MATCHES) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
|
||||
"Audio Codec Compare [%s:%d:%u:%u:%d:%u:%d] was not saved as a near-match. Too many. Ignoring.\n",
|
||||
imp->iananame, imp->ianacode, codec_rate, imp->actual_samples_per_second, imp->microseconds_per_packet / 1000, bit_rate, imp->number_of_channels);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
|
||||
"Audio Codec Compare [%s:%d:%u:%d:%u:%d] is saved as a near-match\n",
|
||||
imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000, bit_rate, imp->number_of_channels);
|
||||
|
@ -6153,10 +6169,18 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
|
|||
imp->iananame, map->rm_pt);
|
||||
|
||||
m_idx++;
|
||||
|
||||
if (m_idx >= MAX_MATCHES) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
vmatch = 0;
|
||||
}
|
||||
|
||||
if (m_idx >= MAX_MATCHES) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (consider_video_fmtp && (!m_idx || almost_vmatch)) {
|
||||
|
|
|
@ -3642,10 +3642,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
|
|||
unsigned long ssl_ctx_error = 0;
|
||||
const SSL_METHOD *ssl_method;
|
||||
SSL_CTX *ssl_ctx;
|
||||
#if OPENSSL_VERSION_NUMBER < 0x30000000
|
||||
BIO *bio;
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000
|
||||
EVP_PKEY *dh_pk;
|
||||
#else
|
||||
DH *dh;
|
||||
#endif
|
||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||
|
@ -3726,21 +3724,18 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_dtls(switch_rtp_t *rtp_session, d
|
|||
|
||||
switch_assert(dtls->ssl_ctx);
|
||||
|
||||
bio = BIO_new_file(dtls->pem, "r");
|
||||
#if OPENSSL_VERSION_NUMBER < 0x30000000
|
||||
bio = BIO_new_file(dtls->pem, "r");
|
||||
dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
|
||||
BIO_free(bio);
|
||||
if (dh) {
|
||||
SSL_CTX_set_tmp_dh(dtls->ssl_ctx, dh);
|
||||
DH_free(dh);
|
||||
}
|
||||
#else
|
||||
if((dh_pk = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL)) != NULL) {
|
||||
SSL_CTX_set0_tmp_dh_pkey(dtls->ssl_ctx, dh_pk);
|
||||
EVP_PKEY_free(dh_pk);
|
||||
#else
|
||||
if(!SSL_CTX_set_dh_auto(dtls->ssl_ctx, 1)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Failed enable auto DH!\n");
|
||||
}
|
||||
|
||||
BIO_free(bio);
|
||||
#endif
|
||||
SSL_CTX_set_mode(dtls->ssl_ctx, SSL_MODE_AUTO_RETRY);
|
||||
|
||||
|
|
Loading…
Reference in New Issue