Browse code

topos: disable multiple comma separated values in One Single Via, Record-Route or Route header if needed (#3220)

* topos: enable multiple Via values in separate via header
* topos: disable multiple comma separated values in One Single Via, Record-Route or Route header
* topos: disable multiple comma separated values in One Single Via, Record-Route or Route header
* topos: disable multiple comma separated values in One Single Via, Record-Route or Route header
* change parameter name for disabling compact form values

Mvondo Eric authored on 21/08/2022 13:19:51 • GitHub committed on 21/08/2022 13:19:51
Showing 1 changed files
... ...
@@ -81,6 +81,7 @@ static str _tps_db_url = str_init(DEFAULT_DB_URL);
81 81
 int _tps_param_mask_callid = 0;
82 82
 int _tps_sanity_checks = 0;
83 83
 int _tps_rr_update = 0;
84
+int _tps_header_mode = 0;
84 85
 str _tps_storage = str_init("db");
85 86
 
86 87
 extern int _tps_branch_expire;
... ...
@@ -156,6 +157,7 @@ static param_export_t params[]={
156 157
 	{"db_url",		PARAM_STR, &_tps_db_url},
157 158
 	{"mask_callid",		PARAM_INT, &_tps_param_mask_callid},
158 159
 	{"sanity_checks",	PARAM_INT, &_tps_sanity_checks},
160
+	{"header_mode",	PARAM_INT, &_tps_header_mode},
159 161
 	{"branch_expire",	PARAM_INT, &_tps_branch_expire},
160 162
 	{"dialog_expire",	PARAM_INT, &_tps_dialog_expire},
161 163
 	{"clean_interval",	PARAM_INT, &_tps_clean_interval},
Browse code

topos: parse the corresponding param for initial methods

Daniel-Constantin Mierla authored on 14/07/2022 06:42:34
Showing 1 changed files
... ...
@@ -229,7 +229,7 @@ static int mod_init(void)
229 229
 		}
230 230
 	}
231 231
 	if(_tps_methods_noinitial_list.len>0) {
232
-		if(parse_methods(&_tps_methods_nocontact_list, &_tps_methods_noinitial)<0) {
232
+		if(parse_methods(&_tps_methods_noinitial_list, &_tps_methods_noinitial)<0) {
233 233
 			LM_ERR("failed to parse methods_noinitial parameter\n");
234 234
 			return -1;
235 235
 		}
Browse code

topos: new parameter to allow specifying initial request methods to skip topos

Daniel-Constantin Mierla authored on 05/07/2022 18:36:24
Showing 1 changed files
... ...
@@ -87,6 +87,8 @@ extern int _tps_branch_expire;
87 87
 extern int _tps_dialog_expire;
88 88
 extern unsigned int _tps_methods_nocontact;
89 89
 str _tps_methods_nocontact_list = str_init("");
90
+extern unsigned int _tps_methods_noinitial;
91
+str _tps_methods_noinitial_list = str_init("");
90 92
 
91 93
 int _tps_clean_interval = 60;
92 94
 
... ...
@@ -169,6 +171,7 @@ static param_export_t params[]={
169 171
 	{"rr_update",		PARAM_INT, &_tps_rr_update},
170 172
 	{"context",			PARAM_STR, &_tps_context_param},
171 173
 	{"methods_nocontact",		PARAM_STR, &_tps_methods_nocontact_list},
174
+	{"methods_noinitial",		PARAM_STR, &_tps_methods_noinitial_list},
172 175
 
173 176
 	{0,0,0}
174 177
 };
... ...
@@ -225,6 +228,12 @@ static int mod_init(void)
225 228
 			return -1;
226 229
 		}
227 230
 	}
231
+	if(_tps_methods_noinitial_list.len>0) {
232
+		if(parse_methods(&_tps_methods_nocontact_list, &_tps_methods_noinitial)<0) {
233
+			LM_ERR("failed to parse methods_noinitial parameter\n");
234
+			return -1;
235
+		}
236
+	}
228 237
 	if(_tps_storage.len==2 && strncmp(_tps_storage.s, "db", 2)==0) {
229 238
 		/* Find a database module */
230 239
 		if (db_bind_mod(&_tps_db_url, &_tpsdbf)) {
Browse code

topos: added methods_nocontact parameter

- specify the list of methods to skip adding contact header for

Daniel-Constantin Mierla authored on 21/06/2022 06:52:41
Showing 1 changed files
... ...
@@ -50,6 +50,7 @@
50 50
 #include "../../core/parser/parse_uri.h"
51 51
 #include "../../core/parser/parse_to.h"
52 52
 #include "../../core/parser/parse_from.h"
53
+#include "../../core/parser/parse_methods.h"
53 54
 #include "../../core/timer_proc.h"
54 55
 #include "../../core/fmsg.h"
55 56
 #include "../../core/onsend.h"
... ...
@@ -84,6 +85,8 @@ str _tps_storage = str_init("db");
84 85
 
85 86
 extern int _tps_branch_expire;
86 87
 extern int _tps_dialog_expire;
88
+extern unsigned int _tps_methods_nocontact;
89
+str _tps_methods_nocontact_list = str_init("");
87 90
 
88 91
 int _tps_clean_interval = 60;
89 92
 
... ...
@@ -165,6 +168,8 @@ static param_export_t params[]={
165 168
 	{"xavu_field_contact_host", PARAM_STR, &_tps_xavu_field_contact_host},
166 169
 	{"rr_update",		PARAM_INT, &_tps_rr_update},
167 170
 	{"context",			PARAM_STR, &_tps_context_param},
171
+	{"methods_nocontact",		PARAM_STR, &_tps_methods_nocontact_list},
172
+
168 173
 	{0,0,0}
169 174
 };
170 175
 
... ...
@@ -214,6 +219,12 @@ static int mod_init(void)
214 219
 		return -1;
215 220
 	}
216 221
 
222
+	if(_tps_methods_nocontact_list.len>0) {
223
+		if(parse_methods(&_tps_methods_nocontact_list, &_tps_methods_nocontact)<0) {
224
+			LM_ERR("failed to parse methods_nocontact parameter\n");
225
+			return -1;
226
+		}
227
+	}
217 228
 	if(_tps_storage.len==2 && strncmp(_tps_storage.s, "db", 2)==0) {
218 229
 		/* Find a database module */
219 230
 		if (db_bind_mod(&_tps_db_url, &_tpsdbf)) {
Browse code

topos: init xavp and context modparams to str null

Daniel-Constantin Mierla authored on 13/05/2021 15:53:18
Showing 1 changed files
... ...
@@ -107,13 +107,13 @@ str _tps_contact_host = str_init("");
107 107
 int _tps_contact_mode = 0;
108 108
 str _tps_cparam_name = str_init("tps");
109 109
 
110
-str _tps_xavu_cfg = str_init("");
111
-str _tps_xavu_field_acontact = str_init("");
112
-str _tps_xavu_field_bcontact = str_init("");
113
-str _tps_xavu_field_contact_host = str_init("");
110
+str _tps_xavu_cfg = STR_NULL;
111
+str _tps_xavu_field_acontact = STR_NULL;
112
+str _tps_xavu_field_bcontact = STR_NULL;
113
+str _tps_xavu_field_contact_host = STR_NULL;
114 114
 
115
-str _tps_context_param = str_init("");
116
-str _tps_context_value = str_init("");
115
+str _tps_context_param = STR_NULL;
116
+str _tps_context_value = STR_NULL;
117 117
 
118 118
 sanity_api_t scb;
119 119
 
... ...
@@ -247,7 +247,8 @@ static int mod_init(void)
247 247
 	if(sruid_init(&_tps_sruid, '-', "tpsh", SRUID_INC)<0)
248 248
 		return -1;
249 249
 
250
-	if (_tps_contact_mode == 2 && (_tps_xavu_field_acontact.len <= 0
250
+	if (_tps_contact_mode == 2 && (_tps_xavu_cfg.len <= 0
251
+				|| _tps_xavu_field_acontact.len <= 0
251 252
 				|| _tps_xavu_field_bcontact.len <= 0)) {
252 253
 		LM_ERR("contact_mode parameter is 2,"
253 254
 				" but a_contact or b_contact xavu fields not defined\n");
Browse code

topos: safety handling of onsend data

Daniel-Constantin Mierla authored on 26/04/2021 08:14:15
Showing 1 changed files
... ...
@@ -602,12 +602,15 @@ static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp,
602 602
 	struct run_act_ctx ctx;
603 603
 	int rtb;
604 604
 	sr_kemi_eng_t *keng = NULL;
605
-	struct onsend_info onsnd_info = {0};
605
+	onsend_info_t onsnd_info = {0};
606
+	onsend_info_t *p_onsend_bak;
606 607
 
607 608
 	if(!(_tps_eventrt_mode & evtype)) {
608 609
 		return 0;
609 610
 	}
610 611
 
612
+	p_onsend_bak = p_onsend;
613
+
611 614
 	if(evidx<0) {
612 615
 		if(_tps_eventrt_callback.s!=NULL || _tps_eventrt_callback.len>0) {
613 616
 			keng = sr_kemi_eng_get();
... ...
@@ -627,8 +630,10 @@ static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp,
627 630
 			evidx);
628 631
 	fmsg = faked_msg_next();
629 632
 
630
-	onsnd_info.to = &evp->dst->to;
631
-	onsnd_info.send_sock = evp->dst->send_sock;
633
+	if(evp->dst) {
634
+		onsnd_info.to = &evp->dst->to;
635
+		onsnd_info.send_sock = evp->dst->send_sock;
636
+	}
632 637
 	if(msg!=NULL) {
633 638
 		onsnd_info.buf = msg->buf;
634 639
 		onsnd_info.len = msg->len;
... ...
@@ -650,7 +655,7 @@ static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp,
650 655
 			if(sr_kemi_ctx_route(keng, &ctx, (msg)?msg:fmsg, EVENT_ROUTE,
651 656
 						&_tps_eventrt_callback, evname)<0) {
652 657
 				LM_ERR("error running event route kemi callback\n");
653
-				p_onsend=NULL;
658
+				p_onsend=p_onsend_bak;
654 659
 				return -1;
655 660
 			}
656 661
 		}
... ...
@@ -658,12 +663,12 @@ static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp,
658 663
 	set_route_type(rtb);
659 664
 	if(ctx.run_flags&DROP_R_F) {
660 665
 		LM_DBG("exit due to 'drop' in event route\n");
661
-		p_onsend=NULL;
666
+		p_onsend=p_onsend_bak;
662 667
 		return 1;
663 668
 	}
664 669
 
665 670
 done:
666
-	p_onsend=NULL;
671
+	p_onsend=p_onsend_bak;
667 672
 	return 0;
668 673
 }
669 674
 
Browse code

topos: reset context on msg received callback

Daniel-Constantin Mierla authored on 23/04/2021 10:35:15
Showing 1 changed files
... ...
@@ -432,6 +432,8 @@ int tps_msg_received(sr_event_param_t *evp)
432 432
 	int dialog;
433 433
 	int ret;
434 434
 
435
+	ki_tps_set_context(NULL, NULL);
436
+
435 437
 	obuf = (str*)evp->data;
436 438
 
437 439
 	if(tps_execute_event_route(NULL, evp, TPS_EVENTRT_INCOMING,
Browse code

topos: use xavu instead of avp

- replaced params refering to avp with corresponding xavp alternatives

Daniel-Constantin Mierla authored on 01/04/2021 06:40:25
Showing 1 changed files
... ...
@@ -105,13 +105,12 @@ static str _tps_eventrt_receiving_name = str_init("topos:msg-receiving");
105 105
 
106 106
 str _tps_contact_host = str_init("");
107 107
 int _tps_contact_mode = 0;
108
-str _tps_contact_host_avp = str_init("");
109
-pv_spec_t _tps_contact_host_avp_spec;
110 108
 str _tps_cparam_name = str_init("tps");
111
-str _tps_acontact_avp;
112
-str _tps_bcontact_avp;
113
-pv_spec_t _tps_acontact_spec;
114
-pv_spec_t _tps_bcontact_spec;
109
+
110
+str _tps_xavu_cfg = str_init("");
111
+str _tps_xavu_field_acontact = str_init("");
112
+str _tps_xavu_field_bcontact = str_init("");
113
+str _tps_xavu_field_contact_host = str_init("");
115 114
 
116 115
 str _tps_context_param = str_init("");
117 116
 str _tps_context_value = str_init("");
... ...
@@ -160,9 +159,10 @@ static param_export_t params[]={
160 159
 	{"contact_host",	PARAM_STR, &_tps_contact_host},
161 160
 	{"contact_mode",	PARAM_INT, &_tps_contact_mode},
162 161
 	{"cparam_name",		PARAM_STR, &_tps_cparam_name},
163
-	{"a_contact_avp",	PARAM_STR, &_tps_acontact_avp},
164
-	{"b_contact_avp",	PARAM_STR, &_tps_bcontact_avp},
165
-	{"contact_host_avp",    PARAM_STR, &_tps_contact_host_avp},
162
+	{"xavu_cfg",		PARAM_STR, &_tps_xavu_cfg},
163
+	{"xavu_field_a_contact",	PARAM_STR, &_tps_xavu_field_acontact},
164
+	{"xavu_field_b_contact",	PARAM_STR, &_tps_xavu_field_bcontact},
165
+	{"xavu_field_contact_host", PARAM_STR, &_tps_xavu_field_contact_host},
166 166
 	{"rr_update",		PARAM_INT, &_tps_rr_update},
167 167
 	{"context",			PARAM_STR, &_tps_context_param},
168 168
 	{0,0,0}
... ...
@@ -247,34 +247,12 @@ static int mod_init(void)
247 247
 	if(sruid_init(&_tps_sruid, '-', "tpsh", SRUID_INC)<0)
248 248
 		return -1;
249 249
 
250
-	if (_tps_contact_mode == 2 && (_tps_acontact_avp.s == NULL || _tps_acontact_avp.len == 0 ||
251
-			 _tps_bcontact_avp.s == NULL || _tps_bcontact_avp.len == 0)) {
252
-		LM_ERR("contact_mode parameter is 2, but a_contact and/or b_contact AVPs not defined\n");
250
+	if (_tps_contact_mode == 2 && (_tps_xavu_field_acontact.len <= 0
251
+				|| _tps_xavu_field_bcontact.len <= 0)) {
252
+		LM_ERR("contact_mode parameter is 2,"
253
+				" but a_contact or b_contact xavu fields not defined\n");
253 254
 		return -1;
254 255
 	}
255
-	if(_tps_acontact_avp.len > 0 && _tps_acontact_avp.s != NULL) {
256
-		if(pv_parse_spec(&_tps_acontact_avp, &_tps_acontact_spec) == 0 || _tps_acontact_spec.type != PVT_AVP) {
257
-			LM_ERR("malformed or non AVP %.*s AVP definition\n",
258
-				_tps_acontact_avp.len, _tps_acontact_avp.s);
259
-			return -1;
260
-		}
261
-	}
262
-	if(_tps_bcontact_avp.len > 0 && _tps_bcontact_avp.s != NULL) {
263
-		if(pv_parse_spec(&_tps_bcontact_avp, &_tps_bcontact_spec) == 0 || _tps_bcontact_spec.type != PVT_AVP) {
264
-			LM_ERR("malformed or non AVP %.*s AVP definition\n",
265
-				_tps_bcontact_avp.len, _tps_bcontact_avp.s);
266
-			return -1;
267
-		}
268
-	}
269
-
270
-	if(_tps_contact_host_avp.len > 0 && _tps_contact_host_avp.s != NULL) {
271
-		if(pv_parse_spec(&_tps_contact_host_avp, &_tps_contact_host_avp_spec) == 0
272
-				|| _tps_contact_host_avp_spec.type != PVT_AVP) {
273
-			LM_ERR("malformed or non AVP %.*s AVP definition\n",
274
-			_tps_contact_host_avp.len, _tps_contact_host_avp.s);
275
-			return -1;
276
-		}
277
-	}
278 256
 
279 257
 	sr_event_register_cb(SREV_NET_DATA_IN,  tps_msg_received);
280 258
 	sr_event_register_cb(SREV_NET_DATA_OUT, tps_msg_sent);
Browse code

topos: ability to execute event routes when messages

Daniel-Constantin Mierla authored on 31/03/2021 19:59:51
Showing 1 changed files
... ...
@@ -89,12 +89,20 @@ int _tps_clean_interval = 60;
89 89
 
90 90
 #define TPS_EVENTRT_OUTGOING 1
91 91
 #define TPS_EVENTRT_SENDING  2
92
-static int _tps_eventrt_mode = TPS_EVENTRT_OUTGOING | TPS_EVENTRT_SENDING;
92
+#define TPS_EVENTRT_INCOMING  4
93
+#define TPS_EVENTRT_RECEIVING 8
94
+static int _tps_eventrt_mode = TPS_EVENTRT_OUTGOING | TPS_EVENTRT_SENDING
95
+				| TPS_EVENTRT_INCOMING | TPS_EVENTRT_RECEIVING;
93 96
 static int _tps_eventrt_outgoing = -1;
94 97
 static str _tps_eventrt_callback = STR_NULL;
95 98
 static str _tps_eventrt_outgoing_name = str_init("topos:msg-outgoing");
96 99
 static int _tps_eventrt_sending = -1;
97 100
 static str _tps_eventrt_sending_name = str_init("topos:msg-sending");
101
+static int _tps_eventrt_incoming = -1;
102
+static str _tps_eventrt_incoming_name = str_init("topos:msg-incoming");
103
+static int _tps_eventrt_receiving = -1;
104
+static str _tps_eventrt_receiving_name = str_init("topos:msg-receiving");
105
+
98 106
 str _tps_contact_host = str_init("");
99 107
 int _tps_contact_mode = 0;
100 108
 str _tps_contact_host_avp = str_init("");
... ...
@@ -130,7 +138,8 @@ int bind_topos(topos_api_t *api);
130 138
 
131 139
 static cmd_export_t cmds[]={
132 140
 	{"tps_set_context", (cmd_function)w_tps_set_context,
133
-		1, fixup_spve_null, fixup_free_spve_null, ANY_ROUTE},
141
+		1, fixup_spve_null, fixup_free_spve_null,
142
+		ANY_ROUTE},
134 143
 
135 144
 	{"bind_topos",  (cmd_function)bind_topos,  0,
136 145
 		0, 0, 0},
... ...
@@ -189,6 +198,16 @@ static int mod_init(void)
189 198
 			|| event_rt.rlist[_tps_eventrt_sending]==NULL) {
190 199
 		_tps_eventrt_sending = -1;
191 200
 	}
201
+	_tps_eventrt_incoming = route_lookup(&event_rt, _tps_eventrt_incoming_name.s);
202
+	if(_tps_eventrt_incoming<0
203
+			|| event_rt.rlist[_tps_eventrt_incoming]==NULL) {
204
+		_tps_eventrt_incoming = -1;
205
+	}
206
+	_tps_eventrt_receiving = route_lookup(&event_rt, _tps_eventrt_receiving_name.s);
207
+	if(_tps_eventrt_receiving<0
208
+			|| event_rt.rlist[_tps_eventrt_receiving]==NULL) {
209
+		_tps_eventrt_receiving = -1;
210
+	}
192 211
 
193 212
 	if(faked_msg_init()<0) {
194 213
 		LM_ERR("failed to init fmsg\n");
... ...
@@ -436,6 +455,12 @@ int tps_msg_received(sr_event_param_t *evp)
436 455
 	int ret;
437 456
 
438 457
 	obuf = (str*)evp->data;
458
+
459
+	if(tps_execute_event_route(NULL, evp, TPS_EVENTRT_INCOMING,
460
+				_tps_eventrt_incoming, &_tps_eventrt_incoming_name)==1) {
461
+		return 0;
462
+	}
463
+
439 464
 	memset(&msg, 0, sizeof(sip_msg_t));
440 465
 	msg.buf = obuf->s;
441 466
 	msg.len = obuf->len;
... ...
@@ -449,6 +474,11 @@ int tps_msg_received(sr_event_param_t *evp)
449 474
 		goto done;
450 475
 	}
451 476
 
477
+	if(tps_execute_event_route(&msg, evp, TPS_EVENTRT_RECEIVING,
478
+				_tps_eventrt_receiving, &_tps_eventrt_receiving_name)==1) {
479
+		goto done;
480
+	}
481
+
452 482
 	if(msg.first_line.type==SIP_REQUEST) {
453 483
 		if(_tps_sanity_checks!=0) {
454 484
 			if(scb.check_defaults(&msg)<1) {
Browse code

topos: option to set a context value via modparam or function

- ability to group records

Daniel-Constantin Mierla authored on 31/03/2021 19:46:14
Showing 1 changed files
... ...
@@ -53,6 +53,7 @@
53 53
 #include "../../core/timer_proc.h"
54 54
 #include "../../core/fmsg.h"
55 55
 #include "../../core/onsend.h"
56
+#include "../../core/mod_fix.h"
56 57
 #include "../../core/kemi.h"
57 58
 
58 59
 #include "../../lib/srdb1/db.h"
... ...
@@ -104,6 +105,9 @@ str _tps_bcontact_avp;
104 105
 pv_spec_t _tps_acontact_spec;
105 106
 pv_spec_t _tps_bcontact_spec;
106 107
 
108
+str _tps_context_param = str_init("");
109
+str _tps_context_value = str_init("");
110
+
107 111
 sanity_api_t scb;
108 112
 
109 113
 int tps_msg_received(sr_event_param_t *evp);
... ...
@@ -120,9 +124,14 @@ static int child_init(int rank);
120 124
 /* Module destroy function prototype */
121 125
 static void destroy(void);
122 126
 
127
+static int w_tps_set_context(sip_msg_t* msg, char* pctx, char* p2);
128
+
123 129
 int bind_topos(topos_api_t *api);
124 130
 
125 131
 static cmd_export_t cmds[]={
132
+	{"tps_set_context", (cmd_function)w_tps_set_context,
133
+		1, fixup_spve_null, fixup_free_spve_null, ANY_ROUTE},
134
+
126 135
 	{"bind_topos",  (cmd_function)bind_topos,  0,
127 136
 		0, 0, 0},
128 137
 
... ...
@@ -146,6 +155,7 @@ static param_export_t params[]={
146 155
 	{"b_contact_avp",	PARAM_STR, &_tps_bcontact_avp},
147 156
 	{"contact_host_avp",    PARAM_STR, &_tps_contact_host_avp},
148 157
 	{"rr_update",		PARAM_INT, &_tps_rr_update},
158
+	{"context",			PARAM_STR, &_tps_context_param},
149 159
 	{0,0,0}
150 160
 };
151 161
 
... ...
@@ -298,6 +308,58 @@ static void destroy(void)
298 308
 	tps_storage_lock_set_destroy();
299 309
 }
300 310
 
311
+/**
312
+ *
313
+ */
314
+static int ki_tps_set_context(sip_msg_t* msg, str* ctx)
315
+{
316
+	if(ctx==NULL || ctx->len<=0) {
317
+		if(_tps_context_value.s) {
318
+			pkg_free(_tps_context_value.s);
319
+		}
320
+		_tps_context_value.s = NULL;
321
+		_tps_context_value.len = 0;
322
+		return 1;
323
+	}
324
+
325
+	if(_tps_context_value.len>=ctx->len) {
326
+		memcpy(_tps_context_value.s, ctx->s, ctx->len);
327
+		_tps_context_value.len = ctx->len;
328
+		return 1;
329
+	}
330
+
331
+	if(_tps_context_value.s) {
332
+		pkg_free(_tps_context_value.s);
333
+	}
334
+	_tps_context_value.len = 0;
335
+
336
+	_tps_context_value.s = (char*)pkg_mallocxz(ctx->len + 1);
337
+	if(_tps_context_value.s==NULL) {
338
+		PKG_MEM_ERROR;
339
+		return -1;
340
+	}
341
+
342
+	memcpy(_tps_context_value.s, ctx->s, ctx->len);
343
+	_tps_context_value.len = ctx->len;
344
+
345
+	return 1;
346
+}
347
+
348
+/**
349
+ *
350
+ */
351
+static int w_tps_set_context(sip_msg_t* msg, char* pctx, char* p2)
352
+{
353
+	str sctx = STR_NULL;
354
+
355
+	if(fixup_get_svalue(msg, (gparam_t*)pctx, &sctx)<0) {
356
+		LM_ERR("failed to get context parameter\n");
357
+		return -1;
358
+	}
359
+
360
+	return ki_tps_set_context(msg, &sctx);
361
+}
362
+
301 363
 /**
302 364
  *
303 365
  */
... ...
@@ -612,4 +674,29 @@ int bind_topos(topos_api_t *api)
612 674
 	return 0;
613 675
 }
614 676
 
677
+/**
678
+ *
679
+ */
680
+/* clang-format off */
681
+static sr_kemi_t sr_kemi_topos_exports[] = {
682
+	{ str_init("topos"), str_init("tps_set_context"),
683
+		SR_KEMIP_INT, ki_tps_set_context,
684
+		{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
685
+			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
686
+	},
687
+
688
+	{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
689
+};
690
+/* clang-format on */
691
+
692
+/**
693
+ *
694
+ */
695
+int mod_register(char *path, int *dlflags, void *p1, void *p2)
696
+{
697
+	sr_kemi_modules_add(sr_kemi_topos_exports);
698
+
699
+	return 0;
700
+}
701
+
615 702
 /** @} */
Browse code

topos: add functionality to set a variable host part for the Contact header

- add functionality to set a variable host part for the Contact header
- could be refactored to use a xavp instead of avp, together with the other
parameters in this area ([a,b]_contact_avp)

Henning Westerholt authored on 31/03/2021 13:28:30
Showing 1 changed files
... ...
@@ -96,6 +96,8 @@ static int _tps_eventrt_sending = -1;
96 96
 static str _tps_eventrt_sending_name = str_init("topos:msg-sending");
97 97
 str _tps_contact_host = str_init("");
98 98
 int _tps_contact_mode = 0;
99
+str _tps_contact_host_avp = str_init("");
100
+pv_spec_t _tps_contact_host_avp_spec;
99 101
 str _tps_cparam_name = str_init("tps");
100 102
 str _tps_acontact_avp;
101 103
 str _tps_bcontact_avp;
... ...
@@ -142,7 +144,8 @@ static param_export_t params[]={
142 144
 	{"cparam_name",		PARAM_STR, &_tps_cparam_name},
143 145
 	{"a_contact_avp",	PARAM_STR, &_tps_acontact_avp},
144 146
 	{"b_contact_avp",	PARAM_STR, &_tps_bcontact_avp},
145
-	{"rr_update",       PARAM_INT, &_tps_rr_update},
147
+	{"contact_host_avp",    PARAM_STR, &_tps_contact_host_avp},
148
+	{"rr_update",		PARAM_INT, &_tps_rr_update},
146 149
 	{0,0,0}
147 150
 };
148 151
 
... ...
@@ -235,6 +238,15 @@ static int mod_init(void)
235 238
 		}
236 239
 	}
237 240
 
241
+	if(_tps_contact_host_avp.len > 0 && _tps_contact_host_avp.s != NULL) {
242
+		if(pv_parse_spec(&_tps_contact_host_avp, &_tps_contact_host_avp_spec) == 0
243
+				|| _tps_contact_host_avp_spec.type != PVT_AVP) {
244
+			LM_ERR("malformed or non AVP %.*s AVP definition\n",
245
+			_tps_contact_host_avp.len, _tps_contact_host_avp.s);
246
+			return -1;
247
+		}
248
+	}
249
+
238 250
 	sr_event_register_cb(SREV_NET_DATA_IN,  tps_msg_received);
239 251
 	sr_event_register_cb(SREV_NET_DATA_OUT, tps_msg_sent);
240 252
 
Browse code

topos: handle 100 response completely

- it may be needed by other modules to be processed with all via stack

Daniel-Constantin Mierla authored on 01/03/2021 16:19:03
Showing 1 changed files
... ...
@@ -389,10 +389,6 @@ int tps_msg_received(sr_event_param_t *evp)
389 389
 		}
390 390
 	} else {
391 391
 		/* reply */
392
-		if(msg.first_line.u.reply.statuscode==100) {
393
-			/* nothing to do - it should be absorbed */
394
-			goto done;
395
-		}
396 392
 		tps_response_received(&msg);
397 393
 	}
398 394
 
Browse code

topos: added rr_update modparam

- control if record-route should be updated for requests within dialog

balajee authored on 07/01/2021 08:36:34 • Daniel-Constantin Mierla committed on 07/01/2021 09:24:13
Showing 1 changed files
... ...
@@ -78,6 +78,7 @@ sruid_t _tps_sruid;
78 78
 static str _tps_db_url = str_init(DEFAULT_DB_URL);
79 79
 int _tps_param_mask_callid = 0;
80 80
 int _tps_sanity_checks = 0;
81
+int _tps_rr_update = 0;
81 82
 str _tps_storage = str_init("db");
82 83
 
83 84
 extern int _tps_branch_expire;
... ...
@@ -141,6 +142,7 @@ static param_export_t params[]={
141 142
 	{"cparam_name",		PARAM_STR, &_tps_cparam_name},
142 143
 	{"a_contact_avp",	PARAM_STR, &_tps_acontact_avp},
143 144
 	{"b_contact_avp",	PARAM_STR, &_tps_bcontact_avp},
145
+	{"rr_update",       PARAM_INT, &_tps_rr_update},
144 146
 	{0,0,0}
145 147
 };
146 148
 
Browse code

topos: add two new modes for topology hiding to preserve Contact user

- add two new modes for topology hiding to preserve Contact user
- add new variables contact_mode, cparam_name, a_contact_avp and b_contact_avp
- if contact_mode is 1, the internal key will be stored in a URI parameter
instead of the Contact user, and the Contact users will be taken from the msg
- contact_mode 2 is the same as 1, but the Contact users will be taken from AVPs
- default is contact_mode 0 - the existing (old) behaviour

Henning Westerholt authored on 23/07/2020 13:48:58
Showing 1 changed files
... ...
@@ -94,6 +94,12 @@ static str _tps_eventrt_outgoing_name = str_init("topos:msg-outgoing");
94 94
 static int _tps_eventrt_sending = -1;
95 95
 static str _tps_eventrt_sending_name = str_init("topos:msg-sending");
96 96
 str _tps_contact_host = str_init("");
97
+int _tps_contact_mode = 0;
98
+str _tps_cparam_name = str_init("tps");
99
+str _tps_acontact_avp;
100
+str _tps_bcontact_avp;
101
+pv_spec_t _tps_acontact_spec;
102
+pv_spec_t _tps_bcontact_spec;
97 103
 
98 104
 sanity_api_t scb;
99 105
 
... ...
@@ -131,6 +137,10 @@ static param_export_t params[]={
131 137
 	{"event_callback",	PARAM_STR, &_tps_eventrt_callback},
132 138
 	{"event_mode",		PARAM_INT, &_tps_eventrt_mode},
133 139
 	{"contact_host",	PARAM_STR, &_tps_contact_host},
140
+	{"contact_mode",	PARAM_INT, &_tps_contact_mode},
141
+	{"cparam_name",		PARAM_STR, &_tps_cparam_name},
142
+	{"a_contact_avp",	PARAM_STR, &_tps_acontact_avp},
143
+	{"b_contact_avp",	PARAM_STR, &_tps_bcontact_avp},
134 144
 	{0,0,0}
135 145
 };
136 146
 
... ...
@@ -203,6 +213,26 @@ static int mod_init(void)
203 213
 	if(sruid_init(&_tps_sruid, '-', "tpsh", SRUID_INC)<0)
204 214
 		return -1;
205 215
 
216
+	if (_tps_contact_mode == 2 && (_tps_acontact_avp.s == NULL || _tps_acontact_avp.len == 0 ||
217
+			 _tps_bcontact_avp.s == NULL || _tps_bcontact_avp.len == 0)) {
218
+		LM_ERR("contact_mode parameter is 2, but a_contact and/or b_contact AVPs not defined\n");
219
+		return -1;
220
+	}
221
+	if(_tps_acontact_avp.len > 0 && _tps_acontact_avp.s != NULL) {
222
+		if(pv_parse_spec(&_tps_acontact_avp, &_tps_acontact_spec) == 0 || _tps_acontact_spec.type != PVT_AVP) {
223
+			LM_ERR("malformed or non AVP %.*s AVP definition\n",
224
+				_tps_acontact_avp.len, _tps_acontact_avp.s);
225
+			return -1;
226
+		}
227
+	}
228
+	if(_tps_bcontact_avp.len > 0 && _tps_bcontact_avp.s != NULL) {
229
+		if(pv_parse_spec(&_tps_bcontact_avp, &_tps_bcontact_spec) == 0 || _tps_bcontact_spec.type != PVT_AVP) {
230
+			LM_ERR("malformed or non AVP %.*s AVP definition\n",
231
+				_tps_bcontact_avp.len, _tps_bcontact_avp.s);
232
+			return -1;
233
+		}
234
+	}
235
+
206 236
 	sr_event_register_cb(SREV_NET_DATA_IN,  tps_msg_received);
207 237
 	sr_event_register_cb(SREV_NET_DATA_OUT, tps_msg_sent);
208 238
 
Browse code

topos: skip http reply handling

Daniel-Constantin Mierla authored on 22/02/2020 09:55:20
Showing 1 changed files
... ...
@@ -269,8 +269,13 @@ int tps_prepare_msg(sip_msg_t *msg)
269 269
 			LM_DBG("non sip request message\n");
270 270
 			return 1;
271 271
 		}
272
-	} else if(msg->first_line.type!=SIP_REPLY) {
273
-		LM_DBG("non sip message\n");
272
+	} else if(msg->first_line.type==SIP_REPLY) {
273
+		if(!IS_SIP_REPLY(msg)) {
274
+			LM_DBG("non sip reply message\n");
275
+			return 1;
276
+		}
277
+	} else {
278
+		LM_DBG("unknown sip message type %d\n", msg->first_line.type);
274 279
 		return 1;
275 280
 	}
276 281
 
Browse code

topos: updated with relocation of lib/srutils to core/utils

Daniel-Constantin Mierla authored on 21/01/2020 13:41:52
Showing 1 changed files
... ...
@@ -56,7 +56,7 @@
56 56
 #include "../../core/kemi.h"
57 57
 
58 58
 #include "../../lib/srdb1/db.h"
59
-#include "../../lib/srutils/sruid.h"
59
+#include "../../core/utils/sruid.h"
60 60
 
61 61
 #include "../../modules/sanity/api.h"
62 62
 
Browse code

topos: fix event_mode parameter type (GH #2115)

Bastian Triller authored on 31/10/2019 11:29:05 • Henning Westerholt committed on 31/10/2019 11:29:05
Showing 1 changed files
... ...
@@ -121,15 +121,15 @@ static cmd_export_t cmds[]={
121 121
 };
122 122
 
123 123
 static param_export_t params[]={
124
-	{"storage",			PARAM_STR, &_tps_storage},
125
-	{"db_url",			PARAM_STR, &_tps_db_url},
124
+	{"storage",		PARAM_STR, &_tps_storage},
125
+	{"db_url",		PARAM_STR, &_tps_db_url},
126 126
 	{"mask_callid",		PARAM_INT, &_tps_param_mask_callid},
127 127
 	{"sanity_checks",	PARAM_INT, &_tps_sanity_checks},
128 128
 	{"branch_expire",	PARAM_INT, &_tps_branch_expire},
129 129
 	{"dialog_expire",	PARAM_INT, &_tps_dialog_expire},
130 130
 	{"clean_interval",	PARAM_INT, &_tps_clean_interval},
131 131
 	{"event_callback",	PARAM_STR, &_tps_eventrt_callback},
132
-	{"event_mode",		PARAM_STR, &_tps_eventrt_mode},
132
+	{"event_mode",		PARAM_INT, &_tps_eventrt_mode},
133 133
 	{"contact_host",	PARAM_STR, &_tps_contact_host},
134 134
 	{0,0,0}
135 135
 };
Browse code

topos: free old outbound buffer inside SREV_NET_DATA_OUT callback

- GH #2027

Daniel-Constantin Mierla authored on 12/08/2019 09:17:33
Showing 1 changed files
... ...
@@ -390,6 +390,7 @@ int tps_msg_sent(sr_event_param_t *evp)
390 390
 	str *obuf;
391 391
 	int dialog;
392 392
 	int local;
393
+	str nbuf = STR_NULL;
393 394
 
394 395
 	obuf = (str*)evp->data;
395 396
 
... ...
@@ -443,7 +444,15 @@ int tps_msg_sent(sr_event_param_t *evp)
443 444
 		tps_response_sent(&msg);
444 445
 	}
445 446
 
446
-	obuf->s = tps_msg_update(&msg, (unsigned int*)&obuf->len);
447
+	nbuf.s = tps_msg_update(&msg, (unsigned int*)&nbuf.len);
448
+	if(nbuf.s!=NULL) {
449
+		LM_DBG("new outbound buffer generated\n");
450
+		pkg_free(obuf->s);
451
+		obuf->s = nbuf.s;
452
+		obuf->len = nbuf.len;
453
+	} else {
454
+		LM_ERR("failed to generate new outbound buffer\n");
455
+	}
447 456
 
448 457
 done:
449 458
 	free_sip_msg(&msg);
Browse code

topos: set context when executing event route

- should fix detection of using KSR.drop()
- reported by GH #1924

Daniel-Constantin Mierla authored on 09/04/2019 11:04:19
Showing 1 changed files
... ...
@@ -521,7 +521,7 @@ static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp,
521 521
 		run_top_route(event_rt.rlist[evidx], (msg)?msg:fmsg, &ctx);
522 522
 	} else {
523 523
 		if(keng!=NULL) {
524
-			if(sr_kemi_route(keng, (msg)?msg:fmsg, EVENT_ROUTE,
524
+			if(sr_kemi_ctx_route(keng, &ctx, (msg)?msg:fmsg, EVENT_ROUTE,
525 525
 						&_tps_eventrt_callback, evname)<0) {
526 526
 				LM_ERR("error running event route kemi callback\n");
527 527
 				p_onsend=NULL;
Browse code

topos: use kemi wrapper to execute routing functions

Daniel-Constantin Mierla authored on 27/02/2019 08:23:57
Showing 1 changed files
... ...
@@ -521,7 +521,7 @@ static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp,
521 521
 		run_top_route(event_rt.rlist[evidx], (msg)?msg:fmsg, &ctx);
522 522
 	} else {
523 523
 		if(keng!=NULL) {
524
-			if(keng->froute((msg)?msg:fmsg, EVENT_ROUTE,
524
+			if(sr_kemi_route(keng, (msg)?msg:fmsg, EVENT_ROUTE,
525 525
 						&_tps_eventrt_callback, evname)<0) {
526 526
 				LM_ERR("error running event route kemi callback\n");
527 527
 				p_onsend=NULL;
Browse code

topos: safety checks for couple of mandatory headers

- first via and call-id

Daniel-Constantin Mierla authored on 23/11/2018 07:51:18
Showing 1 changed files
... ...
@@ -304,6 +304,12 @@ int tps_prepare_msg(sip_msg_t *msg)
304 304
 		return 3;
305 305
 	}
306 306
 
307
+	if(msg->via1==NULL || msg->callid==NULL) {
308
+		LM_ERR("mandatory headers missing - via1: %p callid: %p\n",
309
+				msg->via1, msg->callid);
310
+		return 4;
311
+	}
312
+
307 313
 	return 0;
308 314
 }
309 315
 
Browse code

topos: updated to the new mod interface

Daniel-Constantin Mierla authored on 28/09/2018 08:21:15 • Victor Seva committed on 28/09/2018 11:03:26
Showing 1 changed files
... ...
@@ -137,18 +137,16 @@ static param_export_t params[]={
137 137
 
138 138
 /** module exports */
139 139
 struct module_exports exports= {
140
-	"topos",
140
+	"topos",    /* module name */
141 141
 	DEFAULT_DLFLAGS, /* dlopen flags */
142
-	cmds,
143
-	params,
144
-	0,          /* exported statistics */
145
-	0,          /* exported MI functions */
142
+	cmds,       /* exported  functions */
143
+	params,     /* exported parameters */
144
+	0,          /* exported rpc functions */
146 145
 	0,          /* exported pseudo-variables */
147
-	0,          /* extra processes */
146
+	0,          /* response handling function */
148 147
 	mod_init,   /* module initialization function */
149
-	0,
150
-	destroy,    /* destroy function */
151
-	child_init  /* child initialization function */
148
+	child_init, /* child initialization function */
149
+	destroy     /* destroy function */
152 150
 };
153 151
 
154 152
 /**
Browse code

topos: adding param contact_host

Julien Chavanton authored on 17/07/2018 16:29:40
Showing 1 changed files
... ...
@@ -93,6 +93,7 @@ static str _tps_eventrt_callback = STR_NULL;
93 93
 static str _tps_eventrt_outgoing_name = str_init("topos:msg-outgoing");
94 94
 static int _tps_eventrt_sending = -1;
95 95
 static str _tps_eventrt_sending_name = str_init("topos:msg-sending");
96
+str _tps_contact_host = str_init("");
96 97
 
97 98
 sanity_api_t scb;
98 99
 
... ...
@@ -129,6 +130,7 @@ static param_export_t params[]={
129 130
 	{"clean_interval",	PARAM_INT, &_tps_clean_interval},
130 131
 	{"event_callback",	PARAM_STR, &_tps_eventrt_callback},
131 132
 	{"event_mode",		PARAM_STR, &_tps_eventrt_mode},
133
+	{"contact_host",	PARAM_STR, &_tps_contact_host},
132 134
 	{0,0,0}
133 135
 };
134 136
 
Browse code

topos: execute event_route[topos:sending] with current sip message to be sent

- if drop is used, then the message processing with topos is skipped
- event route is executed after event_route[topos:outgoing]
- new parameter event_mode to control what event_route blocks are
executed

Daniel-Constantin Mierla authored on 03/07/2018 06:46:58
Showing 1 changed files
... ...
@@ -85,16 +85,22 @@ extern int _tps_dialog_expire;
85 85
 
86 86
 int _tps_clean_interval = 60;
87 87
 
88
+#define TPS_EVENTRT_OUTGOING 1
89
+#define TPS_EVENTRT_SENDING  2
90
+static int _tps_eventrt_mode = TPS_EVENTRT_OUTGOING | TPS_EVENTRT_SENDING;
88 91
 static int _tps_eventrt_outgoing = -1;
89 92
 static str _tps_eventrt_callback = STR_NULL;
90
-static str _tps_eventrt_name = str_init("topos:msg-outgoing");
93
+static str _tps_eventrt_outgoing_name = str_init("topos:msg-outgoing");
94
+static int _tps_eventrt_sending = -1;
95
+static str _tps_eventrt_sending_name = str_init("topos:msg-sending");
91 96
 
92 97
 sanity_api_t scb;
93 98
 
94 99
 int tps_msg_received(sr_event_param_t *evp);
95 100
 int tps_msg_sent(sr_event_param_t *evp);
96 101
 
97
-static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp);
102
+static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp,
103
+		int evtype, int evidx, str *evname);
98 104
 
99 105
 /** module functions */
100 106
 /* Module init function prototype */
... ...
@@ -122,6 +128,7 @@ static param_export_t params[]={
122 128
 	{"dialog_expire",	PARAM_INT, &_tps_dialog_expire},
123 129
 	{"clean_interval",	PARAM_INT, &_tps_clean_interval},
124 130
 	{"event_callback",	PARAM_STR, &_tps_eventrt_callback},
131
+	{"event_mode",		PARAM_STR, &_tps_eventrt_mode},
125 132
 	{0,0,0}
126 133
 };
127 134
 
... ...
@@ -147,11 +154,16 @@ struct module_exports exports= {
147 154
  */
148 155
 static int mod_init(void)
149 156
 {
150
-	_tps_eventrt_outgoing = route_lookup(&event_rt, _tps_eventrt_name.s);
157
+	_tps_eventrt_outgoing = route_lookup(&event_rt, _tps_eventrt_outgoing_name.s);
151 158
 	if(_tps_eventrt_outgoing<0
152 159
 			|| event_rt.rlist[_tps_eventrt_outgoing]==NULL) {
153 160
 		_tps_eventrt_outgoing = -1;
154 161
 	}
162
+	_tps_eventrt_sending = route_lookup(&event_rt, _tps_eventrt_sending_name.s);
163
+	if(_tps_eventrt_sending<0
164
+			|| event_rt.rlist[_tps_eventrt_sending]==NULL) {
165
+		_tps_eventrt_sending = -1;
166
+	}
155 167
 
156 168
 	if(faked_msg_init()<0) {
157 169
 		LM_ERR("failed to init fmsg\n");
... ...
@@ -375,7 +387,8 @@ int tps_msg_sent(sr_event_param_t *evp)
375 387
 
376 388
 	obuf = (str*)evp->data;
377 389
 
378
-	if(tps_execute_event_route(NULL, evp)==1) {
390
+	if(tps_execute_event_route(NULL, evp, TPS_EVENTRT_OUTGOING,
391
+				_tps_eventrt_outgoing, &_tps_eventrt_outgoing_name)==1) {
379 392
 		return 0;
380 393
 	}
381 394
 
... ...
@@ -391,7 +404,14 @@ int tps_msg_sent(sr_event_param_t *evp)
391 404
 		goto done;
392 405
 	}
393 406
 
407
+	if(tps_execute_event_route(&msg, evp, TPS_EVENTRT_SENDING,
408
+				_tps_eventrt_sending, &_tps_eventrt_sending_name)==1) {
409
+		goto done;
410
+	}
411
+
394 412
 	if(msg.first_line.type==SIP_REQUEST) {
413
+
414
+
395 415
 		dialog = (get_to(&msg)->tag_value.len>0)?1:0;
396 416
 
397 417
 		local = 0;
... ...
@@ -443,7 +463,8 @@ int tps_get_branch_expire(void)
443 463
 /**
444 464
  *
445 465
  */
446
-static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp)
466
+static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp,
467
+		int evtype, int evidx, str *evname)
447 468
 {
448 469
 	struct sip_msg *fmsg;
449 470
 	struct run_act_ctx ctx;
... ...
@@ -451,7 +472,11 @@ static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp)
451 472
 	sr_kemi_eng_t *keng = NULL;
452 473
 	struct onsend_info onsnd_info = {0};
453 474
 
454
-	if(_tps_eventrt_outgoing<0) {
475
+	if(!(_tps_eventrt_mode & evtype)) {
476
+		return 0;
477
+	}
478
+
479
+	if(evidx<0) {
455 480
 		if(_tps_eventrt_callback.s!=NULL || _tps_eventrt_callback.len>0) {
456 481
 			keng = sr_kemi_eng_get();
457 482
 			if(keng==NULL) {
... ...
@@ -462,12 +487,12 @@ static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp)
462 487
 		}
463 488
 	}
464 489
 
465
-	if(_tps_eventrt_outgoing<0 && keng==NULL) {
490
+	if(evidx<0 && keng==NULL) {
466 491
 		return 0;
467 492
 	}
468 493
 
469
-	LM_DBG("executing event_route[topos:...] (%d)\n",
470
-			_tps_eventrt_outgoing);
494
+	LM_DBG("executing event_route[topos:%.*s] (%d)\n", evname->len, evname->s,
495
+			evidx);
471 496
 	fmsg = faked_msg_next();
472 497
 
473 498
 	onsnd_info.to = &evp->dst->to;
... ...
@@ -486,12 +511,12 @@ static int tps_execute_event_route(sip_msg_t *msg, sr_event_param_t *evp)
486 511
 	rtb = get_route_type();
487 512
 	set_route_type(REQUEST_ROUTE);
488 513
 	init_run_actions_ctx(&ctx);
489
-	if(_tps_eventrt_outgoing>=0) {
490
-		run_top_route(event_rt.rlist[_tps_eventrt_outgoing], fmsg, &ctx);
514
+	if(evidx>=0) {
515
+		run_top_route(event_rt.rlist[evidx], (msg)?msg:fmsg, &ctx);
491 516
 	} else {
492 517
 		if(keng!=NULL) {
493
-			if(keng->froute(fmsg, EVENT_ROUTE,
494
-						&_tps_eventrt_callback, &_tps_eventrt_name)<0) {
518
+			if(keng->froute((msg)?msg:fmsg, EVENT_ROUTE,
519
+						&_tps_eventrt_callback, evname)<0) {
495 520
 				LM_ERR("error running event route kemi callback\n");
496 521
 				p_onsend=NULL;
497 522
 				return -1;
Browse code

topos: use method_id to match KDMQ

Daniel-Constantin Mierla authored on 07/06/2018 07:26:11
Showing 1 changed files
... ...
@@ -400,12 +400,9 @@ int tps_msg_sent(sr_event_param_t *evp)
400 400
 		}
401 401
 
402 402
 		if(local==1 && dialog==0) {
403
-			if((get_cseq(&msg)->method_id) & (METHOD_OPTIONS|METHOD_NOTIFY)) {
404
-				/* skip local out-of-dialog requests (e.g., keepalive) */
405
-				goto done;
406
-			}
407
-			if(get_cseq(&msg)->method.len==4
408
-					&& strncmp(get_cseq(&msg)->method.s, "KDMQ", 4)==0) {
403
+			if((get_cseq(&msg)->method_id)
404
+						& (METHOD_OPTIONS|METHOD_NOTIFY|METHOD_KDMQ)) {
405
+				/* skip local out-of-dialog requests (e.g., keepalive, dmq) */
409 406
 				goto done;
410 407
 			}
411 408
 		}
Browse code

topos: fix condition to match KDMQ method

Daniel-Constantin Mierla authored on 06/06/2018 06:10:15
Showing 1 changed files
... ...
@@ -405,7 +405,7 @@ int tps_msg_sent(sr_event_param_t *evp)
405 405
 				goto done;
406 406
 			}
407 407
 			if(get_cseq(&msg)->method.len==4
408
-					&& strncmp(get_cseq(&msg)->method.s, "KDMQ", 4)) {
408
+					&& strncmp(get_cseq(&msg)->method.s, "KDMQ", 4)==0) {
409 409
 				goto done;
410 410
 			}
411 411
 		}
Browse code

topos: skip handling local DMQ messages

Daniel-Constantin Mierla authored on 30/05/2018 16:04:44
Showing 1 changed files
... ...
@@ -404,6 +404,10 @@ int tps_msg_sent(sr_event_param_t *evp)
404 404
 				/* skip local out-of-dialog requests (e.g., keepalive) */
405 405
 				goto done;
406 406
 			}
407
+			if(get_cseq(&msg)->method.len==4
408
+					&& strncmp(get_cseq(&msg)->method.s, "KDMQ", 4)) {
409
+				goto done;
410
+			}
407 411
 		}
408 412
 
409 413
 		tps_request_sent(&msg, dialog, local);
Browse code

topos: skip local generated request not part of a dialog

Daniel-Constantin Mierla authored on 02/04/2018 06:46:09
Showing 1 changed files
... ...
@@ -399,6 +399,13 @@ int tps_msg_sent(sr_event_param_t *evp)
39