mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-14 15:24:13 +00:00
Merge branch 'master' into FS-4558
This commit is contained in:
commit
bf4bb0028e
20 files changed
+283
-69
No files matched your search
@@ -1547,6 +1547,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
case SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH:
|
||||
case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC:
|
||||
break;
|
||||
|
||||
case SWITCH_MESSAGE_INDICATE_PROXY_MEDIA:
|
||||
{
|
||||
if (switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||
@@ -1849,6 +1850,43 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
}
|
||||
|
||||
switch (msg->message_id) {
|
||||
|
||||
case SWITCH_MESSAGE_INDICATE_MEDIA_RENEG:
|
||||
{
|
||||
switch_core_session_t *nsession;
|
||||
|
||||
if (msg->string_arg) {
|
||||
switch_channel_set_variable(channel, "absolute_codec_string", NULL);
|
||||
if (*msg->string_arg == '=') {
|
||||
switch_channel_set_variable(channel, "codec_string", msg->string_arg);
|
||||
} else {
|
||||
switch_channel_set_variable_printf(channel, "codec_string", "=%s%s%s,%s",
|
||||
tech_pvt->video_rm_encoding ? tech_pvt->video_rm_encoding : "",
|
||||
tech_pvt->video_rm_encoding ? "," : "",
|
||||
tech_pvt->rm_encoding, msg->string_arg);
|
||||
}
|
||||
|
||||
|
||||
tech_pvt->num_codecs = 0;
|
||||
tech_pvt->rm_encoding = NULL;
|
||||
tech_pvt->video_rm_encoding = NULL;
|
||||
sofia_clear_flag_locked(tech_pvt, TFLAG_VIDEO);
|
||||
sofia_glue_tech_prepare_codecs(tech_pvt);
|
||||
sofia_glue_check_video_codecs(tech_pvt);
|
||||
sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
|
||||
sofia_set_pflag(tech_pvt->profile, PFLAG_RENEG_ON_REINVITE);
|
||||
}
|
||||
|
||||
sofia_glue_do_invite(session);
|
||||
|
||||
if (msg->numeric_arg && switch_core_session_get_partner(session, &nsession) == SWITCH_STATUS_SUCCESS) {
|
||||
msg->numeric_arg = 0;
|
||||
switch_core_session_receive_message(nsession, msg);
|
||||
switch_core_session_rwunlock(nsession);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
|
||||
{
|
||||
const char *pl = "<media_control><vc_primitive><to_encoder><picture_fast_update/></to_encoder></vc_primitive></media_control>";
|
||||
|
||||
@@ -1209,11 +1209,13 @@ static void our_sofia_event_callback(nua_event_t event,
|
||||
sofia_handle_sip_i_options(status, phrase, nua, profile, nh, sofia_private, sip, de, tags);
|
||||
break;
|
||||
case nua_i_invite:
|
||||
if (session && sofia_private->is_call > 1) {
|
||||
sofia_handle_sip_i_reinvite(session, nua, profile, nh, sofia_private, sip, de, tags);
|
||||
} else {
|
||||
sofia_private->is_call++;
|
||||
sofia_handle_sip_i_invite(session, nua, profile, nh, sofia_private, sip, de, tags);
|
||||
if (session && sofia_private) {
|
||||
if (sofia_private->is_call > 1) {
|
||||
sofia_handle_sip_i_reinvite(session, nua, profile, nh, sofia_private, sip, de, tags);
|
||||
} else {
|
||||
sofia_private->is_call++;
|
||||
sofia_handle_sip_i_invite(session, nua, profile, nh, sofia_private, sip, de, tags);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case nua_i_publish:
|
||||
@@ -1688,6 +1690,14 @@ static void sofia_queue_message(sofia_dispatch_event_t *de)
|
||||
switch_queue_push(mod_sofia_globals.msg_queue, de);
|
||||
}
|
||||
|
||||
static void set_call_id(private_object_t *tech_pvt, sip_t const *sip)
|
||||
{
|
||||
if (!tech_pvt->call_id && tech_pvt->session && tech_pvt->channel && sip && sip->sip_call_id && sip->sip_call_id->i_id) {
|
||||
tech_pvt->call_id = switch_core_session_strdup(tech_pvt->session, sip->sip_call_id->i_id);
|
||||
switch_channel_set_variable(tech_pvt->channel, "sip_call_id", tech_pvt->call_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void sofia_event_callback(nua_event_t event,
|
||||
int status,
|
||||
@@ -1707,16 +1717,22 @@ void sofia_event_callback(nua_event_t event,
|
||||
|
||||
if ((session = switch_core_session_locate(sofia_private->uuid))) {
|
||||
private_object_t *tech_pvt = switch_core_session_get_private(session);
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "detaching session %s\n", sofia_private->uuid);
|
||||
|
||||
tech_pvt->sofia_private = NULL;
|
||||
tech_pvt->nh = NULL;
|
||||
sofia_set_flag(tech_pvt, TFLAG_BYE);
|
||||
switch_mutex_lock(profile->flag_mutex);
|
||||
switch_core_hash_insert(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session)));
|
||||
switch_mutex_unlock(profile->flag_mutex);
|
||||
switch_core_session_rwunlock(session);
|
||||
set_call_id(tech_pvt, sip);
|
||||
|
||||
if (!zstr(tech_pvt->call_id)) {
|
||||
tech_pvt->sofia_private = NULL;
|
||||
tech_pvt->nh = NULL;
|
||||
sofia_set_flag(tech_pvt, TFLAG_BYE);
|
||||
switch_mutex_lock(profile->flag_mutex);
|
||||
switch_core_hash_insert(profile->chat_hash, tech_pvt->call_id, strdup(switch_core_session_get_uuid(session)));
|
||||
switch_mutex_unlock(profile->flag_mutex);
|
||||
switch_core_session_rwunlock(session);
|
||||
} else {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
}
|
||||
}
|
||||
}
|
||||
goto end;
|
||||
@@ -1802,9 +1818,25 @@ void sofia_event_callback(nua_event_t event,
|
||||
} else {
|
||||
free(uuid);
|
||||
uuid = NULL;
|
||||
sip = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!sip || !sip->sip_call_id || zstr(sip->sip_call_id->i_id)) {
|
||||
nua_respond(nh, 503, "INVALID INVITE", TAG_END());
|
||||
nua_destroy_event(de->event);
|
||||
su_free(nh->nh_home, de);
|
||||
|
||||
switch_mutex_lock(profile->flag_mutex);
|
||||
profile->queued_events--;
|
||||
switch_mutex_unlock(profile->flag_mutex);
|
||||
|
||||
nua_handle_unref(nh);
|
||||
nua_stack_unref(nua);
|
||||
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (sofia_test_pflag(profile, PFLAG_CALLID_AS_UUID)) {
|
||||
session = switch_core_session_request_uuid(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL, sip->sip_call_id->i_id);
|
||||
@@ -1827,13 +1859,8 @@ void sofia_event_callback(nua_event_t event,
|
||||
}
|
||||
|
||||
sofia_glue_attach_private(session, profile, tech_pvt, channel_name);
|
||||
|
||||
if (!tech_pvt->call_id && sip->sip_call_id && sip->sip_call_id->i_id) {
|
||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||
tech_pvt->call_id = switch_core_session_strdup(session, sip->sip_call_id->i_id);
|
||||
switch_channel_set_variable(channel, "sip_call_id", tech_pvt->call_id);
|
||||
}
|
||||
|
||||
set_call_id(tech_pvt, sip);
|
||||
} else {
|
||||
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
|
||||
nua_destroy_event(de->event);
|
||||
|
||||
@@ -833,12 +833,14 @@ void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt)
|
||||
|
||||
if (!(codec_string = switch_channel_get_variable(tech_pvt->channel, "codec_string"))) {
|
||||
codec_string = sofia_glue_get_codec_string(tech_pvt);
|
||||
if (codec_string && *codec_string == '=') {
|
||||
codec_string++;
|
||||
goto ready;
|
||||
}
|
||||
}
|
||||
|
||||
if (codec_string && *codec_string == '=') {
|
||||
codec_string++;
|
||||
goto ready;
|
||||
}
|
||||
|
||||
|
||||
if ((ocodec = switch_channel_get_variable(tech_pvt->channel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
|
||||
if (!codec_string || sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_TRANSCODING)) {
|
||||
codec_string = ocodec;
|
||||
@@ -871,6 +873,7 @@ void sofia_glue_check_video_codecs(private_object_t *tech_pvt)
|
||||
int i;
|
||||
tech_pvt->video_count = 0;
|
||||
for (i = 0; i < tech_pvt->num_codecs; i++) {
|
||||
|
||||
if (tech_pvt->codecs[i]->codec_type == SWITCH_CODEC_TYPE_VIDEO) {
|
||||
tech_pvt->video_count++;
|
||||
}
|
||||
@@ -5135,6 +5138,8 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
|
||||
|
||||
if (mimp) {
|
||||
char tmp[50];
|
||||
const char *mirror = switch_channel_get_variable(tech_pvt->channel, "sip_mirror_remote_audio_codec_payload");
|
||||
|
||||
tech_pvt->rm_encoding = switch_core_session_strdup(session, (char *) map->rm_encoding);
|
||||
tech_pvt->iananame = switch_core_session_strdup(session, (char *) mimp->iananame);
|
||||
tech_pvt->pt = (switch_payload_t) map->rm_pt;
|
||||
@@ -5152,7 +5157,9 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
|
||||
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp);
|
||||
tech_pvt->audio_recv_pt = (switch_payload_t)map->rm_pt;
|
||||
|
||||
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
|
||||
if (!switch_true(mirror) &&
|
||||
switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND &&
|
||||
(!sofia_test_flag(tech_pvt, TFLAG_REINVITE) || sofia_test_pflag(tech_pvt->profile, PFLAG_RENEG_ON_REINVITE))) {
|
||||
sofia_glue_get_offered_pt(tech_pvt, mimp, &tech_pvt->audio_recv_pt);
|
||||
}
|
||||
|
||||
@@ -5275,6 +5282,8 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
|
||||
if (mimp) {
|
||||
if ((tech_pvt->video_rm_encoding = switch_core_session_strdup(session, (char *) rm_encoding))) {
|
||||
char tmp[50];
|
||||
const char *mirror = switch_channel_get_variable(tech_pvt->channel, "sip_mirror_remote_video_codec_payload");
|
||||
|
||||
tech_pvt->video_pt = (switch_payload_t) map->rm_pt;
|
||||
tech_pvt->video_rm_rate = map->rm_rate;
|
||||
tech_pvt->video_codec_ms = mimp->microseconds_per_packet / 1000;
|
||||
@@ -5292,7 +5301,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
|
||||
|
||||
tech_pvt->video_recv_pt = (switch_payload_t)map->rm_pt;
|
||||
|
||||
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
||||
if (!switch_true(mirror) && switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
||||
sofia_glue_get_offered_pt(tech_pvt, mimp, &tech_pvt->video_recv_pt);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user