Module: kamailio
Branch: master
Commit: 86cb58b045854c6fe95afbd81c2c13c81e1052d5
URL:
https://github.com/kamailio/kamailio/commit/86cb58b045854c6fe95afbd81c2c13c…
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_profile: use parameter default_expires instead of 3600 constant
- GH #2996
---
Modified: src/modules/presence_profile/add_events.c
Modified: src/modules/presence_profile/doc/presence_profile_admin.xml
Modified: src/modules/presence_profile/presence_profile.c
Modified: src/modules/presence_profile/presence_profile.h
---
Diff:
https://github.com/kamailio/kamailio/commit/86cb58b045854c6fe95afbd81c2c13c…
Patch:
https://github.com/kamailio/kamailio/commit/86cb58b045854c6fe95afbd81c2c13c…
---
diff --git a/src/modules/presence_profile/add_events.c
b/src/modules/presence_profile/add_events.c
index 72a5f58567..ec03193d41 100644
--- a/src/modules/presence_profile/add_events.c
+++ b/src/modules/presence_profile/add_events.c
@@ -45,11 +45,10 @@ int profile_add_events(void)
event.name.s = "ua-profile";
event.name.len = 10;
-
event.content_type.s = "text/xml";
event.content_type.len = 8;
- event.default_expires= 3600;
+ event.default_expires= pres_profile_default_expires;
event.type = PUBL_TYPE;
event.req_auth = 0;
event.evs_publ_handl = 0;
diff --git a/src/modules/presence_profile/doc/presence_profile_admin.xml
b/src/modules/presence_profile/doc/presence_profile_admin.xml
index c54be3446b..ddc811f88e 100644
--- a/src/modules/presence_profile/doc/presence_profile_admin.xml
+++ b/src/modules/presence_profile/doc/presence_profile_admin.xml
@@ -64,9 +64,25 @@
<section>
<title>Exported Parameters</title>
- <para>
- None.
- </para>
+ <section id="presence_profile.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_profile", "default_expires", 3600)
+ ...
+ </programlisting>
+ </example>
+ </section>
</section>
<section>
diff --git a/src/modules/presence_profile/presence_profile.c
b/src/modules/presence_profile/presence_profile.c
index 0a4ab47434..ba3a2746f1 100644
--- a/src/modules/presence_profile/presence_profile.c
+++ b/src/modules/presence_profile/presence_profile.c
@@ -56,13 +56,22 @@ static int mod_init(void);
/* module variables */
add_event_t pres_add_event;
+/* module parameters */
+unsigned int pres_profile_default_expires = 3600;
+
+/* module exported paramaters */
+static param_export_t params[] = {
+ { "default_expires", INT_PARAM, &pres_profile_default_expires },
+ {0, 0, 0}
+};
+
/* module exports */
/* clang-format off */
struct module_exports exports= {
"presence_profile", /* module name */
DEFAULT_DLFLAGS, /* dlopen flags */
0, /* exported functions */
- 0, /* exported parameters */
+ params, /* exported parameters */
0, /* RPC method exports */
0, /* exported pseudo-variables */
0, /* response handling function */
diff --git a/src/modules/presence_profile/presence_profile.h
b/src/modules/presence_profile/presence_profile.h
index 7906f323b4..ff70a74941 100644
--- a/src/modules/presence_profile/presence_profile.h
+++ b/src/modules/presence_profile/presence_profile.h
@@ -31,5 +31,6 @@
#define _PRES_PROFILE_H_
extern add_event_t pres_add_event;
+extern unsigned int pres_profile_default_expires;
#endif