diff options
author | Benny Prijono <bennylp@teluu.com> | 2011-09-21 07:38:22 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2011-09-21 07:38:22 +0000 |
commit | 1ae52d9602a72858cd1076a8b11bbeaecb1f8165 (patch) | |
tree | 0e9f433749d6a3742b023ee24c7c9688d76d653e /pjsip/src | |
parent | c03b900af9d3c1e4f52540ec580f29b4903f8417 (diff) |
Added option to control first re-registration retry interval. This closes #1375
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/1.x@3762 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src')
-rw-r--r-- | pjsip/src/pjsua-lib/pjsua_acc.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_acc.c b/pjsip/src/pjsua-lib/pjsua_acc.c index 851a6f11..e1f73bdf 100644 --- a/pjsip/src/pjsua-lib/pjsua_acc.c +++ b/pjsip/src/pjsua-lib/pjsua_acc.c @@ -2752,8 +2752,19 @@ static void schedule_reregistration(pjsua_acc *acc) acc->auto_rereg.timer.user_data = acc; /* Reregistration attempt. The first attempt will be done immediately. */ - delay.sec = acc->auto_rereg.attempt_cnt? acc->cfg.reg_retry_interval : 0; + delay.sec = acc->auto_rereg.attempt_cnt? acc->cfg.reg_retry_interval : + acc->cfg.reg_first_retry_interval; delay.msec = 0; + + /* Randomize interval by +/- 10 secs */ + if (delay.sec >= 10) { + delay.msec = -10000 + (pj_rand() % 20000); + } else { + delay.sec = 0; + delay.msec = (pj_rand() % 10000); + } + pj_time_val_normalize(&delay); + pjsua_schedule_timer(&acc->auto_rereg.timer, &delay); } |