diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 692f008b8f..4587325201 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -182,6 +182,7 @@ typedef enum { SWITCH_RTP_FLAG_BREAK - Stop what you are doing and return SWITCH_STATUS_BREAK SWITCH_RTP_FLAG_MINI - Use mini RTP when possible SWITCH_RTP_FLAG_DATAWAIT - Do not return from reads unless there is data even when non blocking + SWITCH_RTP_FLAG_BUGGY_2833 - Emulate the bug in cisco equipment to allow interop </pre> */ typedef enum { @@ -196,7 +197,8 @@ typedef enum { SWITCH_RTP_FLAG_VAD = (1 << 8), SWITCH_RTP_FLAG_BREAK = ( 1 << 9), SWITCH_RTP_FLAG_MINI = ( 1 << 10), - SWITCH_RTP_FLAG_DATAWAIT = (1 << 11) + SWITCH_RTP_FLAG_DATAWAIT = (1 << 11), + SWITCH_RTP_FLAG_BUGGY_2833 = (1 << 12) } switch_rtp_flag_t; /*! diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index dd0da2a7b3..41a7184252 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -142,7 +142,8 @@ typedef enum { TFLAG_REFER = (1 << 17), TFLAG_NOHUP = (1 << 18), TFLAG_XFER = (1 << 19), - TFLAG_NOMEDIA = (1 << 20) + TFLAG_NOMEDIA = (1 << 20), + TFLAG_BUGGY_2833 = (1 << 21) } TFLAGS; static struct { @@ -275,6 +276,7 @@ struct private_object { char *key; char *xferto; char *kick; + char *origin; unsigned long rm_rate; switch_payload_t pt; switch_mutex_t *flag_mutex; @@ -1226,6 +1228,10 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt) flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT); + if (switch_test_flag(tech_pvt, TFLAG_BUGGY_2833)) { + flags |= SWITCH_RTP_FLAG_BUGGY_2833; + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n", switch_channel_get_name(channel), tech_pvt->local_sdp_audio_ip, @@ -1822,6 +1828,13 @@ static uint8_t negotiate_sdp(switch_core_session_t *session, sdp_session_t *sdp) tech_pvt = switch_core_session_get_private(session); assert(tech_pvt != NULL); + if ((tech_pvt->origin = switch_core_session_strdup(session, (char *) sdp->sdp_origin->o_username))) { + if (strstr(tech_pvt->origin, "CiscoSystemsSIP-GW-UserAgent")) { + switch_set_flag_locked(tech_pvt, TFLAG_BUGGY_2833); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activate Buggy RFC2833 Mode!\n"); + } + } + for (m = sdp->sdp_media; m ; m = m->m_next) { if (m->m_type == sdp_media_audio) { sdp_rtpmap_t *map; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index dc4aad8db6..3923bc3085 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -732,7 +732,7 @@ static void do_2833(switch_rtp_t *rtp_session) switch_rtp_write_manual(rtp_session, rtp_session->dtmf_data.out_digit_packet, 4, - 1, + switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BUGGY_2833) ? 0 : 1, rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, rtp_session->dtmf_data.out_digit_seq++,