Module: kamailio
Branch: master
Commit: ab714eb386060df994875cfd1c8cf2b61fe7fa8f
URL:
https://github.com/kamailio/kamailio/commit/ab714eb386060df994875cfd1c8cf2b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-06-21T08:57:06+02:00
topos: added methods_nocontact parameter
- specify the list of methods to skip adding contact header for
---
Modified: src/modules/topos/topos_mod.c
Modified: src/modules/topos/tps_msg.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ab714eb386060df994875cfd1c8cf2b…
Patch:
https://github.com/kamailio/kamailio/commit/ab714eb386060df994875cfd1c8cf2b…
---
diff --git a/src/modules/topos/topos_mod.c b/src/modules/topos/topos_mod.c
index 498cc8defe..0c78f3ee38 100644
--- a/src/modules/topos/topos_mod.c
+++ b/src/modules/topos/topos_mod.c
@@ -50,6 +50,7 @@
#include "../../core/parser/parse_uri.h"
#include "../../core/parser/parse_to.h"
#include "../../core/parser/parse_from.h"
+#include "../../core/parser/parse_methods.h"
#include "../../core/timer_proc.h"
#include "../../core/fmsg.h"
#include "../../core/onsend.h"
@@ -84,6 +85,8 @@ str _tps_storage = str_init("db");
extern int _tps_branch_expire;
extern int _tps_dialog_expire;
+extern unsigned int _tps_methods_nocontact;
+str _tps_methods_nocontact_list = str_init("");
int _tps_clean_interval = 60;
@@ -165,6 +168,8 @@ static param_export_t params[]={
{"xavu_field_contact_host", PARAM_STR, &_tps_xavu_field_contact_host},
{"rr_update", PARAM_INT, &_tps_rr_update},
{"context", PARAM_STR, &_tps_context_param},
+ {"methods_nocontact", PARAM_STR, &_tps_methods_nocontact_list},
+
{0,0,0}
};
@@ -214,6 +219,12 @@ static int mod_init(void)
return -1;
}
+ if(_tps_methods_nocontact_list.len>0) {
+ if(parse_methods(&_tps_methods_nocontact_list, &_tps_methods_nocontact)<0)
{
+ LM_ERR("failed to parse methods_nocontact parameter\n");
+ return -1;
+ }
+ }
if(_tps_storage.len==2 && strncmp(_tps_storage.s, "db", 2)==0) {
/* Find a database module */
if (db_bind_mod(&_tps_db_url, &_tpsdbf)) {
diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c
index c01dde7b3f..6f5633119d 100644
--- a/src/modules/topos/tps_msg.c
+++ b/src/modules/topos/tps_msg.c
@@ -46,8 +46,6 @@
#include "tps_msg.h"
#include "tps_storage.h"
-#define TPS_METHODS_NOCONTACT (METHOD_CANCEL|METHOD_BYE|METHOD_PRACK)
-
extern int _tps_param_mask_callid;
extern int _tps_contact_mode;
extern str _tps_cparam_name;
@@ -59,6 +57,8 @@ extern str _tps_context_value;
str _sr_hname_xbranch = str_init("P-SR-XBranch");
str _sr_hname_xuuid = str_init("P-SR-XUID");
+unsigned int _tps_methods_nocontact = METHOD_CANCEL|METHOD_BYE|METHOD_PRACK;
+
/**
*
*/
@@ -584,7 +584,7 @@ int tps_reinsert_contact(sip_msg_t *msg, tps_data_t *ptsd, str
*hbody)
{
str hname = str_init("Contact");
- if (get_cseq(msg)->method_id & TPS_METHODS_NOCONTACT) {
+ if (get_cseq(msg)->method_id & _tps_methods_nocontact) {
return 0;
}