Skip to content

Commit

Permalink
Merge pull request #2365 from khoegh/423-expires-range
Browse files Browse the repository at this point in the history
registrar: expires_range should not make expires < min_expires
  • Loading branch information
miconda committed Jun 19, 2020
2 parents 773ecfc + c753932 commit 95992d2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/modules/registrar/sip_msg.c
Expand Up @@ -277,10 +277,6 @@ void calc_contact_expires(struct sip_msg* _m, param_t* _ep, int* _e, int novaria

if ( *_e != 0 )
{
if (!novariation) {
*_e = randomize_expires( *_e, range );
}

if (*_e < cfg_get(registrar, registrar_cfg, min_expires)) {
if(reg_min_expires_mode) {
rerrno = R_LOW_EXP;
Expand All @@ -290,6 +286,13 @@ void calc_contact_expires(struct sip_msg* _m, param_t* _ep, int* _e, int novaria
}
}

if (!novariation) {
*_e = randomize_expires( *_e, range );
if (*_e < cfg_get(registrar, registrar_cfg, min_expires)) {
*_e = cfg_get(registrar, registrar_cfg, min_expires);
}
}

if (cfg_get(registrar, registrar_cfg, max_expires) && (*_e > cfg_get(registrar, registrar_cfg, max_expires))) {
*_e = cfg_get(registrar, registrar_cfg, max_expires);
}
Expand Down

0 comments on commit 95992d2

Please sign in to comment.