Browse code

presence_mwi: use parameter default_expires instead of 3600 constant

- GH #2996

Adrian Tabacioiu authored on 14/01/2022 13:31:03 • Daniel-Constantin Mierla committed on 18/01/2022 19:19:16
Showing 4 changed files
... ...
@@ -124,7 +124,7 @@ int mwi_add_events(void)
124 124
 	event.content_type.s = "application/simple-message-summary";
125 125
 	event.content_type.len = 34;
126 126
 
127
-	event.default_expires= 3600;
127
+	event.default_expires= pres_mwi_default_expires;
128 128
 	event.type = PUBL_TYPE;
129 129
 	event.req_auth = 0;
130 130
 	event.evs_publ_handl = mwi_publ_handl;
... ...
@@ -68,9 +68,26 @@
68 68
 	
69 69
 	<section>
70 70
 	  <title>Parameters</title>
71
-		<para>
72
-		  None.
73
-		</para>
71
+		  <section id="presence_mwi.p.default_expires">
72
+               <title><varname>default_expires</varname> (int)</title>
73
+               <para>
74
+               The default expires value used when missing from SUBSCRIBE
75
+               message (in seconds).
76
+               </para>
77
+               <para>
78
+               <emphasis>Default value is <quote>3600</quote>.
79
+               </emphasis>
80
+               </para>
81
+               <example>
82
+               <title>Set <varname>default_expires</varname> parameter</title>
83
+               <programlisting format="linespecific">
84
+            ...
85
+            modparam("presence_mwi", "default_expires", 3600)
86
+            ...
87
+            </programlisting>
88
+                </example>
89
+            </section>
90
+
74 91
         </section>
75 92
 
76 93
         <section>
... ...
@@ -59,6 +59,9 @@ static int mod_init(void);
59 59
 /* module variables */
60 60
 add_event_t pres_add_event;
61 61
 
62
+/* module parameters */
63
+unsigned int pres_mwi_default_expires = 3600;
64
+
62 65
 /* module exported commands */
63 66
 static cmd_export_t cmds[] =
64 67
 {
... ...
@@ -67,6 +70,7 @@ static cmd_export_t cmds[] =
67 70
 
68 71
 /* module exported paramaters */
69 72
 static param_export_t params[] = {
73
+	{ "default_expires", INT_PARAM, &pres_mwi_default_expires },
70 74
 	{0, 0, 0}
71 75
 };
72 76
 
... ...
@@ -34,5 +34,6 @@
34 34
 #define _PRES_MWI_H_
35 35
 
36 36
 extern add_event_t pres_add_event;
37
+extern unsigned int pres_mwi_default_expires;
37 38
 
38 39
 #endif