Module: kamailio Branch: master Commit: 50a976f00e4ee19c24260a10f0a70349fe2d9d6d URL: https://github.com/kamailio/kamailio/commit/50a976f00e4ee19c24260a10f0a70349...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2022-01-05T18:44:41+01:00
pua: use parameter default_expires instead of 3600 constant
- GH #2994
---
Modified: src/modules/pua/pua.c Modified: src/modules/pua/pua.h Modified: src/modules/pua/send_publish.c Modified: src/modules/pua/send_subscribe.c
---
Diff: https://github.com/kamailio/kamailio/commit/50a976f00e4ee19c24260a10f0a70349... Patch: https://github.com/kamailio/kamailio/commit/50a976f00e4ee19c24260a10f0a70349...
---
diff --git a/src/modules/pua/pua.c b/src/modules/pua/pua.c index d0c89ba10d..be68e29549 100644 --- a/src/modules/pua/pua.c +++ b/src/modules/pua/pua.c @@ -58,7 +58,7 @@ htable_t* HashT= NULL; int HASH_SIZE= -1; extern int bind_pua(pua_api_t* api); int min_expires= 0; -int default_expires=3600; +int pua_default_expires=3600; static str db_url = str_init(DEFAULT_DB_URL); str db_table= str_init("pua"); int update_period= 100; @@ -126,7 +126,7 @@ static param_export_t params[]={ {"db_url", PARAM_STR, &db_url}, {"db_table", PARAM_STR, &db_table}, {"min_expires", INT_PARAM, &min_expires}, - {"default_expires", INT_PARAM, &default_expires}, + {"default_expires", INT_PARAM, &pua_default_expires}, {"update_period", INT_PARAM, &update_period}, {"outbound_proxy", PARAM_STR, &outbound_proxy}, {"dlginfo_increase_version", INT_PARAM, &dlginfo_increase_version}, @@ -162,8 +162,8 @@ static int mod_init(void) if(min_expires< 0) min_expires= 0;
- if(default_expires< 600) - default_expires= 3600; + if(pua_default_expires< 600) + pua_default_expires= 3600;
if(pua_rpc_init()<0) { LM_ERR("failed to register RPC commands\n"); @@ -702,7 +702,7 @@ int update_pua(ua_pres_t* p) dlg_t* td = NULL;
if(p->desired_expires== 0) - expires= 3600; + expires= pua_default_expires; else expires= p->desired_expires- (int)time(NULL);
@@ -1255,4 +1255,4 @@ int mod_register(char *path, int *dlflags, void *p1, void *p2) { sr_kemi_modules_add(sr_kemi_pua_exports); return 0; -} \ No newline at end of file +} diff --git a/src/modules/pua/pua.h b/src/modules/pua/pua.h index 908f5b0cb3..7d99c0f796 100644 --- a/src/modules/pua/pua.h +++ b/src/modules/pua/pua.h @@ -43,7 +43,7 @@ extern htable_t* HashT; extern int HASH_SIZE; extern int min_expires; extern int pua_ul_publish; -extern int default_expires; +extern int pua_default_expires; extern str outbound_proxy; extern int check_remote_contact; extern int dbmode; diff --git a/src/modules/pua/send_publish.c b/src/modules/pua/send_publish.c index 338ee892b4..e2e4c0ca7f 100644 --- a/src/modules/pua/send_publish.c +++ b/src/modules/pua/send_publish.c @@ -668,7 +668,7 @@ int send_publish( publ_info_t* publ )
if(publ->flag & UPDATE_TYPE) LM_DBG("etag:%.*s\n", etag.len, etag.s); - str_hdr = publ_build_hdr((publ->expires< 0)?3600:publ->expires, ev, &publ->content_type, + str_hdr = publ_build_hdr((publ->expires< 0)?pua_default_expires:publ->expires, ev, &publ->content_type, (publ->flag & UPDATE_TYPE)?&etag:NULL, publ->extra_headers, (body)?1:0);
if(str_hdr == NULL) diff --git a/src/modules/pua/send_subscribe.c b/src/modules/pua/send_subscribe.c index fefc4ef283..723507bb86 100644 --- a/src/modules/pua/send_subscribe.c +++ b/src/modules/pua/send_subscribe.c @@ -971,7 +971,7 @@ int send_subscribe(subs_info_t* subs) subs->source_flag= XMPP_SUBSCRIBE;
if(subs->expires< 0) - expires= 3600; + expires= pua_default_expires; else expires= subs->expires;