[sr-dev] git:master:c753932e: registrar: expires_range should not make expires < min_expires

Kristian F. Høgh kfh at uni-tel.dk
Fri Jun 19 13:12:42 CEST 2020


Module: kamailio
Branch: master
Commit: c753932ebfa055d923c92b916937eec99cd14d23
URL: https://github.com/kamailio/kamailio/commit/c753932ebfa055d923c92b916937eec99cd14d23

Author: Kristian F. Høgh <kfh at uni-tel.dk>
Committer: Kristian F. Høgh <kfh at uni-tel.dk>
Date: 2020-06-19T11:22:20+02:00

registrar: expires_range should not make expires < min_expires

---

Modified: src/modules/registrar/sip_msg.c

---

Diff:  https://github.com/kamailio/kamailio/commit/c753932ebfa055d923c92b916937eec99cd14d23.diff
Patch: https://github.com/kamailio/kamailio/commit/c753932ebfa055d923c92b916937eec99cd14d23.patch

---

diff --git a/src/modules/registrar/sip_msg.c b/src/modules/registrar/sip_msg.c
index d2dfba0aee..802435865f 100644
--- a/src/modules/registrar/sip_msg.c
+++ b/src/modules/registrar/sip_msg.c
@@ -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;
@@ -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);
 		}




More information about the sr-dev mailing list