Browse code

pua: use parameter default_expires instead of 3600 constant

- GH #2994

Daniel-Constantin Mierla authored on 05/01/2022 17:44:41
Showing 4 changed files
... ...
@@ -58,7 +58,7 @@ htable_t* HashT= NULL;
58 58
 int HASH_SIZE= -1;
59 59
 extern int bind_pua(pua_api_t* api);
60 60
 int min_expires= 0;
61
-int default_expires=3600;
61
+int pua_default_expires=3600;
62 62
 static str db_url = str_init(DEFAULT_DB_URL);
63 63
 str db_table= str_init("pua");
64 64
 int update_period= 100;
... ...
@@ -126,7 +126,7 @@ static param_export_t params[]={
126 126
 	{"db_url",                   PARAM_STR, &db_url},
127 127
 	{"db_table",                 PARAM_STR, &db_table},
128 128
 	{"min_expires",	             INT_PARAM, &min_expires},
129
-	{"default_expires",          INT_PARAM, &default_expires},
129
+	{"default_expires",          INT_PARAM, &pua_default_expires},
130 130
 	{"update_period",            INT_PARAM, &update_period},
131 131
 	{"outbound_proxy",           PARAM_STR, &outbound_proxy},
132 132
 	{"dlginfo_increase_version", INT_PARAM, &dlginfo_increase_version},
... ...
@@ -162,8 +162,8 @@ static int mod_init(void)
162 162
 	if(min_expires< 0)
163 163
 		min_expires= 0;
164 164
 
165
-	if(default_expires< 600)
166
-		default_expires= 3600;
165
+	if(pua_default_expires< 600)
166
+		pua_default_expires= 3600;
167 167
 
168 168
 	if(pua_rpc_init()<0) {
169 169
 		LM_ERR("failed to register RPC commands\n");
... ...
@@ -702,7 +702,7 @@ int update_pua(ua_pres_t* p)
702 702
 	dlg_t* td = NULL;
703 703
 
704 704
 	if(p->desired_expires== 0)
705
-		expires= 3600;
705
+		expires= pua_default_expires;
706 706
 	else
707 707
 		expires= p->desired_expires- (int)time(NULL);
708 708
 
... ...
@@ -1255,4 +1255,4 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2)
1255 1255
 {
1256 1256
 	sr_kemi_modules_add(sr_kemi_pua_exports);
1257 1257
 	return 0;
1258
-}
1259 1258
\ No newline at end of file
1259
+}
... ...
@@ -43,7 +43,7 @@ extern htable_t* HashT;
43 43
 extern int HASH_SIZE;
44 44
 extern int min_expires;
45 45
 extern int pua_ul_publish;
46
-extern int default_expires;
46
+extern int pua_default_expires;
47 47
 extern str outbound_proxy;
48 48
 extern int check_remote_contact;
49 49
 extern int dbmode;
... ...
@@ -668,7 +668,7 @@ send_publish:
668 668
 
669 669
 	if(publ->flag & UPDATE_TYPE)
670 670
 		LM_DBG("etag:%.*s\n", etag.len, etag.s);
671
-	str_hdr = publ_build_hdr((publ->expires< 0)?3600:publ->expires, ev, &publ->content_type,
671
+	str_hdr = publ_build_hdr((publ->expires< 0)?pua_default_expires:publ->expires, ev, &publ->content_type,
672 672
 				(publ->flag & UPDATE_TYPE)?&etag:NULL, publ->extra_headers, (body)?1:0);
673 673
 
674 674
 	if(str_hdr == NULL)
... ...
@@ -971,7 +971,7 @@ int send_subscribe(subs_info_t* subs)
971 971
 		subs->source_flag= XMPP_SUBSCRIBE;
972 972
 
973 973
 	if(subs->expires< 0)
974
-		expires= 3600;
974
+		expires= pua_default_expires;
975 975
 	else
976 976
 		expires= subs->expires;
977 977