switch_rtp_set_telephony_recv_event(tech_pvt->rtp_session, tech_pvt->recv_te);
}
+ if (tech_pvt->audio_recv_pt != tech_pvt->agreed_pt) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_CRIT, "Set audio receive payload to %u\n", tech_pvt->audio_recv_pt);
+ switch_rtp_set_recv_pt(tech_pvt->rtp_session, tech_pvt->audio_recv_pt);
+ }
+
if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) ||
((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val)) ||
((val = switch_channel_get_variable(tech_pvt->channel, "suppress_cng")) && switch_true(val))) {
if ((rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_video_rtcp_port"))) {
remote_rtcp_port = (switch_port_t)atoi(rport);
}
-
+
if (switch_rtp_set_remote_address
(tech_pvt->video_rtp_session, tech_pvt->remote_sdp_video_ip, tech_pvt->remote_sdp_video_port, remote_rtcp_port, SWITCH_TRUE,
&err) != SWITCH_STATUS_SUCCESS) {
switch_rtp_set_ssrc(tech_pvt->video_rtp_session, ssrc_ul);
}
+
+ if (tech_pvt->video_recv_pt != tech_pvt->video_agreed_pt) {
+ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
+ "Set video receive payload to %u\n", tech_pvt->video_recv_pt);
+ switch_rtp_set_recv_pt(tech_pvt->rtp_session, tech_pvt->video_recv_pt);
+ }
+
switch_channel_set_variable_printf(tech_pvt->channel, "sip_use_video_pt", "%d", tech_pvt->video_agreed_pt);
tech_pvt->video_ssrc = switch_rtp_get_ssrc(tech_pvt->rtp_session);
switch_channel_set_variable_printf(tech_pvt->channel, "rtp_use_video_ssrc", "%u", tech_pvt->ssrc);
}
+switch_status_t sofia_glue_get_offered_pt(private_object_t *tech_pvt, const switch_codec_implementation_t *mimp, switch_payload_t *pt)
+{
+ int i = 0;
+
+ for (i = 0; i < tech_pvt->num_codecs; i++) {
+ const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
+
+ if (!strcasecmp(imp->iananame, mimp->iananame)) {
+ *pt = tech_pvt->ianacodes[i];
+
+ return SWITCH_STATUS_SUCCESS;
+ }
+ }
+
+ return SWITCH_STATUS_FALSE;
+}
+
+
uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_sdp)
{
uint8_t match = 0;
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip);
switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp);
-
+ tech_pvt->audio_recv_pt = map->rm_pt;
+
+ if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+ sofia_glue_get_offered_pt(tech_pvt, mimp, &tech_pvt->audio_recv_pt);
+ }
+
+ switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->audio_recv_pt);
+ switch_channel_set_variable(tech_pvt->channel, "sip_audio_recv_pt", tmp);
+
}
-
+
if (match) {
if (sofia_glue_tech_set_codec(tech_pvt, 1) == SWITCH_STATUS_SUCCESS) {
got_audio = 1;
}
}
-
+
if (!match && greedy && mine < tech_pvt->num_codecs) {
mine++;
skip = 0;
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->video_agreed_pt);
switch_channel_set_variable(tech_pvt->channel, "sip_video_pt", tmp);
sofia_glue_check_video_codecs(tech_pvt);
+
+ tech_pvt->video_recv_pt = map->rm_pt;
+
+ if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+ sofia_glue_get_offered_pt(tech_pvt, mimp, &tech_pvt->video_recv_pt);
+ }
+
+ switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->video_recv_pt);
+ switch_channel_set_variable(tech_pvt->channel, "sip_video_recv_pt", tmp);
+
break;
} else {
vmatch = 0;
if ((tmp = switch_channel_get_variable(channel, "sip_use_pt"))) {
tech_pvt->pt = tech_pvt->agreed_pt = (switch_payload_t)atoi(tmp);
}
-
+
sofia_glue_tech_set_codec(tech_pvt, 1);
tech_pvt->adv_sdp_audio_ip = tech_pvt->extrtpip = (char *) ip;
switch_xml_free(xml);
return 0;
}
+
+ if (switch_rtp_ready(tech_pvt->rtp_session)) {
+ if ((tmp = switch_channel_get_variable(channel, "sip_audio_recv_pt"))) {
+ switch_rtp_set_recv_pt(tech_pvt->rtp_session, atoi(tmp));
+ }
+ }
+
+ if (switch_rtp_ready(tech_pvt->video_rtp_session)) {
+ if ((tmp = switch_channel_get_variable(channel, "sip_video_recv_pt"))) {
+ switch_rtp_set_recv_pt(tech_pvt->rtp_session, atoi(tmp));
+ }
+ }
+
}
if (switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) {
rtp_session->recv_msg.header.cc = 0;
rtp_session->payload = payload;
-
+ rtp_session->rpayload = payload;
rtp_session->rtcp_send_msg.header.version = 2;
rtp_session->rtcp_send_msg.header.p = 0;
}
}
+SWITCH_DECLARE(void) switch_rtp_set_recv_pt(switch_rtp_t *rtp_session, switch_payload_t pt)
+{
+ rtp_session->rpayload = pt;
+}
+
+
SWITCH_DECLARE(void) switch_rtp_set_cng_pt(switch_rtp_t *rtp_session, switch_payload_t pt)
{
rtp_session->cng_pt = pt;
rtp_session->recv_msg.header.pt != 13 &&
rtp_session->recv_msg.header.pt != rtp_session->recv_te &&
(!rtp_session->cng_pt || rtp_session->recv_msg.header.pt != rtp_session->cng_pt) &&
- rtp_session->recv_msg.header.pt != rtp_session->payload) {
+ rtp_session->recv_msg.header.pt != rtp_session->rpayload) {
/* drop frames of incorrect payload number and return CNG frame instead */
return_cng_frame();
}
rtp_session->recv_msg.header.pt = 97;
}
- rtp_session->rpayload = (switch_payload_t) rtp_session->recv_msg.header.pt;
-
break;
do_continue: