[sr-dev] git:master:1e3606eb: presence_mwi: use parameter default_expires instead of 3600 constant

Daniel-Constantin Mierla miconda at gmail.com
Tue Jan 18 20:19:23 CET 2022


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

Author: Adrian Tabacioiu <adi.tabacioiu at c-s.ro>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2022-01-18T20:19:16+01:00

presence_mwi: use parameter default_expires instead of 3600 constant

- GH #2996

---

Modified: src/modules/presence_mwi/add_events.c
Modified: src/modules/presence_mwi/doc/presence_mwi_admin.xml
Modified: src/modules/presence_mwi/presence_mwi.c
Modified: src/modules/presence_mwi/presence_mwi.h

---

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

---

diff --git a/src/modules/presence_mwi/add_events.c b/src/modules/presence_mwi/add_events.c
index 001034ade4..089940e081 100644
--- a/src/modules/presence_mwi/add_events.c
+++ b/src/modules/presence_mwi/add_events.c
@@ -124,7 +124,7 @@ int mwi_add_events(void)
 	event.content_type.s = "application/simple-message-summary";
 	event.content_type.len = 34;
 
-	event.default_expires= 3600;
+	event.default_expires= pres_mwi_default_expires;
 	event.type = PUBL_TYPE;
 	event.req_auth = 0;
 	event.evs_publ_handl = mwi_publ_handl;
diff --git a/src/modules/presence_mwi/doc/presence_mwi_admin.xml b/src/modules/presence_mwi/doc/presence_mwi_admin.xml
index e73c3f72a8..654dd080cd 100644
--- a/src/modules/presence_mwi/doc/presence_mwi_admin.xml
+++ b/src/modules/presence_mwi/doc/presence_mwi_admin.xml
@@ -68,9 +68,26 @@
 	
 	<section>
 	  <title>Parameters</title>
-		<para>
-		  None.
-		</para>
+		  <section id="presence_mwi.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_mwi", "default_expires", 3600)
+            ...
+            </programlisting>
+                </example>
+            </section>
+
         </section>
 
         <section>
diff --git a/src/modules/presence_mwi/presence_mwi.c b/src/modules/presence_mwi/presence_mwi.c
index afd605f7c7..9fdeeeb84c 100644
--- a/src/modules/presence_mwi/presence_mwi.c
+++ b/src/modules/presence_mwi/presence_mwi.c
@@ -59,6 +59,9 @@ static int mod_init(void);
 /* module variables */
 add_event_t pres_add_event;
 
+/* module parameters */
+unsigned int pres_mwi_default_expires = 3600;
+
 /* module exported commands */
 static cmd_export_t cmds[] =
 {
@@ -67,6 +70,7 @@ static cmd_export_t cmds[] =
 
 /* module exported paramaters */
 static param_export_t params[] = {
+	{ "default_expires", INT_PARAM, &pres_mwi_default_expires },
 	{0, 0, 0}
 };
 
diff --git a/src/modules/presence_mwi/presence_mwi.h b/src/modules/presence_mwi/presence_mwi.h
index 9e7d5c4d52..5eed0d742c 100644
--- a/src/modules/presence_mwi/presence_mwi.h
+++ b/src/modules/presence_mwi/presence_mwi.h
@@ -34,5 +34,6 @@
 #define _PRES_MWI_H_
 
 extern add_event_t pres_add_event;
+extern unsigned int pres_mwi_default_expires;
 
 #endif




More information about the sr-dev mailing list