diff options
author | Nanang Izzuddin <nanang@teluu.com> | 2010-05-26 15:04:43 +0000 |
---|---|---|
committer | Nanang Izzuddin <nanang@teluu.com> | 2010-05-26 15:04:43 +0000 |
commit | 5b6d5703f0ac5cbd2f287adc665442ee2373124c (patch) | |
tree | cbbc2b4eca496b90e091fa43026c40e619452dc9 /pjsip/src/pjsua-lib | |
parent | 3c7c4c9c7567a0fbc21340dac01ea81b129e97f4 (diff) |
Fix #1087:
- Moved auto reregistration scheduling to be before the registration callback.
- Updated validations in auto_rereg_timer_cb() & schedule_reregistration().
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3185 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index 3ddcdd59..ba46d368 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -1480,9 +1480,6 @@ static void regc_cb(struct pjsip_regc_cbparam *param) acc->reg_last_err = param->status; acc->reg_last_code = param->code; - if (pjsua_var.ua_cfg.cb.on_reg_state) - (*pjsua_var.ua_cfg.cb.on_reg_state)(acc->index); - /* Check if we need to auto retry registration. Basically, registration * failure codes triggering auto-retry are those of temporal failures * considered to be recoverable in relatively short term. @@ -1498,6 +1495,9 @@ static void regc_cb(struct pjsip_regc_cbparam *param) schedule_reregistration(acc); } + if (pjsua_var.ua_cfg.cb.on_reg_state) + (*pjsua_var.ua_cfg.cb.on_reg_state)(acc->index); + PJSUA_UNLOCK(); } @@ -2368,8 +2368,15 @@ static void auto_rereg_timer_cb(pj_timer_heap_t *th, pj_timer_entry *te) PJSUA_LOCK(); - if (!acc->valid || !acc->auto_rereg.active) + /* Check if the reregistration timer is still valid, e.g: while waiting + * timeout timer application might have deleted the account or disabled + * the auto-reregistration. + */ + if (!acc->valid || !acc->auto_rereg.active || + acc->cfg.reg_retry_interval == 0) + { goto on_return; + } /* Start re-registration */ acc->auto_rereg.attempt_cnt++; @@ -2390,7 +2397,12 @@ static void schedule_reregistration(pjsua_acc *acc) { pj_time_val delay; - pj_assert(acc && acc->valid && acc->cfg.reg_retry_interval); + pj_assert(acc); + + /* Validate the account and re-registration feature status */ + if (!acc->valid || acc->cfg.reg_retry_interval == 0) { + return; + } /* If configured, disconnect calls of this account after the first * reregistration attempt failed. |