diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-10-21 03:03:06 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-10-21 03:03:06 +0000 |
commit | 0f0205321f92adc6f74aae9637f7a89000a1c4d6 (patch) | |
tree | cb83a1f8a5f51be839a5a45cf8395771a13eac9e /pjsip | |
parent | 7fd7e53acb9ba13ddbbc7d19053898a884bc0e3f (diff) |
More #937 (presence):
- added protection to not resubscribe immediately if initial SUBSCRIBE is responded with 481 for some reason
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2960 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/include/pjsua-lib/pjsua.h | 9 | ||||
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_pres.c | 12 |
2 files changed, 16 insertions, 5 deletions
diff --git a/pjsip/include/pjsua-lib/pjsua.h b/pjsip/include/pjsua-lib/pjsua.h index 93167785..4727448c 100644 --- a/pjsip/include/pjsua-lib/pjsua.h +++ b/pjsip/include/pjsua-lib/pjsua.h @@ -3037,9 +3037,12 @@ PJ_DECL(pj_status_t) pjsua_call_dump(pjsua_call_id call_id, /** - * This specifies how long the library should retry resending SUBSCRIBE - * if the previous SUBSCRIBE failed. This also controls the duration - * before failed PUBLISH request will be retried. + * This specifies how long the library should wait before retrying failed + * SUBSCRIBE request, and there is no rule to automatically resubscribe + * (for example, no "retry-after" parameter in Subscription-State header). + * + * This also controls the duration before failed PUBLISH request will be + * retried. * * Default: 300 seconds */ diff --git a/pjsip/src/pjsua-lib/pjsua_pres.c b/pjsip/src/pjsua-lib/pjsua_pres.c index 1c8fc61a..e7866377 100644 --- a/pjsip/src/pjsua-lib/pjsua_pres.c +++ b/pjsip/src/pjsua-lib/pjsua_pres.c @@ -1467,7 +1467,14 @@ static void pjsua_evsub_on_state( pjsip_evsub *sub, pjsip_event *event) /* 481: we refreshed too late? resubscribe * immediately. */ - resub_delay = 500; + /* But this must only happen when the 481 is received + * on subscription refresh request. We MUST NOT try to + * resubscribe automatically if the 481 is received + * on the initial SUBSCRIBE (if server returns this + * response for some reason). + */ + if (buddy->dlg->remote.contact) + resub_delay = 500; break; } } else if (pjsip_method_cmp(&tsx->method, @@ -1530,8 +1537,9 @@ static void pjsua_evsub_on_state( pjsip_evsub *sub, pjsip_event *event) } buddy_resubscribe(buddy, PJ_TRUE, resub_delay); - + } else { + /* This will clear the last termination code/reason */ buddy->term_code = 0; buddy->term_reason.slen = 0; } |