Module: kamailio
Branch: master
Commit: e8ece95f0c56d81d644fe469e3cbbf56c11c0891
URL:
https://github.com/kamailio/kamailio/commit/e8ece95f0c56d81d644fe469e3cbbf5…
Author: Adrian Tabacioiu <adi.tabacioiu(a)c-s.ro>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-01-18T20:19:16+01:00
presence_reginfo: use parameter default_expires instead of 3600 constant
- GH #2996
---
Modified: src/modules/presence_reginfo/add_events.c
Modified: src/modules/presence_reginfo/doc/presence_reginfo_admin.xml
Modified: src/modules/presence_reginfo/presence_reginfo.c
Modified: src/modules/presence_reginfo/presence_reginfo.h
---
Diff:
https://github.com/kamailio/kamailio/commit/e8ece95f0c56d81d644fe469e3cbbf5…
Patch:
https://github.com/kamailio/kamailio/commit/e8ece95f0c56d81d644fe469e3cbbf5…
---
diff --git a/src/modules/presence_reginfo/add_events.c
b/src/modules/presence_reginfo/add_events.c
index 3cb9f7a145..468a14dd3a 100644
--- a/src/modules/presence_reginfo/add_events.c
+++ b/src/modules/presence_reginfo/add_events.c
@@ -39,7 +39,7 @@ int reginfo_add_events(void)
event.content_type.s = "application/reginfo+xml";
event.content_type.len = 23;
- event.default_expires= 3600;
+ event.default_expires= pres_reginfo_default_expires;
event.type = PUBL_TYPE;
event.req_auth = 0;
event.evs_publ_handl = 0;
diff --git a/src/modules/presence_reginfo/doc/presence_reginfo_admin.xml
b/src/modules/presence_reginfo/doc/presence_reginfo_admin.xml
index b99c35e088..9c7450a2e2 100644
--- a/src/modules/presence_reginfo/doc/presence_reginfo_admin.xml
+++ b/src/modules/presence_reginfo/doc/presence_reginfo_admin.xml
@@ -64,6 +64,31 @@
</section>
</section>
+ <section>
+ <title>Parameters</title>
+ <section id="presence_reginfo.p.default_expires">
+ <title><varname>default_expires</varname>
(int)</title>
+ <para>
+ The default expires value used when missing from SUBSCRIBE
+ message (in seconds).
+ </para>
+ <para>
+ <emphasis>Default value is <quote>3600</quote>.
+ </emphasis>
+ </para>
+ <example>
+ <title>Set <varname>default_expires</varname>
parameter</title>
+ <programlisting format="linespecific">
+ ...
+ modparam("presence_reginfo", "default_expires", 3600)
+ ...
+ </programlisting>
+ </example>
+ </section>
+
+ </section>
+
+
<section>
<title>Functions</title>
<para>
diff --git a/src/modules/presence_reginfo/presence_reginfo.c
b/src/modules/presence_reginfo/presence_reginfo.c
index eadbfdad24..abb8755ca0 100644
--- a/src/modules/presence_reginfo/presence_reginfo.c
+++ b/src/modules/presence_reginfo/presence_reginfo.c
@@ -46,14 +46,23 @@ static int mod_init(void);
/* module variables */
add_event_t pres_add_event;
+/* module parameters */
+unsigned int pres_reginfo_default_expires = 3600;
+
+/* module exported paramaters */
+static param_export_t params[] = {
+ { "default_expires", INT_PARAM, &pres_reginfo_default_expires },
+ {0, 0, 0}
+};
+
/* module exports */
/* clang-format off */
struct module_exports exports= {
"presence_reginfo", /* module name */
DEFAULT_DLFLAGS, /* dlopen flags */
0, /* exported functions */
- 0, /* exported parameters */
- 0, /* RPC method exports */
+ params, /* exported parameters */
+ 0, /* RPC method exports */
0, /* exported pseudo-variables */
0, /* response handling function */
mod_init, /* module initialization function */
diff --git a/src/modules/presence_reginfo/presence_reginfo.h
b/src/modules/presence_reginfo/presence_reginfo.h
index 6d5371535b..6fa47c008f 100644
--- a/src/modules/presence_reginfo/presence_reginfo.h
+++ b/src/modules/presence_reginfo/presence_reginfo.h
@@ -25,5 +25,5 @@
#define _PRES_REGINFO_H_
extern add_event_t pres_add_event;
-
+extern unsigned int pres_reginfo_default_expires;
#endif