From 824407dfad66205a82037b8212549a5a45e87195 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Fri, 20 Apr 2012 09:59:51 +0000 Subject: Fixed #1491: Failed to refresh (presence) subscription if Subscription-State header contains no "expires" parameter git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@4064 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsip-simple/evsub.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'pjsip') diff --git a/pjsip/src/pjsip-simple/evsub.c b/pjsip/src/pjsip-simple/evsub.c index 6abc00df..c20657da 100644 --- a/pjsip/src/pjsip-simple/evsub.c +++ b/pjsip/src/pjsip-simple/evsub.c @@ -1804,7 +1804,6 @@ static void on_tsx_state_uac( pjsip_evsub *sub, pjsip_transaction *tsx, pjsip_tx_data *tdata; pj_status_t status; - int next_refresh; /* Only want to handle initial NOTIFY receive event. */ if (tsx->state != PJSIP_TSX_STATE_TRYING) @@ -1884,19 +1883,14 @@ static void on_tsx_state_uac( pjsip_evsub *sub, pjsip_transaction *tsx, (pj_stricmp(&sub_state->sub_state, &STR_ACTIVE)==0 || pj_stricmp(&sub_state->sub_state, &STR_PENDING)==0)) { - next_refresh = sub_state->expires_param; + int next_refresh = sub_state->expires_param; + unsigned timeout; - } else { - next_refresh = sub->expires->ivalue; - } + update_expires(sub, next_refresh); - /* Update time */ - update_expires(sub, next_refresh); - - /* Start UAC refresh timer, only when we're not unsubscribing */ - if (sub->expires->ivalue != 0) { - unsigned timeout = (next_refresh > TIME_UAC_REFRESH) ? - next_refresh - TIME_UAC_REFRESH : next_refresh; + /* Start UAC refresh timer, only when we're not unsubscribing */ + timeout = (next_refresh > TIME_UAC_REFRESH) ? + next_refresh - TIME_UAC_REFRESH : next_refresh; PJ_LOG(5,(sub->obj_name, "Will refresh in %d seconds", timeout)); set_timer(sub, TIMER_TYPE_UAC_REFRESH, timeout); -- cgit v1.2.3