Fix issues on SDP negotiation and Session Timers

This commit is contained in:
bossiel 2012-02-15 02:56:30 +00:00
parent 9dc85ad2ab
commit 72deba2017
4 changed files with 15 additions and 8 deletions

View File

@ -805,6 +805,7 @@ int tmedia_session_mgr_set_ro(tmedia_session_mgr_t* self, const tsdp_message_t*
tsk_bool_t is_hold_resume = tsk_false;
tsk_bool_t is_loopback_address = tsk_false;
tsk_bool_t is_mediatype_changed = tsk_false;
tsk_bool_t had_ro_sdp;
tmedia_qos_stype_t qos_type = tmedia_qos_stype_none;
tmedia_type_t new_mediatype = tmedia_none;
@ -813,6 +814,8 @@ int tmedia_session_mgr_set_ro(tmedia_session_mgr_t* self, const tsdp_message_t*
return -1;
}
had_ro_sdp = (self->sdp.ro != tsk_null);
/* RFC 3264 subcaluse 8
When issuing an offer that modifies the session, the "o=" line of the new SDP MUST be identical to that in the previous SDP,
except that the version in the origin field MUST increment by one from the previous SDP. If the version in the origin line
@ -926,8 +929,8 @@ int tmedia_session_mgr_set_ro(tmedia_session_mgr_t* self, const tsdp_message_t*
self->qos.type = qos_type;
}
/* signal that ro has changed (will be used to update lo) */
self->ro_changed = tsk_true;
/* signal that ro has changed (will be used to update lo) unless there was no ro_sdp*/
self->ro_changed = had_ro_sdp;
/* manager was started and we stopped it in order to reconfigure it (codecs, network, ....) */
if(stopped_to_reconf){

View File

@ -592,15 +592,15 @@ int x0000_Connected_2_Connected_X_iINVITEorUPDATE(va_list *app)
*/
bodiless_invite = !TSIP_MESSAGE_HAS_CONTENT(rINVITEorUPDATE) && TSIP_REQUEST_IS_INVITE(rINVITEorUPDATE);
// send the response
ret = send_RESPONSE(self, rINVITEorUPDATE, 200, "OK",
(self->msession_mgr && (force_sdp || bodiless_invite || self->msession_mgr->ro_changed || self->msession_mgr->state_changed || (old_media_type != new_media_type))));
/* session timers */
/* session timers (must be before sending response) */
if(self->stimers.timer.timeout){
tsip_dialog_invite_stimers_handle(self, rINVITEorUPDATE);
}
// send the response
ret = send_RESPONSE(self, rINVITEorUPDATE, 200, "OK",
(self->msession_mgr && (force_sdp || bodiless_invite || self->msession_mgr->ro_changed || self->msession_mgr->state_changed || (old_media_type != new_media_type))));
/* hold/resume */
tsip_dialog_invite_hold_handle(self, rINVITEorUPDATE);

View File

@ -135,7 +135,7 @@ static tsk_bool_t _fsm_cond_bad_content(tsip_dialog_invite_t* self, tsip_message
static tsk_bool_t _fsm_cond_toosmall(tsip_dialog_invite_t* self, tsip_message_t* message)
{
if(tsip_message_supported(message, "timer") || tsip_message_required(message, "timer")){
if(TSIP_DIALOG_GET_SS(self)->media.timers.timeout && (tsip_message_supported(message, "timer") || tsip_message_required(message, "timer"))){
const tsip_header_Session_Expires_t* Session_Expires;
if((Session_Expires = (const tsip_header_Session_Expires_t*)tsip_message_get_header(message, tsip_htype_Session_Expires))){
if(Session_Expires->delta_seconds < TSIP_SESSION_EXPIRES_MIN_VALUE){

View File

@ -254,10 +254,13 @@ int tsip_dialog_invite_stimers_handle(tsip_dialog_invite_t* self, const tsip_mes
tsk_strupdate(&self->stimers.refresher, hdr_SessionExpires->refresher_uas ? "uas" : "uac");
self->stimers.is_refresher = tsk_striequals(self->stimers.refresher, "uac");
self->supported.timer = (self->stimers.timer.timeout != 0);
self->require.timer = self->supported.timer;
}
}
else{
self->stimers.timer.timeout = 0; /* turned-off */
self->supported.timer = tsk_false;
self->require.timer = tsk_false;
ret = send_RESPONSE(self, message, 481, "Session-Expires header is missing");
return 0;
}
@ -274,6 +277,7 @@ int tsip_dialog_invite_stimers_handle(tsip_dialog_invite_t* self, const tsip_mes
*/
self->stimers.timer.timeout = 0; /* turned-off */
self->supported.timer = tsk_false;
self->require.timer = tsk_false;
}
}