mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-27 13:44:16 +00:00
Merge branch 'master' into FS-4558
This commit is contained in:
commit
3e26caf8ff
12 files changed
+321
-57
No files matched your search
@@ -2247,7 +2247,7 @@ static void fifo_caller_del(const char *uuid)
|
||||
if (uuid) {
|
||||
sql = switch_mprintf("delete from fifo_callers where uuid='%q'", uuid);
|
||||
} else {
|
||||
sql = switch_mprintf("delete from fifo_callers", uuid);
|
||||
sql = switch_mprintf("delete from fifo_callers");
|
||||
}
|
||||
|
||||
fifo_execute_sql(sql, globals.sql_mutex);
|
||||
@@ -4251,7 +4251,6 @@ static switch_status_t load_config(int reload, int del_all)
|
||||
}
|
||||
}
|
||||
switch_mutex_unlock(globals.mutex);
|
||||
fifo_caller_del(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -341,6 +341,7 @@ typedef enum {
|
||||
TFLAG_REINVITED,
|
||||
TFLAG_SLA_BARGE,
|
||||
TFLAG_SLA_BARGING,
|
||||
TFLAG_PASS_ACK,
|
||||
/* No new flags below this line */
|
||||
TFLAG_MAX
|
||||
} TFLAGS;
|
||||
|
||||
@@ -954,6 +954,36 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro
|
||||
switch_safe_free(dup);
|
||||
}
|
||||
|
||||
static void tech_send_ack(nua_handle_t *nh, private_object_t *tech_pvt)
|
||||
{
|
||||
const char *invite_full_from = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_from");
|
||||
const char *invite_full_to = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_to");
|
||||
|
||||
|
||||
if (sofia_test_pflag(tech_pvt->profile, PFLAG_TRACK_CALLS)) {
|
||||
const char *invite_full_via = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_via");
|
||||
const char *invite_route_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_route_uri");
|
||||
|
||||
nua_ack(nh,
|
||||
TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)),
|
||||
TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)),
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
|
||||
TAG_IF((zstr(tech_pvt->user_via) && !zstr(invite_full_via)), SIPTAG_VIA_STR(invite_full_via)),
|
||||
TAG_IF(!zstr(invite_route_uri), SIPTAG_ROUTE_STR(invite_route_uri)),
|
||||
TAG_END());
|
||||
|
||||
|
||||
} else {
|
||||
nua_ack(nh,
|
||||
TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)),
|
||||
TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)),
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
|
||||
TAG_END());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//sofia_dispatch_event_t *de
|
||||
static void our_sofia_event_callback(nua_event_t event,
|
||||
int status,
|
||||
@@ -1124,6 +1154,24 @@ static void our_sofia_event_callback(nua_event_t event,
|
||||
extract_header_vars(profile, sip, session, nh);
|
||||
switch_core_recovery_track(session);
|
||||
sofia_set_flag(tech_pvt, TFLAG_GOT_ACK);
|
||||
|
||||
if (sofia_test_flag(tech_pvt, TFLAG_PASS_ACK)) {
|
||||
switch_core_session_t *other_session;
|
||||
|
||||
sofia_clear_flag(tech_pvt, TFLAG_PASS_ACK);
|
||||
|
||||
|
||||
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
if (switch_core_session_compare(session, other_session)) {
|
||||
private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
|
||||
tech_send_ack(other_tech_pvt->nh, other_tech_pvt);
|
||||
}
|
||||
switch_core_session_rwunlock(other_session);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
case nua_r_ack:
|
||||
@@ -6311,16 +6359,18 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
break;
|
||||
case nua_callstate_completing:
|
||||
{
|
||||
const char *invite_full_from = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_from");
|
||||
const char *invite_full_to = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_to");
|
||||
const char *wait_for_ack = switch_channel_get_variable(channel, "sip_wait_for_aleg_ack");
|
||||
int send_ack = 1;
|
||||
|
||||
if (switch_true(wait_for_ack)) {
|
||||
switch_core_session_t *other_session;
|
||||
|
||||
if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
|
||||
switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL);
|
||||
if (switch_core_session_compare(session, other_session)) {
|
||||
private_object_t *other_tech_pvt = switch_core_session_get_private(other_session);
|
||||
sofia_set_flag(other_tech_pvt, TFLAG_PASS_ACK);
|
||||
send_ack = 0;
|
||||
}
|
||||
switch_core_session_rwunlock(other_session);
|
||||
}
|
||||
}
|
||||
@@ -6341,26 +6391,13 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
|
||||
}
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_TRACK_CALLS)) {
|
||||
const char *invite_full_via = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_via");
|
||||
const char *invite_route_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_route_uri");
|
||||
|
||||
nua_ack(nh,
|
||||
TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)),
|
||||
TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)),
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
|
||||
TAG_IF((zstr(tech_pvt->user_via) && !zstr(invite_full_via)), SIPTAG_VIA_STR(invite_full_via)),
|
||||
|
||||
TAG_IF(!zstr(invite_route_uri), SIPTAG_ROUTE_STR(invite_route_uri)),
|
||||
TAG_END());
|
||||
|
||||
if (send_ack) {
|
||||
tech_send_ack(nh, tech_pvt);
|
||||
} else {
|
||||
nua_ack(nh,
|
||||
TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)),
|
||||
TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)),
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
|
||||
TAG_END());
|
||||
ss_state = nua_callstate_ready;
|
||||
goto state_process;
|
||||
}
|
||||
|
||||
}
|
||||
goto done;
|
||||
case nua_callstate_received:
|
||||
|
||||
@@ -3915,9 +3915,9 @@ void sofia_glue_pass_zrtp_hash2(switch_core_session_t *aleg_session, switch_core
|
||||
bleg_channel = switch_core_session_get_channel(bleg_session);
|
||||
bleg_tech_pvt = switch_core_session_get_private(bleg_session);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_channel), SWITCH_LOG_DEBUG, "Deciding whether to pass zrtp-hash between a-leg and b-leg\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_channel), SWITCH_LOG_DEBUG1, "Deciding whether to pass zrtp-hash between a-leg and b-leg\n");
|
||||
if (!(switch_channel_test_flag(aleg_tech_pvt->channel, CF_ZRTP_PASSTHRU_REQ))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_channel), SWITCH_LOG_DEBUG, "CF_ZRTP_PASSTHRU_REQ not set on a-leg, so not propagating zrtp-hash\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(aleg_channel), SWITCH_LOG_DEBUG1, "CF_ZRTP_PASSTHRU_REQ not set on a-leg, so not propagating zrtp-hash\n");
|
||||
return;
|
||||
}
|
||||
if (aleg_tech_pvt->remote_sdp_audio_zrtp_hash) {
|
||||
@@ -3947,15 +3947,15 @@ void sofia_glue_pass_zrtp_hash(switch_core_session_t *session)
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_core_session_t *other_session;
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Deciding whether to pass zrtp-hash between legs\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "Deciding whether to pass zrtp-hash between legs\n");
|
||||
if (!(switch_channel_test_flag(tech_pvt->channel, CF_ZRTP_PASSTHRU_REQ))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "CF_ZRTP_PASSTHRU_REQ not set, so not propagating zrtp-hash\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "CF_ZRTP_PASSTHRU_REQ not set, so not propagating zrtp-hash\n");
|
||||
return;
|
||||
} else if (!(switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "No partner channel found, so not propagating zrtp-hash\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "No partner channel found, so not propagating zrtp-hash\n");
|
||||
return;
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Found peer channel; propagating zrtp-hash if set\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "Found peer channel; propagating zrtp-hash if set\n");
|
||||
sofia_glue_pass_zrtp_hash2(session, other_session);
|
||||
switch_core_session_rwunlock(other_session);
|
||||
}
|
||||
@@ -3969,7 +3969,7 @@ static void find_zrtp_hash(switch_core_session_t *session, sdp_session_t *sdp)
|
||||
sdp_attribute_t *attr;
|
||||
int got_audio = 0, got_video = 0;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Looking for zrtp-hash\n");
|
||||
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "Looking for zrtp-hash\n");
|
||||
for (m = sdp->sdp_media; m; m = m->m_next) {
|
||||
if (got_audio && got_video) break;
|
||||
if (m->m_port && ((m->m_type == sdp_media_audio && !got_audio)
|
||||
|
||||
@@ -145,6 +145,8 @@ namespace FreeSWITCH.Native
|
||||
switch_state_handler_t_delegate del = ptr => {
|
||||
using (var sess = new ManagedSession(new SWIGTYPE_p_switch_core_session(ptr, false))) {
|
||||
handler(sess);
|
||||
sess.SetAutoHangup(false);
|
||||
sess.destroy();
|
||||
return switch_status_t.SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user