Browse code

Merge e771b1e96d97eafdae640fa79a4d0802db3511ef into 2e85bb541ff19e4b0074b04c4d05399a216deca2

adita76 authored on 18/01/2022 14:38:32 • GitHub committed on 18/01/2022 14:38:32
Showing 24 changed files
... ...
@@ -43,7 +43,7 @@ int conference_add_events(void)
43 43
     event.content_type.s = "application/conference-info+xml";
44 44
     event.content_type.len = 31;
45 45
 
46
-    event.default_expires= 3600;
46
+    event.default_expires = pres_conf_default_expires;
47 47
     event.type = PUBL_TYPE;
48 48
     event.req_auth = 0;
49 49
     event.evs_publ_handl = 0;
... ...
@@ -76,6 +76,26 @@ modparam("presence_conference", "use_partial_states", 0)
76 76
 	    </example>
77 77
 	</section>
78 78
 
79
+<section id="presence_conference.p.default_expires">
80
+               <title><varname>default_expires</varname> (int)</title>
81
+               <para>
82
+               The default expires value used when missing from SUBSCRIBE
83
+               message (in seconds).
84
+               </para>
85
+               <para>
86
+               <emphasis>Default value is <quote>3600</quote>.
87
+               </emphasis>
88
+               </para>
89
+               <example>
90
+               <title>Set <varname>default_expires</varname> parameter</title>
91
+               <programlisting format="linespecific">
92
+...
93
+modparam("presence_conference", "default_expires", 3600)
94
+...
95
+</programlisting>
96
+	</example>
97
+</section>
98
+
79 99
 	</section>
80 100
 	
81 101
 	<section>
... ...
@@ -49,6 +49,7 @@ add_event_t pres_add_event;
49 49
 
50 50
 /* module parameters */
51 51
 int use_partial_states = 0;
52
+unsigned int pres_conf_default_expires = 3600;
52 53
 
53 54
 /* module exported commands */
54 55
 static cmd_export_t cmds[] =
... ...
@@ -59,6 +60,7 @@ static cmd_export_t cmds[] =
59 60
 /* module exported paramaters */
60 61
 static param_export_t params[] = {
61 62
 	{ "use_partial_states", INT_PARAM, &use_partial_states },
63
+	{ "default_expires", INT_PARAM, &pres_conf_default_expires },
62 64
 	{0, 0, 0}
63 65
 };
64 66
 
... ...
@@ -26,5 +26,6 @@
26 26
 #define _PRES_CONFERENCE_H_
27 27
 
28 28
 extern add_event_t pres_add_event;
29
+extern unsigned int pres_conf_default_expires;
29 30
 
30 31
 #endif
... ...
@@ -43,7 +43,7 @@ int dlginfo_add_events(void)
43 43
 	event.content_type.s = "application/dialog-info+xml";
44 44
 	event.content_type.len = 27;
45 45
 
46
-	event.default_expires= 3600;
46
+	event.default_expires= pres_dlginfo_default_expires;
47 47
 	event.type = PUBL_TYPE;
48 48
 	event.req_auth = 0;
49 49
 	event.evs_publ_handl = 0;
... ...
@@ -248,6 +248,26 @@ modparam("presence_dialoginfo", "force_dummy_dialog", 1)
248 248
         </example>
249 249
         </section>
250 250
 
251
+<section id="presence_dialoginfo.p.default_expires">
252
+               <title><varname>default_expires</varname> (int)</title>
253
+               <para>
254
+               The default expires value used when missing from SUBSCRIBE
255
+               message (in seconds).
256
+               </para>
257
+               <para>
258
+               <emphasis>Default value is <quote>3600</quote>.
259
+               </emphasis>
260
+               </para>
261
+               <example>
262
+               <title>Set <varname>default_expires</varname> parameter</title>
263
+               <programlisting format="linespecific">
264
+...
265
+modparam("presence_dialoginfo", "default_expires", 3600)
266
+...
267
+</programlisting>
268
+	</example>
269
+</section>
270
+
251 271
 	</section>
252 272
 
253 273
 	<section>
... ...
@@ -49,6 +49,7 @@ add_event_t pres_add_event;
49 49
 /* module parameters */
50 50
 int force_single_dialog = 0;
51 51
 int force_dummy_dialog = 0;
52
+unsigned int pres_dlginfo_default_expires = 3600;
52 53
 
53 54
 /* module exported commands */
54 55
 static cmd_export_t cmds[] =
... ...
@@ -60,6 +61,7 @@ static cmd_export_t cmds[] =
60 61
 static param_export_t params[] = {
61 62
 	{ "force_single_dialog", INT_PARAM, &force_single_dialog },
62 63
 	{ "force_dummy_dialog", INT_PARAM, &force_dummy_dialog },
64
+	{ "default_expires", INT_PARAM, &pres_dlginfo_default_expires },    
63 65
 	{0, 0, 0}
64 66
 };
65 67
 
... ...
@@ -26,5 +26,6 @@
26 26
 #define _PRES_DLGINFO_H_
27 27
 
28 28
 extern add_event_t pres_add_event;
29
+extern unsigned int pres_dlginfo_default_expires;
29 30
 
30 31
 #endif
... ...
@@ -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
... ...
@@ -45,11 +45,10 @@ int profile_add_events(void)
45 45
 	event.name.s = "ua-profile";
46 46
 	event.name.len = 10;
47 47
 
48
-
49 48
 	event.content_type.s = "text/xml";
50 49
 	event.content_type.len = 8;
51 50
 
52
-	event.default_expires= 3600;
51
+	event.default_expires= pres_profile_default_expires;
53 52
 	event.type = PUBL_TYPE;
54 53
 	event.req_auth = 0;
55 54
 	event.evs_publ_handl = 0;
... ...
@@ -64,9 +64,25 @@
64 64
 	
65 65
 	<section>
66 66
 	  <title>Exported Parameters</title>
67
-		<para>
68
-		  None.
69
-		</para>
67
+            <section id="presence_profile.p.default_expires">
68
+                        <title><varname>default_expires</varname> (int)</title>
69
+                        <para>
70
+                        The default expires value used when missing from SUBSCRIBE
71
+                        message (in seconds).
72
+                        </para>
73
+                        <para>
74
+                        <emphasis>Default value is <quote>3600</quote>.
75
+                        </emphasis>
76
+                        </para>
77
+                        <example>
78
+                        <title>Set <varname>default_expires</varname> parameter</title>
79
+                        <programlisting format="linespecific">
80
+            ...
81
+            modparam("presence_profile", "default_expires", 3600)
82
+            ...
83
+            </programlisting>
84
+                </example>
85
+            </section>
70 86
         </section>
71 87
 
72 88
         <section>
... ...
@@ -56,13 +56,22 @@ static int mod_init(void);
56 56
 /* module variables */
57 57
 add_event_t pres_add_event;
58 58
 
59
+/* module parameters */
60
+unsigned int pres_profile_default_expires = 3600;
61
+
62
+/* module exported paramaters */
63
+static param_export_t params[] = {
64
+	{ "default_expires", INT_PARAM, &pres_profile_default_expires },
65
+	{0, 0, 0}
66
+};
67
+
59 68
 /* module exports */
60 69
 /* clang-format off */
61 70
 struct module_exports exports= {
62 71
 	"presence_profile",	/* module name */
63 72
 	DEFAULT_DLFLAGS,	/* dlopen flags */
64 73
 	0,					/* exported functions */
65
-	0,					/* exported parameters */
74
+	params,				/* exported parameters */
66 75
 	0,					/* RPC method exports */
67 76
 	0,					/* exported pseudo-variables */
68 77
 	0,					/* response handling function */
... ...
@@ -31,5 +31,6 @@
31 31
 #define _PRES_PROFILE_H_
32 32
 
33 33
 extern add_event_t pres_add_event;
34
+extern unsigned int pres_profile_default_expires;
34 35
 
35 36
 #endif
... ...
@@ -39,7 +39,7 @@ int reginfo_add_events(void)
39 39
 
40 40
 	event.content_type.s = "application/reginfo+xml";
41 41
 	event.content_type.len = 23;
42
-	event.default_expires= 3600;
42
+	event.default_expires= pres_reginfo_default_expires;
43 43
 	event.type = PUBL_TYPE;
44 44
 	event.req_auth = 0;
45 45
 	event.evs_publ_handl = 0;
... ...
@@ -64,6 +64,31 @@
64 64
 	  </section>
65 65
 	</section>
66 66
 
67
+    <section>
68
+		<title>Parameters</title>
69
+        <section id="presence_reginfo.p.default_expires">
70
+               <title><varname>default_expires</varname> (int)</title>
71
+               <para>
72
+               The default expires value used when missing from SUBSCRIBE
73
+               message (in seconds).
74
+               </para>
75
+               <para>
76
+               <emphasis>Default value is <quote>3600</quote>.
77
+               </emphasis>
78
+               </para>
79
+               <example>
80
+               <title>Set <varname>default_expires</varname> parameter</title>
81
+               <programlisting format="linespecific">
82
+        ...
83
+        modparam("presence_reginfo", "default_expires", 3600)
84
+        ...
85
+        </programlisting>
86
+            </example>
87
+        </section>
88
+
89
+	</section>
90
+
91
+
67 92
 	<section>
68 93
 		<title>Functions</title>
69 94
 		<para>
... ...
@@ -46,14 +46,23 @@ static int mod_init(void);
46 46
 /* module variables */
47 47
 add_event_t pres_add_event;
48 48
 
49
+/* module parameters */
50
+unsigned int pres_reginfo_default_expires = 3600;
51
+
52
+/* module exported paramaters */
53
+static param_export_t params[] = {
54
+	{ "default_expires", INT_PARAM, &pres_reginfo_default_expires },
55
+	{0, 0, 0}
56
+};
57
+
49 58
 /* module exports */
50 59
 /* clang-format off */
51 60
 struct module_exports exports= {
52 61
     "presence_reginfo",	/* module name */
53 62
 	DEFAULT_DLFLAGS,	/* dlopen flags */
54 63
 	0,					/* exported functions */
55
-	0,					/* exported parameters */
56
-	0,					/* RPC method exports */
64
+	params,				/* exported parameters */
65
+	0,				    /* RPC method exports */
57 66
 	0,					/* exported pseudo-variables */
58 67
 	0,					/* response handling function */
59 68
 	mod_init,			/* module initialization function */
... ...
@@ -25,5 +25,5 @@
25 25
 #define _PRES_REGINFO_H_
26 26
 
27 27
 extern add_event_t pres_add_event;
28
-
28
+extern unsigned int pres_reginfo_default_expires;
29 29
 #endif
... ...
@@ -33,6 +33,7 @@
33 33
 #include "../../core/parser/parse_content.h"
34 34
 #include "../../core/data_lump_rpl.h"
35 35
 #include "../../core/ut.h"
36
+#include "../presence/presence.h"
36 37
 #include "xcap_auth.h"
37 38
 #include "notify_body.h"
38 39
 #include "add_events.h"
... ...
@@ -65,7 +66,7 @@ int xml_add_events(void)
65 66
 		event.agg_nbody = pres_agg_nbody;
66 67
 		event.evs_publ_handl = xml_publ_handl;
67 68
 		event.free_body = free_xml_body;
68
-		event.default_expires = 3600;
69
+		event.default_expires = pxml_default_expires;
69 70
 		event.get_rules_doc = pres_get_rules_doc;
70 71
 		event.get_pidf_doc = pres_get_pidf_doc;
71 72
 		if(psapi.add_event(&event) < 0) {
... ...
@@ -85,7 +86,7 @@ int xml_add_events(void)
85 86
 		event.content_type.len = 27;
86 87
 		event.type = WINFO_TYPE;
87 88
 		event.free_body = free_xml_body;
88
-		event.default_expires = 3600;
89
+		event.default_expires = pxml_default_expires;
89 90
 
90 91
 		if(psapi.add_event(&event) < 0) {
91 92
 			LM_ERR("while adding event presence.winfo\n");
... ...
@@ -106,7 +107,7 @@ int xml_add_events(void)
106 107
 		event.content_type.len = 27;
107 108
 		event.type = PUBL_TYPE;
108 109
 		event.free_body = free_xml_body;
109
-		event.default_expires = 3600;
110
+		event.default_expires = pxml_default_expires;
110 111
 		if(psapi.add_event(&event) < 0) {
111 112
 			LM_ERR("while adding event dialog;sla\n");
112 113
 			return -1;
... ...
@@ -124,7 +125,7 @@ int xml_add_events(void)
124 125
 		event.content_type.len = 25;
125 126
 
126 127
 		event.type = PUBL_TYPE;
127
-		event.default_expires = 3600;
128
+		event.default_expires = pxml_default_expires;
128 129
 		if(psapi.add_event(&event) < 0) {
129 130
 			LM_ERR("while adding event xcap-diff\n");
130 131
 			return -1;
... ...
@@ -413,6 +413,27 @@ modparam("presence_xml", "presence_single_body_lookup_element", "status")
413 413
 </programlisting>
414 414
         </example>
415 415
     </section>
416
+
417
+<section id="presence_xml.p.default_expires">
418
+        <title><varname>default_expires</varname> (int)</title>
419
+        <para>
420
+        The default expires value used when missing from SUBSCRIBE
421
+        message (in seconds).
422
+        </para>
423
+        <para>
424
+        <emphasis>Default value is <quote>3600</quote>.
425
+        </emphasis>
426
+        </para>
427
+        <example>
428
+        <title>Set <varname>default_expires</varname> parameter</title>
429
+        <programlisting format="linespecific">
430
+...
431
+modparam("presence_xml", "default_expires", 3600)
432
+...
433
+</programlisting>
434
+    </example>
435
+</section>
436
+
416 437
 	</section>
417 438
 
418 439
 
... ...
@@ -98,6 +98,8 @@ int pxml_force_single_body = 0;
98 98
 str pxml_single_body_priorities = str_init("Available|Ringing|On the Phone");
99 99
 str pxml_single_body_lookup_element = str_init("note");
100 100
 
101
+unsigned int pxml_default_expires = 3600;
102
+
101 103
 /** SL API structure */
102 104
 sl_api_t slb;
103 105
 
... ...
@@ -138,6 +140,7 @@ static param_export_t params[]={
138 140
 	{ "force_presence_single_body", INT_PARAM, &pxml_force_single_body },
139 141
 	{ "presence_single_body_priorities",  PARAM_STR, &pxml_single_body_priorities },
140 142
 	{ "presence_single_body_lookup_element", PARAM_STR, &pxml_single_body_lookup_element },
143
+	{ "default_expires", INT_PARAM, &pxml_default_expires },
141 144
 	{ 0, 0, 0}
142 145
 };
143 146
 /* clang-format on */
... ...
@@ -53,4 +53,6 @@ extern int pxml_integrated_xcap_server;
53 53
 extern xcap_serv_t *xs_list;
54 54
 extern xcapGetNewDoc_t xcap_GetNewDoc;
55 55
 
56
+extern unsigned int pxml_default_expires;
57
+
56 58
 #endif