mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-14 23:34:13 +00:00
Merge branch 'master' of ssh://git.freeswitch.org:222/freeswitch
This commit is contained in:
commit
b65a3ebd18
76 files changed
+2102
-519
No files matched your search
@@ -30,6 +30,7 @@
|
||||
*
|
||||
*/
|
||||
#include <switch.h>
|
||||
#include <switch_ssl.h>
|
||||
#include <switch_stun.h>
|
||||
#include <libdingaling.h>
|
||||
|
||||
@@ -1399,7 +1400,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
{
|
||||
struct private_object *tech_pvt = NULL;
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
int payload = 0;
|
||||
//int payload = 0;
|
||||
|
||||
tech_pvt = (struct private_object *) switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
@@ -1443,7 +1444,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
||||
|
||||
|
||||
|
||||
payload = tech_pvt->read_frame.payload;
|
||||
//payload = tech_pvt->read_frame.payload;
|
||||
|
||||
#if 0
|
||||
elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000);
|
||||
@@ -1911,6 +1912,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dingaling_load)
|
||||
SWITCH_ADD_API(api_interface, "dingaling", "DingaLing Menu", dingaling, DINGALING_SYNTAX);
|
||||
SWITCH_ADD_CHAT(chat_interface, MDL_CHAT_PROTO, chat_send);
|
||||
|
||||
switch_ssl_init_ssl_locks();
|
||||
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -2008,6 +2012,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dingaling_shutdown)
|
||||
switch_safe_free(globals.codec_string);
|
||||
switch_safe_free(globals.codec_rates_string);
|
||||
|
||||
switch_ssl_destroy_ssl_locks();
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1 @@
|
||||
faststart and codecs v CallProceeding due to h323plus, grep "Very Frustrating - S.H." in h323plus
|
||||
source and uncomment commented lines.
|
||||
|
||||
|
||||
exploration form developer of h323plus:
|
||||
|
||||
Yes that should be mera.
|
||||
|
||||
The problem is that Callproceeding does not always come from the remote it
|
||||
may be generated by the gatekeeper. MERA where sending fast start elements
|
||||
in the Call proceeding and connect. The call proceeding where not valid and
|
||||
causing the media to fail. Normally (although valid) EP's do not set Fast
|
||||
Start in Call proceeding so the code was disabled to resolve the MERA issue.
|
||||
seems none for now
|
||||
@@ -1241,6 +1241,7 @@ static void start_udptl(private_object_t *tech_pvt, switch_t38_options_t *t38_op
|
||||
switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->rtp_session);
|
||||
const char *err, *val;
|
||||
|
||||
sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
|
||||
switch_rtp_udptl_mode(tech_pvt->rtp_session);
|
||||
|
||||
if (!t38_options || !t38_options->remote_ip) {
|
||||
@@ -1527,8 +1528,11 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
}
|
||||
|
||||
if (sofia_test_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE)) {
|
||||
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
|
||||
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
|
||||
if (!switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_UDPTL) &&
|
||||
!switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
|
||||
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
|
||||
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
|
||||
}
|
||||
sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
|
||||
}
|
||||
|
||||
@@ -2153,6 +2157,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
if (t38_options) {
|
||||
sofia_glue_set_image_sdp(tech_pvt, t38_options, 0);
|
||||
if (switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||
sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
|
||||
switch_rtp_udptl_mode(tech_pvt->rtp_session);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4514,6 +4514,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status
|
||||
|
||||
if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) {
|
||||
if (switch_rtp_ready(tech_pvt->rtp_session) && switch_rtp_ready(other_tech_pvt->rtp_session)) {
|
||||
sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE);
|
||||
switch_rtp_udptl_mode(tech_pvt->rtp_session);
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating T38 Passthru\n");
|
||||
}
|
||||
@@ -5558,13 +5559,6 @@ nua_handle_t *sofia_global_nua_handle_by_replaces(sip_replaces_t *replaces)
|
||||
const void *var;
|
||||
void *val;
|
||||
sofia_profile_t *profile;
|
||||
switch_xml_t xml_root;
|
||||
const char *err;
|
||||
|
||||
if ((xml_root = switch_xml_open_root(1, &err))) {
|
||||
switch_xml_free(xml_root);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Reload XML [%s]\n", err);
|
||||
}
|
||||
|
||||
switch_mutex_lock(mod_sofia_globals.hash_mutex);
|
||||
if (mod_sofia_globals.profile_hash) {
|
||||
|
||||
@@ -2171,6 +2171,15 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
if (!strncasecmp(url_str, "sips:", 5)) {
|
||||
s = url_str + 5;
|
||||
}
|
||||
|
||||
/* tel: patch from jaybinks, added by MC
|
||||
It compiles but I don't have a way to test it
|
||||
*/
|
||||
if (!strncasecmp(url_str, "tel:", 4)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session),
|
||||
SWITCH_LOG_ERROR, "URL Error! tel: uri's not supported at this time\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
if (!s) {
|
||||
s = url_str;
|
||||
}
|
||||
@@ -3009,6 +3018,21 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
|
||||
if (remote_host && remote_port && !strcmp(remote_host, tech_pvt->remote_sdp_audio_ip) && remote_port == tech_pvt->remote_sdp_audio_port) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Audio params are unchanged for %s.\n",
|
||||
switch_channel_get_name(tech_pvt->channel));
|
||||
if (switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||
if (tech_pvt->audio_recv_pt != tech_pvt->agreed_pt) {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
|
||||
"%s Set audio receive payload in Re-INVITE for non-matching dynamic PT to %u\n",
|
||||
switch_channel_get_name(tech_pvt->channel), tech_pvt->audio_recv_pt);
|
||||
|
||||
switch_rtp_set_recv_pt(tech_pvt->rtp_session, tech_pvt->audio_recv_pt);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
|
||||
"%s Setting audio receive payload in Re-INVITE to %u\n",
|
||||
switch_channel_get_name(tech_pvt->channel), tech_pvt->audio_recv_pt);
|
||||
switch_rtp_set_recv_pt(tech_pvt->rtp_session, tech_pvt->agreed_pt);
|
||||
}
|
||||
|
||||
}
|
||||
goto video;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Audio params changed for %s from %s:%d to %s:%d\n",
|
||||
@@ -3436,9 +3460,9 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
|
||||
|
||||
if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) && !switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) &&
|
||||
!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
|
||||
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_RAW_WRITE);
|
||||
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_RAW_WRITE);
|
||||
} else {
|
||||
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_RAW_WRITE);
|
||||
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_RAW_WRITE);
|
||||
}
|
||||
|
||||
if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
|
||||
|
||||
@@ -1417,6 +1417,11 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
}
|
||||
|
||||
if (!(nh = nua_handle_by_call_id(profile->nua, call_id))) {
|
||||
|
||||
if (mod_sofia_globals.debug_presence > 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find handle for call id %s\n", call_id);
|
||||
}
|
||||
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -1468,12 +1473,18 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
const char *astate = switch_str_nil(switch_event_get_header(helper->event, "astate"));
|
||||
const char *answer_state = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
|
||||
const char *dft_state;
|
||||
const char *from_id = switch_str_nil(switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Number"));
|
||||
const char *from_id;
|
||||
const char *to_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_to_user"));
|
||||
const char *from_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_from_user"));
|
||||
char *clean_to_user = NULL;
|
||||
char *clean_from_user = NULL;
|
||||
int force_status = 0;
|
||||
|
||||
if (!strcasecmp(direction, "inbound")) {
|
||||
from_id = switch_str_nil(switch_event_get_header(helper->event, "Caller-Destination-Number"));
|
||||
} else {
|
||||
from_id = switch_str_nil(switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Number"));
|
||||
}
|
||||
#if 0
|
||||
char *buf;
|
||||
switch_event_serialize(helper->event, &buf, SWITCH_FALSE);
|
||||
@@ -2175,58 +2186,79 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
||||
sip->sip_expires->ex_delta = 31536000;
|
||||
}
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_MULTIREG)) {
|
||||
sql = switch_mprintf("delete from sip_subscriptions where call_id='%q' "
|
||||
"or (proto='%q' and sip_user='%q' and sip_host='%q' "
|
||||
"and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q' "
|
||||
"and contact='%q')",
|
||||
call_id, proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname, contact_str);
|
||||
|
||||
} else {
|
||||
sql = switch_mprintf("delete from sip_subscriptions where "
|
||||
"proto='%q' and sip_user='%q' and sip_host='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q'",
|
||||
proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname);
|
||||
}
|
||||
|
||||
switch_mutex_lock(profile->ireg_mutex);
|
||||
switch_assert(sql != NULL);
|
||||
sofia_glue_actually_execute_sql(profile, sql, NULL);
|
||||
switch_safe_free(sql);
|
||||
|
||||
if (sub_state == nua_substate_terminated) {
|
||||
sstr = switch_mprintf("terminated");
|
||||
} else {
|
||||
sip_accept_t *ap = sip->sip_accept;
|
||||
char accept[256] = "";
|
||||
full_agent = sip_header_as_string(profile->home, (void *) sip->sip_user_agent);
|
||||
while (ap) {
|
||||
switch_snprintf(accept + strlen(accept), sizeof(accept) - strlen(accept), "%s%s ", ap->ac_type, ap->ac_next ? "," : "");
|
||||
ap = ap->ac_next;
|
||||
}
|
||||
|
||||
sql = switch_mprintf("insert into sip_subscriptions "
|
||||
"(proto,sip_user,sip_host,sub_to_user,sub_to_host,presence_hosts,event,contact,call_id,full_from,"
|
||||
"full_via,expires,user_agent,accept,profile_name,hostname,network_port,network_ip) "
|
||||
"values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%d','%q')",
|
||||
proto, from_user, from_host, to_user, to_host, profile->presence_hosts ? profile->presence_hosts : to_host,
|
||||
event, contact_str, call_id, full_from, full_via,
|
||||
//sofia_test_pflag(profile, PFLAG_MULTIREG) ? switch_epoch_time_now(NULL) + exp_delta : exp_delta * -1,
|
||||
|
||||
if ((sub_state == nua_substate_active) && (switch_stristr("dialog", (const char *) event))) {
|
||||
|
||||
sstr = switch_mprintf("active;expires=%ld", exp_delta);
|
||||
|
||||
sql = switch_mprintf("update sip_subscriptions "
|
||||
"set expires=%ld "
|
||||
"where call_id='%q' and event='dialog' and hostname='%q' ",
|
||||
(long) switch_epoch_time_now(NULL) + (exp_delta * 2),
|
||||
full_agent, accept, profile->name, mod_sofia_globals.hostname, np.network_port, np.network_ip);
|
||||
|
||||
switch_assert(sql != NULL);
|
||||
call_id,
|
||||
mod_sofia_globals.hostname);
|
||||
|
||||
|
||||
if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s SUBSCRIBE %s@%s %s@%s\n%s\n",
|
||||
profile->name, from_user, from_host, to_user, to_host, sql);
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"re-subscribe with dialog detected, sql: %s\n", sql);
|
||||
}
|
||||
|
||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||
} else {
|
||||
if (sofia_test_pflag(profile, PFLAG_MULTIREG)) {
|
||||
sql = switch_mprintf("delete from sip_subscriptions where call_id='%q' "
|
||||
"or (proto='%q' and sip_user='%q' and sip_host='%q' "
|
||||
"and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q' "
|
||||
"and contact='%q')",
|
||||
call_id, proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname, contact_str);
|
||||
|
||||
} else {
|
||||
sql = switch_mprintf("delete from sip_subscriptions where "
|
||||
"proto='%q' and sip_user='%q' and sip_host='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q'",
|
||||
proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname);
|
||||
}
|
||||
|
||||
switch_mutex_lock(profile->ireg_mutex);
|
||||
switch_assert(sql != NULL);
|
||||
sofia_glue_actually_execute_sql(profile, sql, NULL);
|
||||
switch_safe_free(sql);
|
||||
|
||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||
sstr = switch_mprintf("active;expires=%ld", exp_delta);
|
||||
if (sub_state == nua_substate_terminated) {
|
||||
sstr = switch_mprintf("terminated");
|
||||
} else {
|
||||
sip_accept_t *ap = sip->sip_accept;
|
||||
char accept[256] = "";
|
||||
full_agent = sip_header_as_string(profile->home, (void *) sip->sip_user_agent);
|
||||
while (ap) {
|
||||
switch_snprintf(accept + strlen(accept), sizeof(accept) - strlen(accept), "%s%s ", ap->ac_type, ap->ac_next ? "," : "");
|
||||
ap = ap->ac_next;
|
||||
}
|
||||
|
||||
sql = switch_mprintf("insert into sip_subscriptions "
|
||||
"(proto,sip_user,sip_host,sub_to_user,sub_to_host,presence_hosts,event,contact,call_id,full_from,"
|
||||
"full_via,expires,user_agent,accept,profile_name,hostname,network_port,network_ip) "
|
||||
"values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%d','%q')",
|
||||
proto, from_user, from_host, to_user, to_host, profile->presence_hosts ? profile->presence_hosts : to_host,
|
||||
event, contact_str, call_id, full_from, full_via,
|
||||
//sofia_test_pflag(profile, PFLAG_MULTIREG) ? switch_epoch_time_now(NULL) + exp_delta : exp_delta * -1,
|
||||
(long) switch_epoch_time_now(NULL) + (exp_delta * 2),
|
||||
full_agent, accept, profile->name, mod_sofia_globals.hostname, np.network_port, np.network_ip);
|
||||
|
||||
switch_assert(sql != NULL);
|
||||
|
||||
if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s SUBSCRIBE %s@%s %s@%s\n%s\n",
|
||||
profile->name, from_user, from_host, to_user, to_host, sql);
|
||||
}
|
||||
|
||||
|
||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||
sstr = switch_mprintf("active;expires=%ld", exp_delta);
|
||||
}
|
||||
|
||||
switch_mutex_unlock(profile->ireg_mutex);
|
||||
}
|
||||
|
||||
if (status < 200) {
|
||||
char *sticky = NULL;
|
||||
|
||||
Reference in new issue
Block a user