Merge back a couple patches (curse you darcs)

Wed Feb 13 09:23:24 EST 2008  Pekka Pessi <Pekka.Pessi@nokia.com>
  * nua_subnotref.c: do not terminate subscriptions immediately after receiving 200 OK to un-SUBSCRIBE

Mon Feb 25 09:49:39 EST 2008  Pekka.Pessi@nokia.com
  * nua_subnotref.c: fixed problems re-calculating the subscription duration upon NOTIFY
  
  Thanks for Colin Whittaker for reporting this problem.



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7758 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-02-27 21:55:20 +00:00
parent 7dc80a7d57
commit 722b30237f
1 changed files with 21 additions and 19 deletions

View File

@ -371,6 +371,9 @@ static int nua_subscribe_client_response(nua_client_request_t *cr,
else
delta = 0;
if (delta > eu->eu_expires)
delta = eu->eu_expires;
if (win_messenger_enable && !nua_dialog_is_established(nh->nh_ds)) {
/* Notify from messanger does not match with dialog tag */
nh->nh_ds->ds_remote_tag = su_strdup(nh->nh_home, "");
@ -379,23 +382,23 @@ static int nua_subscribe_client_response(nua_client_request_t *cr,
if (delta > 0) {
nua_dialog_usage_set_refresh(du, delta);
}
else if (!eu->eu_notified) {
/* This is a fetch: subscription was really terminated
but we wait 32 seconds for NOTIFY. */
delta = 64 * NTA_SIP_T1 / 1000;
if (win_messenger_enable)
delta = 4 * 60; /* Wait 4 minutes for NOTIFY from Messenger */
eu->eu_final_wait = 1;
if (eu->eu_substate == nua_substate_terminated)
eu->eu_substate = nua_substate_embryonic;
nua_dialog_usage_set_refresh_range(du, delta, delta);
}
else {
eu->eu_substate = nua_substate_terminated;
if (eu->eu_substate == nua_substate_terminated) {
if (!eu->eu_notified)
eu->eu_substate = nua_substate_embryonic;
}
if (eu->eu_substate != nua_substate_terminated) {
/* Wait 32 seconds for NOTIFY. */
delta = 64 * NTA_SIP_T1 / 1000;
eu->eu_final_wait = 1;
if (!eu->eu_notified && win_messenger_enable)
delta = 4 * 60; /* Wait 4 minutes for NOTIFY from Messenger */
nua_dialog_usage_set_refresh_range(du, delta, delta);
}
}
substate = eu->eu_substate;
@ -650,8 +653,6 @@ int nua_notify_server_report(nua_server_request_t *sr, tagi_t const *tags)
if (substate == nua_substate_active || substate == nua_substate_pending) {
if (subs && subs->ss_expires)
delta = strtoul(subs->ss_expires, NULL, 10);
else
delta = eu->eu_expires;
}
else if (substate == nua_substate_embryonic) {
if (subs && subs->ss_reason) {
@ -689,7 +690,8 @@ int nua_notify_server_report(nua_server_request_t *sr, tagi_t const *tags)
nua_dialog_usage_set_refresh_range(du, retry, retry + 5);
}
else {
nua_dialog_usage_set_refresh(du, delta);
if (delta < SIP_TIME_MAX)
nua_dialog_usage_set_refresh(du, delta);
}
return retval;