add stupid 2833 crap

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4070 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-01-28 02:38:52 +00:00
parent e887d1a543
commit 781c74fc8e
3 changed files with 15 additions and 3 deletions

View File

@ -240,6 +240,7 @@ typedef enum {
SWITCH_RTP_FLAG_MINI - Use mini RTP when possible 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_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 SWITCH_RTP_FLAG_BUGGY_2833 - Emulate the bug in cisco equipment to allow interop
SWITCH_RTP_FLAG_PASS_RFC2833 - Pass 2833 (ignore it)
</pre> </pre>
*/ */
typedef enum { typedef enum {
@ -255,7 +256,8 @@ typedef enum {
SWITCH_RTP_FLAG_BREAK = ( 1 << 9), SWITCH_RTP_FLAG_BREAK = ( 1 << 9),
SWITCH_RTP_FLAG_MINI = ( 1 << 10), 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_BUGGY_2833 = (1 << 12),
SWITCH_RTP_FLAG_PASS_RFC2833 = (1 << 13)
} switch_rtp_flag_t; } switch_rtp_flag_t;
/*! /*!

View File

@ -141,7 +141,8 @@ typedef enum {
PFLAG_BLIND_REG = (1 << 1), PFLAG_BLIND_REG = (1 << 1),
PFLAG_AUTH_ALL = (1 << 2), PFLAG_AUTH_ALL = (1 << 2),
PFLAG_FULL_ID = (1 << 3), PFLAG_FULL_ID = (1 << 3),
PFLAG_PRESENCE = (1 << 4) PFLAG_PRESENCE = (1 << 4),
PFLAG_PASS_RFC2833 = (1 << 5)
} PFLAGS; } PFLAGS;
typedef enum { typedef enum {
@ -1402,6 +1403,7 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt)
int bw, ms; int bw, ms;
switch_channel_t *channel; switch_channel_t *channel;
const char *err = NULL; const char *err = NULL;
char *val = NULL;
switch_rtp_flag_t flags; switch_rtp_flag_t flags;
switch_status_t status; switch_status_t status;
char tmp[50]; char tmp[50];
@ -1431,6 +1433,10 @@ static switch_status_t activate_rtp(private_object_t *tech_pvt)
flags |= SWITCH_RTP_FLAG_BUGGY_2833; flags |= SWITCH_RTP_FLAG_BUGGY_2833;
} }
if (tech_pvt->profile->flags & PFLAG_PASS_RFC2833 || ((val = switch_channel_get_variable(channel, "pass_rfc2833")) && switch_true(val))) {
flags |= SWITCH_RTP_FLAG_PASS_RFC2833;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n", 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), switch_channel_get_name(channel),
tech_pvt->local_sdp_audio_ip, tech_pvt->local_sdp_audio_ip,
@ -4983,6 +4989,10 @@ static switch_status_t config_sofia(int reload)
if (switch_true(val)) { if (switch_true(val)) {
profile->pflags |= PFLAG_PRESENCE; profile->pflags |= PFLAG_PRESENCE;
} }
} else if (!strcasecmp(var, "pass-rfc2833")) {
if (switch_true(val)) {
profile->pflags |= PFLAG_PASS_RFC2833;
}
} else if (!strcasecmp(var, "auth-calls")) { } else if (!strcasecmp(var, "auth-calls")) {
if (switch_true(val)) { if (switch_true(val)) {
profile->pflags |= PFLAG_AUTH_CALLS; profile->pflags |= PFLAG_AUTH_CALLS;

View File

@ -840,7 +840,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
} }
/* RFC2833 ... TBD try harder to honor the duration etc.*/ /* RFC2833 ... TBD try harder to honor the duration etc.*/
if (rtp_session->recv_msg.header.pt == rtp_session->te) { if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833) && rtp_session->recv_msg.header.pt == rtp_session->te) {
unsigned char *packet = (unsigned char *) rtp_session->recv_msg.body; unsigned char *packet = (unsigned char *) rtp_session->recv_msg.body;
int end = packet[1]&0x80; int end = packet[1]&0x80;
int duration = (packet[2]<<8) + packet[3]; int duration = (packet[2]<<8) + packet[3];