Module: kamailio
Branch: master
Commit: ad8e1c4d0cfb0a8c6af17b08900ef45064e54303
URL:
https://github.com/kamailio/kamailio/commit/ad8e1c4d0cfb0a8c6af17b08900ef45…
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_xml: use parameter default_expires instead of 3600 constant
- GH #2996
---
Modified: src/modules/presence_xml/add_events.c
Modified: src/modules/presence_xml/doc/presence_xml_admin.xml
Modified: src/modules/presence_xml/presence_xml.c
Modified: src/modules/presence_xml/presence_xml.h
---
Diff:
https://github.com/kamailio/kamailio/commit/ad8e1c4d0cfb0a8c6af17b08900ef45…
Patch:
https://github.com/kamailio/kamailio/commit/ad8e1c4d0cfb0a8c6af17b08900ef45…
---
diff --git a/src/modules/presence_xml/add_events.c
b/src/modules/presence_xml/add_events.c
index a7e82aa71f..54a3c52bf4 100644
--- a/src/modules/presence_xml/add_events.c
+++ b/src/modules/presence_xml/add_events.c
@@ -33,6 +33,7 @@
#include "../../core/parser/parse_content.h"
#include "../../core/data_lump_rpl.h"
#include "../../core/ut.h"
+#include "../presence/presence.h"
#include "xcap_auth.h"
#include "notify_body.h"
#include "add_events.h"
@@ -65,7 +66,7 @@ int xml_add_events(void)
event.agg_nbody = pres_agg_nbody;
event.evs_publ_handl = xml_publ_handl;
event.free_body = free_xml_body;
- event.default_expires = 3600;
+ event.default_expires = pxml_default_expires;
event.get_rules_doc = pres_get_rules_doc;
event.get_pidf_doc = pres_get_pidf_doc;
if(psapi.add_event(&event) < 0) {
@@ -85,7 +86,7 @@ int xml_add_events(void)
event.content_type.len = 27;
event.type = WINFO_TYPE;
event.free_body = free_xml_body;
- event.default_expires = 3600;
+ event.default_expires = pxml_default_expires;
if(psapi.add_event(&event) < 0) {
LM_ERR("while adding event presence.winfo\n");
@@ -106,7 +107,7 @@ int xml_add_events(void)
event.content_type.len = 27;
event.type = PUBL_TYPE;
event.free_body = free_xml_body;
- event.default_expires = 3600;
+ event.default_expires = pxml_default_expires;
if(psapi.add_event(&event) < 0) {
LM_ERR("while adding event dialog;sla\n");
return -1;
@@ -124,7 +125,7 @@ int xml_add_events(void)
event.content_type.len = 25;
event.type = PUBL_TYPE;
- event.default_expires = 3600;
+ event.default_expires = pxml_default_expires;
if(psapi.add_event(&event) < 0) {
LM_ERR("while adding event xcap-diff\n");
return -1;
diff --git a/src/modules/presence_xml/doc/presence_xml_admin.xml
b/src/modules/presence_xml/doc/presence_xml_admin.xml
index 4eaf7d82ac..387fd2f759 100644
--- a/src/modules/presence_xml/doc/presence_xml_admin.xml
+++ b/src/modules/presence_xml/doc/presence_xml_admin.xml
@@ -413,6 +413,27 @@ modparam("presence_xml",
"presence_single_body_lookup_element", "status")
</programlisting>
</example>
</section>
+
+<section id="presence_xml.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_xml", "default_expires", 3600)
+...
+</programlisting>
+ </example>
+</section>
+
</section>
diff --git a/src/modules/presence_xml/presence_xml.c
b/src/modules/presence_xml/presence_xml.c
index cc9b814eed..85ebca3d49 100644
--- a/src/modules/presence_xml/presence_xml.c
+++ b/src/modules/presence_xml/presence_xml.c
@@ -98,6 +98,8 @@ int pxml_force_single_body = 0;
str pxml_single_body_priorities = str_init("Available|Ringing|On the Phone");
str pxml_single_body_lookup_element = str_init("note");
+unsigned int pxml_default_expires = 3600;
+
/** SL API structure */
sl_api_t slb;
@@ -138,6 +140,7 @@ static param_export_t params[]={
{ "force_presence_single_body", INT_PARAM, &pxml_force_single_body },
{ "presence_single_body_priorities", PARAM_STR,
&pxml_single_body_priorities },
{ "presence_single_body_lookup_element", PARAM_STR,
&pxml_single_body_lookup_element },
+ { "default_expires", INT_PARAM, &pxml_default_expires },
{ 0, 0, 0}
};
/* clang-format on */
diff --git a/src/modules/presence_xml/presence_xml.h
b/src/modules/presence_xml/presence_xml.h
index e77891e642..7c20b9c7eb 100644
--- a/src/modules/presence_xml/presence_xml.h
+++ b/src/modules/presence_xml/presence_xml.h
@@ -53,4 +53,6 @@ extern int pxml_integrated_xcap_server;
extern xcap_serv_t *xs_list;
extern xcapGetNewDoc_t xcap_GetNewDoc;
+extern unsigned int pxml_default_expires;
+
#endif