Skip to content

Commit

Permalink
topos: added methods_nocontact parameter
Browse files Browse the repository at this point in the history
- specify the list of methods to skip adding contact header for
  • Loading branch information
miconda committed Jun 21, 2022
1 parent 414c7dd commit ab714eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions src/modules/topos/topos_mod.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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}
};

Expand Down Expand Up @@ -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)) {
Expand Down
6 changes: 3 additions & 3 deletions src/modules/topos/tps_msg.c
Expand Up @@ -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;
Expand All @@ -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;

/**
*
*/
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit ab714eb

Please sign in to comment.