Commit bd687816 authored by Michael Jerris's avatar Michael Jerris Committed by Pekka Pessi

nua: with session timer, wait longer for refresh

Handle endpoints that will not refresh quick enough with short
Session-Expires.

Should have NUTAG_RFC4028_ME_HARDER()?
parent ec3a6ec0
......@@ -1552,6 +1552,8 @@ static void nua_session_usage_refresh(nua_handle_t *nh,
/* XXX - should check if we actually start something */
if (ss->ss_timer->refresher == nua_remote_refresher) {
SU_DEBUG_3(("nua(%p): session almost expired, "
"sending BYE before timeout.\n", (void *)nh));
ss->ss_reason = "SIP;cause=408;text=\"Session timeout\"";
nua_stack_bye(nh->nh_nua, nh, nua_r_bye, NULL);
}
......@@ -4495,16 +4497,27 @@ session_timer_set(nua_session_usage_t *ss, int uas)
t->timer_set = 1;
}
else if (t->refresher == nua_remote_refresher) {
/* if the side not performing refreshes does not receive a
/* RFC 4028 section 10:
"Similarly, if the side not performing refreshes does not receive a
session refresh request before the session expiration, it SHOULD send
a BYE to terminate the session, slightly before the session
expiration. The minimum of 32 seconds and one third of the session
interval is RECOMMENDED. */
unsigned interval = t->interval;
interval is RECOMMENDED."
interval -= 32 > interval / 3 ? interval / 3 : 32;
However, we use increased interval from 2/3 to 9/10 of session
expiration delay because some endpoints won't UPDATE early enough
with very short sessions (e.g. 120).
*/
unsigned interval;
if (t->interval / 10 < 32)
interval = t->interval - t->interval / 10;
else
interval = t->interval - 32;
nua_dialog_usage_set_refresh_range(du, interval, interval);
t->timer_set = 1;
}
else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment