[Freeswitch-svn] [commit] r10421 - freeswitch/trunk/src/mod/endpoints/mod_sofia
FreeSWITCH SVN
anthm at freeswitch.org
Sun Nov 16 10:45:22 PST 2008
Author: anthm
Date: Sun Nov 16 13:45:21 2008
New Revision: 10421
Log:
deal with strange reinvite with no sdp
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h Sun Nov 16 13:45:21 2008
@@ -200,7 +200,7 @@
TFLAG_REINVITE = (1 << 16),
TFLAG_REFER = (1 << 17),
TFLAG_NOHUP = (1 << 18),
- TFLAG_XFER = (1 << 19),
+ TFLAG_NOSDP_REINVITE = (1 << 19),
TFLAG_NAT = (1 << 20),
TFLAG_BUGGY_2833 = (1 << 21),
TFLAG_SIP_HOLD = (1 << 22),
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c Sun Nov 16 13:45:21 2008
@@ -2534,7 +2534,8 @@
}
} else if (tech_pvt && switch_test_flag(tech_pvt, TFLAG_SDP) && !r_sdp) {
- nua_respond(tech_pvt->nh, SIP_202_ACCEPTED, TAG_END());
+ nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END());
+ switch_set_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
goto done;
} else {
ss_state = nua_callstate_completed;
@@ -2673,6 +2674,45 @@
}
break;
case nua_callstate_ready:
+
+ if (r_sdp && switch_test_flag(tech_pvt, TFLAG_NOSDP_REINVITE)) {
+ sdp_parser_t *parser;
+ sdp_session_t *sdp;
+ uint8_t match = 0;
+ int is_ok = 1;
+
+ switch_clear_flag_locked(tech_pvt, TFLAG_NOSDP_REINVITE);
+
+ if (tech_pvt->num_codecs) {
+ if ((parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
+ if ((sdp = sdp_session(parser))) {
+ match = sofia_glue_negotiate_sdp(session, sdp);
+ }
+ sdp_parser_free(parser);
+ }
+ }
+
+ if (match) {
+ switch_set_flag_locked(tech_pvt, TFLAG_REINVITE);
+ if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP Error!\n");
+ switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RTP ERROR");
+ is_ok = 0;
+ }
+ switch_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
+ } else {
+ switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
+ is_ok = 0;
+ }
+
+ if (!is_ok) {
+ nua_respond(nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
+ switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
+ }
+
+ goto done;
+ }
+
if (channel) {
switch_channel_clear_flag(channel, CF_REQ_MEDIA);
}
More information about the Freeswitch-svn
mailing list