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
... ...
@@ -50,6 +50,7 @@ extern int _tps_param_mask_callid;
50 50
 extern int _tps_contact_mode;
51 51
 extern str _tps_cparam_name;
52 52
 extern int _tps_rr_update;
53
+extern int _tps_header_mode;
53 54
 
54 55
 extern str _tps_context_param;
55 56
 extern str _tps_context_value;
... ...
@@ -631,10 +632,53 @@ int tps_remove_name_headers(sip_msg_t *msg, str *hname)
631 632
 /**
632 633
  *
633 634
  */
635
+int tps_reappend_separate_header_values(sip_msg_t *msg, tps_data_t *ptsd, str *hbody, str *hname)
636
+{
637
+
638
+        int i;
639
+        str sb;
640
+        char *p = NULL;
641
+
642
+        if(hbody==NULL || hbody->s==NULL || hbody->len<=0 || hbody->s[0]=='\0')
643
+            return 0;
644
+
645
+        sb.len = 1;
646
+        p = hbody->s;
647
+        for(i=0; i<hbody->len-1; i++) {
648
+            if(hbody->s[i]==',') {
649
+                if(sb.len>0) {
650
+                    sb.s = p;
651
+                    if(sb.s[sb.len-1]==',') sb.len--;
652
+                    if(tps_add_headers(msg, hname, &sb, 0)<0) {
653
+                        return -1;
654
+                    }
655
+                }
656
+                sb.len = 0;
657
+                p = hbody->s + i + 1;
658
+            }
659
+            sb.len++;
660
+        }
661
+
662
+
663
+        if(sb.len>0) {
664
+                sb.s = p;
665
+                if(sb.s[sb.len-1]==',') sb.len--;
666
+                if(tps_add_headers(msg, hname, &sb, 0)<0) {
667
+                    return -1;
668
+                }
669
+        }
670
+
671
+
672
+        return 0;
673
+}
674
+
634 675
 int tps_reappend_via(sip_msg_t *msg, tps_data_t *ptsd, str *hbody)
635 676
 {
636 677
 	str hname = str_init("Via");
637 678
 
679
+	if (TPS_SPLIT_VIA & _tps_header_mode)
680
+		return tps_reappend_separate_header_values(msg, ptsd, hbody,&hname);
681
+
638 682
 	if(tps_add_headers(msg, &hname, hbody, 0)<0) {
639 683
 		return -1;
640 684
 	}
... ...
@@ -744,6 +788,9 @@ int tps_reappend_rr(sip_msg_t *msg, tps_data_t *ptsd, str *hbody)
744 788
 {
745 789
 	str hname = str_init("Record-Route");
746 790
 
791
+	if (TPS_SPLIT_RECORD_ROUTE & _tps_header_mode)
792
+		return tps_reappend_separate_header_values(msg, ptsd, hbody,&hname);
793
+
747 794
 	if(tps_add_headers(msg, &hname, hbody, 0)<0) {
748 795
 		return -1;
749 796
 	}
... ...
@@ -798,6 +845,8 @@ int tps_reappend_route(sip_msg_t *msg, tps_data_t *ptsd, str *hbody, int rev)
798 845
 	trim_zeros_lr(&sb);
799 846
 	trim(&sb);
800 847
 	if(sb.len>0 && sb.s[sb.len-1]==',') sb.len--;
848
+	if (TPS_SPLIT_ROUTE & _tps_header_mode)
849
+		return tps_reappend_separate_header_values(msg, ptsd, &sb,&hname);
801 850
 	if(tps_add_headers(msg, &hname, &sb, 0)<0) {
802 851
 		return -1;
803 852
 	}
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
... ...
@@ -58,6 +58,7 @@ str _sr_hname_xbranch = str_init("P-SR-XBranch");
58 58
 str _sr_hname_xuuid = str_init("P-SR-XUID");
59 59
 
60 60
 unsigned int _tps_methods_nocontact = METHOD_CANCEL|METHOD_BYE|METHOD_PRACK;
61
+unsigned int _tps_methods_noinitial = 0;
61 62
 
62 63
 /**
63 64
  *
... ...
@@ -271,6 +272,13 @@ int tps_skip_msg(sip_msg_t *msg)
271 272
 	if((get_cseq(msg)->method_id)&(METHOD_REGISTER|METHOD_PUBLISH))
272 273
 		return 1;
273 274
 
275
+	if(_tps_methods_noinitial!=0 && msg->first_line.type==SIP_REQUEST
276
+			&& get_to(msg)->tag_value.len<=0) {
277
+		if((get_cseq(msg)->method_id) & _tps_methods_noinitial) {
278
+			return 1;
279
+		}
280
+	}
281
+
274 282
 	return 0;
275 283
 }
276 284
 
Browse code

topos: don't insert contact header for 4xx replies

unless original msg has contact

Victor Seva authored on 07/10/2020 13:35:50 • Daniel-Constantin Mierla committed on 22/06/2022 19:45:35
Showing 1 changed files
... ...
@@ -1167,6 +1167,11 @@ int tps_response_sent(sip_msg_t *msg)
1167 1167
 				&& msg->contact==NULL) {
1168 1168
 		contact_keep = 1;
1169 1169
 	}
1170
+	if(contact_keep==0 && msg->first_line.u.reply.statuscode>=400
1171
+				&& msg->first_line.u.reply.statuscode<500
1172
+				&& msg->contact==NULL) {
1173
+		contact_keep = 1;
1174
+	}
1170 1175
 	if(contact_keep==0) {
1171 1176
 		tps_remove_headers(msg, HDR_CONTACT_T);
1172 1177
 		if(direction==TPS_DIR_DOWNSTREAM) {
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
... ...
@@ -46,8 +46,6 @@
46 46
 #include "tps_msg.h"
47 47
 #include "tps_storage.h"
48 48
 
49
-#define TPS_METHODS_NOCONTACT (METHOD_CANCEL|METHOD_BYE|METHOD_PRACK)
50
-
51 49
 extern int _tps_param_mask_callid;
52 50
 extern int _tps_contact_mode;
53 51
 extern str _tps_cparam_name;
... ...
@@ -59,6 +57,8 @@ extern str _tps_context_value;
59 57
 str _sr_hname_xbranch = str_init("P-SR-XBranch");
60 58
 str _sr_hname_xuuid = str_init("P-SR-XUID");
61 59
 
60
+unsigned int _tps_methods_nocontact = METHOD_CANCEL|METHOD_BYE|METHOD_PRACK;
61
+
62 62
 /**
63 63
  *
64 64
  */
... ...
@@ -584,7 +584,7 @@ int tps_reinsert_contact(sip_msg_t *msg, tps_data_t *ptsd, str *hbody)
584 584
 {
585 585
 	str hname = str_init("Contact");
586 586
 
587
-	if (get_cseq(msg)->method_id & TPS_METHODS_NOCONTACT) {
587
+	if (get_cseq(msg)->method_id & _tps_methods_nocontact) {
588 588
 		return 0;
589 589
 	}
590 590
 
Browse code

topos: skip adding contact header for BYE, CANCEL, PRACK

- GH #3149

Daniel-Constantin Mierla authored on 21/06/2022 06:41:53
Showing 1 changed files
... ...
@@ -46,6 +46,8 @@
46 46
 #include "tps_msg.h"
47 47
 #include "tps_storage.h"
48 48
 
49
+#define TPS_METHODS_NOCONTACT (METHOD_CANCEL|METHOD_BYE|METHOD_PRACK)
50
+
49 51
 extern int _tps_param_mask_callid;
50 52
 extern int _tps_contact_mode;
51 53
 extern str _tps_cparam_name;
... ...
@@ -582,6 +584,10 @@ int tps_reinsert_contact(sip_msg_t *msg, tps_data_t *ptsd, str *hbody)
582 584
 {
583 585
 	str hname = str_init("Contact");
584 586
 
587
+	if (get_cseq(msg)->method_id & TPS_METHODS_NOCONTACT) {
588
+		return 0;
589
+	}
590
+
585 591
 	if(tps_add_headers(msg, &hname, hbody, 0)<0) {
586 592
 		return -1;
587 593
 	}
Browse code

topos: catch INFO requests during early dialog phase

Daniel-Constantin Mierla authored on 28/04/2022 07:36:09
Showing 1 changed files
... ...
@@ -837,7 +837,7 @@ int tps_request_received(sip_msg_t *msg, int dialog)
837 837
 		goto error;
838 838
 	}
839 839
 	metid = get_cseq(msg)->method_id;
840
-	if((metid & (METHOD_BYE|METHOD_PRACK|METHOD_UPDATE))
840
+	if((metid & (METHOD_BYE|METHOD_INFO|METHOD_PRACK|METHOD_UPDATE))
841 841
 			&& stsd.b_contact.len <= 0) {
842 842
 		/* no B-side contact, look for INVITE transaction record */
843 843
 		if(metid & (METHOD_BYE|METHOD_UPDATE)) {
Browse code

topos: restore attributes based on direction for early dialog requests

- GH #3090

Daniel-Constantin Mierla authored on 21/04/2022 12:28:26
Showing 1 changed files
... ...
@@ -863,10 +863,9 @@ int tps_request_received(sip_msg_t *msg, int dialog)
863 863
 		mtsd.direction = direction;
864 864
 	}
865 865
 
866
-
867 866
 	tps_storage_lock_release(&lkey);
868 867
 
869
-	if(use_branch) {
868
+	if(use_branch && direction == TPS_DIR_DOWNSTREAM) {
870 869
 		nuri = stsd.b_contact;
871 870
 	} else {
872 871
 		if(direction == TPS_DIR_UPSTREAM) {
... ...
@@ -884,7 +883,7 @@ int tps_request_received(sip_msg_t *msg, int dialog)
884 883
 		}
885 884
 	}
886 885
 
887
-	if(use_branch) {
886
+	if(use_branch && direction == TPS_DIR_DOWNSTREAM) {
888 887
 		if(tps_reappend_route(msg, &stsd, &stsd.s_rr, 1) < 0) {
889 888
 			LM_ERR("failed to reappend s-route\n");
890 889
 			return -1;
Browse code

topos: use direction for loading invite record for other early dialog requests

- GH #3090

Daniel-Constantin Mierla authored on 21/04/2022 07:00:09
Showing 1 changed files
... ...
@@ -803,6 +803,7 @@ int tps_request_received(sip_msg_t *msg, int dialog)
803 803
 	uint32_t direction = TPS_DIR_DOWNSTREAM;
804 804
 	int ret;
805 805
 	int use_branch = 0;
806
+	unsigned int metid = 0;
806 807
 
807 808
 	LM_DBG("handling incoming request\n");
808 809
 
... ...
@@ -835,11 +836,11 @@ int tps_request_received(sip_msg_t *msg, int dialog)
835 836
 	if(tps_storage_load_dialog(msg, &mtsd, &stsd) < 0) {
836 837
 		goto error;
837 838
 	}
838
-        if(((((get_cseq(msg)->method_id) & (METHOD_PRACK|METHOD_UPDATE))
839
-			&& stsd.b_contact.len <= 0)) || (((get_cseq(msg)->method_id) 
840
-                        & (METHOD_BYE) && stsd.b_contact.len <= 0) && (0 == dialog))) {
839
+	metid = get_cseq(msg)->method_id;
840
+	if((metid & (METHOD_BYE|METHOD_PRACK|METHOD_UPDATE))
841
+			&& stsd.b_contact.len <= 0) {
841 842
 		/* no B-side contact, look for INVITE transaction record */
842
-		if((get_cseq(msg)->method_id) & (METHOD_UPDATE)) {
843
+		if(metid & (METHOD_BYE|METHOD_UPDATE)) {
843 844
 			/* detect direction - via from-tag */
844 845
 			if(tps_dlg_detect_direction(msg, &stsd, &direction) < 0) {
845 846
 				goto error;
... ...
@@ -917,7 +918,7 @@ int tps_request_received(sip_msg_t *msg, int dialog)
917 918
 				goto error;
918 919
 			}
919 920
 		}
920
-		if((get_cseq(msg)->method_id)&(METHOD_SUBSCRIBE)) {
921
+		if(metid & METHOD_SUBSCRIBE) {
921 922
 			if(tps_storage_update_dialog(msg, &mtsd, &stsd, TPS_DBU_CONTACT|TPS_DBU_TIME)<0) {
922 923
 				goto error;
923 924
 			}
Browse code

topos: handle BYE sent by callee during non connected call with provitional response sent by callee (INVITE,180 and BYE from callee instead CANCEL)

frederic authored on 03/03/2022 15:57:28 • Daniel-Constantin Mierla committed on 10/03/2022 09:43:05
Showing 1 changed files
... ...
@@ -835,8 +835,9 @@ int tps_request_received(sip_msg_t *msg, int dialog)
835 835
 	if(tps_storage_load_dialog(msg, &mtsd, &stsd) < 0) {
836 836
 		goto error;
837 837
 	}
838
-	if(((get_cseq(msg)->method_id) & (METHOD_BYE|METHOD_PRACK|METHOD_UPDATE))
839
-			&& stsd.b_contact.len <= 0) {
838
+        if(((((get_cseq(msg)->method_id) & (METHOD_PRACK|METHOD_UPDATE))
839
+			&& stsd.b_contact.len <= 0)) || (((get_cseq(msg)->method_id) 
840
+                        & (METHOD_BYE) && stsd.b_contact.len <= 0) && (0 == dialog))) {
840 841
 		/* no B-side contact, look for INVITE transaction record */
841 842
 		if((get_cseq(msg)->method_id) & (METHOD_UPDATE)) {
842 843
 			/* detect direction - via from-tag */
Browse code

topos: increase the number of db keys for query when using uuid for branch

- debug message to print a/b uuid

Daniel-Constantin Mierla authored on 26/04/2021 12:51:55
Showing 1 changed files
... ...
@@ -826,6 +826,9 @@ int tps_request_received(sip_msg_t *msg, int dialog)
826 826
 	}
827 827
 
828 828
 	lkey = msg->callid->body;
829
+	LM_DBG("callid [%.*s] - a_uuid [%.*s] - b_uuid [%.*s]\n", lkey.len, lkey.s,
830
+			mtsd.a_uuid.len, ((mtsd.a_uuid.len>0)?mtsd.a_uuid.s:""),
831
+			mtsd.b_uuid.len, ((mtsd.b_uuid.len>0)?mtsd.b_uuid.s:""));
829 832
 
830 833
 	tps_storage_lock_get(&lkey);
831 834
 
Browse code

topos: restore checks on uri and sip_params for tps_dlg_message_update()

- use define for expected min len safety checks

Daniel-Constantin Mierla authored on 26/04/2021 11:49:42
Showing 1 changed files
... ...
@@ -309,17 +309,18 @@ int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd, int ctmode)
309 309
 	str tuuid = STR_NULL;
310 310
 	int ret;
311 311
 
312
+#define TPS_TUUID_MIN_LEN 10
313
+
312 314
 	if(parse_sip_msg_uri(msg)<0) {
313 315
 		LM_ERR("failed to parse r-uri\n");
314 316
 		return -1;
315 317
 	}
316 318
 
317
-	if(msg->parsed_uri.sip_params.len<10) {
318
-		LM_DBG("not an expected %s format\n", (ctmode==0)?"user":"param");
319
-		return 1;
320
-	}
321
-
322 319
 	if (ctmode == 1 || ctmode == 2) {
320
+		if(msg->parsed_uri.sip_params.len<TPS_TUUID_MIN_LEN) {
321
+			LM_DBG("not an expected param format\n");
322
+			return 1;
323
+		}
323 324
 		/* find the r-uri parameter */
324 325
 		ret = tps_get_param_value(&msg->parsed_uri.params,
325 326
 			&_tps_cparam_name, &tuuid);
... ...
@@ -332,6 +333,10 @@ int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd, int ctmode)
332 333
 			return 1;
333 334
 		}
334 335
 	} else {
336
+		if(msg->parsed_uri.user.len<TPS_TUUID_MIN_LEN) {
337
+			LM_DBG("not an expected user format\n");
338
+			return 1;
339
+		}
335 340
 		tuuid = msg->parsed_uri.user;
336 341
 	}
337 342
 
Browse code

topos: simplified tps_dlg_message_update()

Daniel-Constantin Mierla authored on 26/04/2021 10:48:37
Showing 1 changed files
... ...
@@ -306,7 +306,7 @@ error:
306 306
  */
307 307
 int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd, int ctmode)
308 308
 {
309
-	str tmp;
309
+	str tuuid = STR_NULL;
310 310
 	int ret;
311 311
 
312 312
 	if(parse_sip_msg_uri(msg)<0) {
... ...
@@ -314,14 +314,15 @@ int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd, int ctmode)
314 314
 		return -1;
315 315
 	}
316 316
 
317
+	if(msg->parsed_uri.sip_params.len<10) {
318
+		LM_DBG("not an expected %s format\n", (ctmode==0)?"user":"param");
319
+		return 1;
320
+	}
321
+
317 322
 	if (ctmode == 1 || ctmode == 2) {
318
-		if(msg->parsed_uri.sip_params.len<10) {
319
-			LM_DBG("not an expected param format\n");
320
-			return 1;
321
-		}
322
-		// find parameter, there might be others
323
+		/* find the r-uri parameter */
323 324
 		ret = tps_get_param_value(&msg->parsed_uri.params,
324
-			&_tps_cparam_name, &tmp);
325
+			&_tps_cparam_name, &tuuid);
325 326
 		if (ret < 0) {
326 327
 			LM_ERR("failed to parse param\n");
327 328
 			return -1;
... ...
@@ -330,31 +331,20 @@ int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd, int ctmode)
330 331
 			LM_DBG("prefix para not found\n");
331 332
 			return 1;
332 333
 		}
333
-		if(memcmp(tmp.s, "atpsh-", 6)==0) {
334
-			ptsd->a_uuid = tmp;
335
-			return 0;
336
-		}
337
-		if(memcmp(tmp.s, "btpsh-", 6)==0) {
338
-			ptsd->a_uuid = tmp;
339
-			ptsd->b_uuid = tmp;
340
-			return 0;
341
-		}
342
-
343 334
 	} else {
344
-		if(msg->parsed_uri.user.len<10) {
345
-			LM_DBG("not an expected user format\n");
346
-			return 1;
347
-		}
348
-		if(memcmp(msg->parsed_uri.user.s, "atpsh-", 6)==0) {
349
-			ptsd->a_uuid = msg->parsed_uri.user;
350
-			return 0;
351
-		}
352
-		if(memcmp(msg->parsed_uri.user.s, "btpsh-", 6)==0) {
353
-			ptsd->a_uuid = msg->parsed_uri.user;
354
-			ptsd->b_uuid = msg->parsed_uri.user;
355
-			return 0;
356
-		}
335
+		tuuid = msg->parsed_uri.user;
336
+	}
337
+
338
+	if(memcmp(tuuid.s, "atpsh-", 6)==0) {
339
+		ptsd->a_uuid = tuuid;
340
+		return 0;
341
+	}
342
+	if(memcmp(tuuid.s, "btpsh-", 6)==0) {
343
+		ptsd->a_uuid = tuuid;
344
+		ptsd->b_uuid = tuuid;
345
+		return 0;
357 346
 	}
347
+
358 348
 	LM_DBG("not an expected prefix\n");
359 349
 
360 350
 	return 1;
... ...
@@ -840,7 +830,6 @@ int tps_request_received(sip_msg_t *msg, int dialog)
840 830
 	if(((get_cseq(msg)->method_id) & (METHOD_BYE|METHOD_PRACK|METHOD_UPDATE))
841 831
 			&& stsd.b_contact.len <= 0) {
842 832
 		/* no B-side contact, look for INVITE transaction record */
843
-		memset(&stsd, 0, sizeof(tps_data_t));
844 833
 		if((get_cseq(msg)->method_id) & (METHOD_UPDATE)) {
845 834
 			/* detect direction - via from-tag */
846 835
 			if(tps_dlg_detect_direction(msg, &stsd, &direction) < 0) {
... ...
@@ -850,6 +839,8 @@ int tps_request_received(sip_msg_t *msg, int dialog)
850 839
 		if(tps_storage_link_msg(msg, &mtsd, direction) < 0) {
851 840
 			goto error;
852 841
 		}
842
+		mtsd.direction = direction;
843
+		memset(&stsd, 0, sizeof(tps_data_t));
853 844
 		if(tps_storage_load_branch(msg, &mtsd, &stsd, 1) < 0) {
854 845
 			goto error;
855 846
 		}
... ...
@@ -859,9 +850,9 @@ int tps_request_received(sip_msg_t *msg, int dialog)
859 850
 		if(tps_dlg_detect_direction(msg, &stsd, &direction) < 0) {
860 851
 			goto error;
861 852
 		}
853
+		mtsd.direction = direction;
862 854
 	}
863 855
 
864
-	mtsd.direction = direction;
865 856
 
866 857
 	tps_storage_lock_release(&lkey);
867 858
 
Browse code

topos: uniform processing for requests during early dialog

- requests that are handled during 1xx state, like PRACK, UPDATE, BYE

Daniel-Constantin Mierla authored on 26/04/2021 07:28:35
Showing 1 changed files
... ...
@@ -834,35 +834,31 @@ int tps_request_received(sip_msg_t *msg, int dialog)
834 834
 
835 835
 	tps_storage_lock_get(&lkey);
836 836
 
837
-	if((get_cseq(msg)->method_id)&(METHOD_PRACK)) {
838
-		if(tps_storage_link_msg(msg, &mtsd, TPS_DIR_DOWNSTREAM)<0) {
837
+	if(tps_storage_load_dialog(msg, &mtsd, &stsd) < 0) {
838
+		goto error;
839
+	}
840
+	if(((get_cseq(msg)->method_id) & (METHOD_BYE|METHOD_PRACK|METHOD_UPDATE))
841
+			&& stsd.b_contact.len <= 0) {
842
+		/* no B-side contact, look for INVITE transaction record */
843
+		memset(&stsd, 0, sizeof(tps_data_t));
844
+		if((get_cseq(msg)->method_id) & (METHOD_UPDATE)) {
845
+			/* detect direction - via from-tag */
846
+			if(tps_dlg_detect_direction(msg, &stsd, &direction) < 0) {
847
+				goto error;
848
+			}
849
+		}
850
+		if(tps_storage_link_msg(msg, &mtsd, direction) < 0) {
839 851
 			goto error;
840 852
 		}
841
-		if(tps_storage_load_branch(msg, &mtsd, &stsd, 1)<0) {
853
+		if(tps_storage_load_branch(msg, &mtsd, &stsd, 1) < 0) {
842 854
 			goto error;
843 855
 		}
844 856
 		use_branch = 1;
845 857
 	} else {
846
-		if(tps_storage_load_dialog(msg, &mtsd, &stsd) < 0) {
858
+		/* detect direction - via from-tag */
859
+		if(tps_dlg_detect_direction(msg, &stsd, &direction) < 0) {
847 860
 			goto error;
848 861
 		}
849
-		if(((get_cseq(msg)->method_id) & (METHOD_BYE))
850
-				&& stsd.b_contact.len <= 0) {
851
-			/* BYE but not B-side contact, look for INVITE transaction record */
852
-			memset(&stsd, 0, sizeof(tps_data_t));
853
-			if(tps_storage_link_msg(msg, &mtsd, TPS_DIR_DOWNSTREAM) < 0) {
854
-				goto error;
855
-			}
856
-			if(tps_storage_load_branch(msg, &mtsd, &stsd, 1) < 0) {
857
-				goto error;
858
-			}
859
-			use_branch = 1;
860
-		} else {
861
-			/* detect direction - via from-tag */
862
-			if(tps_dlg_detect_direction(msg, &stsd, &direction) < 0) {
863
-				goto error;
864
-			}
865
-		}
866 862
 	}
867 863
 
868 864
 	mtsd.direction = direction;
Browse code

topos: set downstream rr set for replies

Daniel-Constantin Mierla authored on 20/04/2021 10:16:31
Showing 1 changed files
... ...
@@ -548,6 +548,14 @@ int tps_pack_message(sip_msg_t *msg, tps_data_t *ptsd)
548 548
 			ptsd->as_contact.len, ZSW(ptsd->as_contact.s), ptsd->as_contact.len,
549 549
 			ptsd->bs_contact.len, ZSW(ptsd->bs_contact.s), ptsd->bs_contact.len);
550 550
 	ptsd->x_rr = ptsd->a_rr;
551
+	if(isreq==0) {
552
+		if(msg->first_line.u.reply.statuscode >= 180
553
+				&& msg->first_line.u.reply.statuscode < 199) {
554
+			/* provisional replies that create early dialogs
555
+			 * - skip 199 Early Dialog Terminated */
556
+			ptsd->y_rr = ptsd->b_rr;
557
+		}
558
+	}
551 559
 	ptsd->s_method_id = get_cseq(msg)->method_id;
552 560
 	if(_tps_context_value.len>0) {
553 561
 		ptsd->x_context = _tps_context_value;
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
... ...
@@ -51,6 +51,9 @@ extern int _tps_contact_mode;
51 51
 extern str _tps_cparam_name;
52 52
 extern int _tps_rr_update;
53 53
 
54
+extern str _tps_context_param;
55
+extern str _tps_context_value;
56
+
54 57
 str _sr_hname_xbranch = str_init("P-SR-XBranch");
55 58
 str _sr_hname_xuuid = str_init("P-SR-XUID");
56 59
 
... ...
@@ -546,6 +549,11 @@ int tps_pack_message(sip_msg_t *msg, tps_data_t *ptsd)
546 549
 			ptsd->bs_contact.len, ZSW(ptsd->bs_contact.s), ptsd->bs_contact.len);
547 550
 	ptsd->x_rr = ptsd->a_rr;
548 551
 	ptsd->s_method_id = get_cseq(msg)->method_id;
552
+	if(_tps_context_value.len>0) {
553
+		ptsd->x_context = _tps_context_value;
554
+	} else if(_tps_context_param.len>0) {
555
+		ptsd->x_context = _tps_context_param;
556
+	}
549 557
 	return 0;
550 558
 }
551 559
 
Browse code

Merge pull request #2662 from fgaisnon/master

support subscribe dialog (topos + topos_redis)

Daniel-Constantin Mierla authored on 09/03/2021 09:32:10 • GitHub committed on 09/03/2021 09:32:10
Showing 0 changed files
Browse code

topos: one more update to enable processing ofr 100

Daniel-Constantin Mierla authored on 01/03/2021 17:16:00
Showing 1 changed files
... ...
@@ -926,11 +926,6 @@ int tps_response_received(sip_msg_t *msg)
926 926
 
927 927
 	LM_DBG("handling incoming response\n");
928 928
 
929
-	if(msg->first_line.u.reply.statuscode==100) {
930
-		/* nothing to do - it should be absorbed */
931
-		return 0;
932
-	}
933
-
934 929
 	memset(&mtsd, 0, sizeof(tps_data_t));
935 930
 	memset(&stsd, 0, sizeof(tps_data_t));
936 931
 	memset(&btsd, 0, sizeof(tps_data_t));
Browse code

topos: when contact mode is set to 1, contact uri created is malformed if received contact has no user part topos: SUBSCRIBE dialog topos: documentation for SUBSCRIBE dialog topos: add description for dialog_expire key

frederic authored on 08/02/2021 14:54:02
Showing 1 changed files
... ...
@@ -905,6 +905,11 @@ int tps_request_received(sip_msg_t *msg, int dialog)
905 905
 				goto error;
906 906
 			}
907 907
 		}
908
+		if((get_cseq(msg)->method_id)&(METHOD_SUBSCRIBE)) {
909
+			if(tps_storage_update_dialog(msg, &mtsd, &stsd, TPS_DBU_CONTACT|TPS_DBU_TIME)<0) {
910
+				goto error;
911
+			}
912
+		}
908 913
 	}
909 914
 	return 0;
910 915
 
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
... ...
@@ -49,6 +49,7 @@
49 49
 extern int _tps_param_mask_callid;
50 50
 extern int _tps_contact_mode;
51 51
 extern str _tps_cparam_name;
52
+extern int _tps_rr_update;
52 53
 
53 54
 str _sr_hname_xbranch = str_init("P-SR-XBranch");
54 55
 str _sr_hname_xuuid = str_init("P-SR-XUID");
... ...
@@ -368,11 +369,18 @@ int tps_pack_message(sip_msg_t *msg, tps_data_t *ptsd)
368 369
 	int vlen;
369 370
 	int r2;
370 371
 	int isreq;
372
+	int rr_update = _tps_rr_update;
371 373
 
372 374
 	if(ptsd->cp==NULL) {
373 375
 		ptsd->cp = ptsd->cbuf;
374 376
 	}
375 377
 
378
+	if(_tps_rr_update) {
379
+		if((msg->first_line.type==SIP_REQUEST) && !(get_to(msg)->tag_value.len>0)) {
380
+			rr_update = 0;
381
+		}
382
+	}
383
+
376 384
 	i = 0;
377 385
 	for(hdr=msg->h_via1; hdr; hdr=next_sibling_hdr(hdr)) {
378 386
 		for(via=(struct via_body*)hdr->parsed; via; via=via->next) {
... ...
@@ -429,7 +437,7 @@ int tps_pack_message(sip_msg_t *msg, tps_data_t *ptsd)
429 437
 				LM_ERR("no more space to pack rr headers\n");
430 438
 				return -1;
431 439
 			}
432
-			if(isreq==1) {
440
+			if(isreq==1 || rr_update) {
433 441
 				/* sip request - get a+s-side record route */
434 442
 				if(i>1) {
435 443
 					if(i==2 &&r2==0) {
... ...
@@ -441,6 +449,12 @@ int tps_pack_message(sip_msg_t *msg, tps_data_t *ptsd)
441 449
 					*ptsd->cp = ',';
442 450
 					ptsd->cp++;
443 451
 					ptsd->a_rr.len++;
452
+					if(rr_update) {
453
+						ptsd->b_rr.len++;
454
+					}
455
+				}
456
+				if(i==1 && rr_update) {
457
+					ptsd->b_rr.s = ptsd->cp;
444 458
 				}
445 459
 				*ptsd->cp = '<';
446 460
 				if(i==1) {
... ...
@@ -458,6 +472,9 @@ int tps_pack_message(sip_msg_t *msg, tps_data_t *ptsd)
458 472
 
459 473
 				ptsd->cp++;
460 474
 				ptsd->a_rr.len++;
475
+				if(rr_update) {
476
+					ptsd->b_rr.len++;
477
+				}
461 478
 
462 479
 				memcpy(ptsd->cp, rr->nameaddr.uri.s, rr->nameaddr.uri.len);
463 480
 				if(i==1) {
... ...
@@ -483,6 +500,10 @@ int tps_pack_message(sip_msg_t *msg, tps_data_t *ptsd)
483 500
 				*ptsd->cp = '>';
484 501
 				ptsd->cp++;
485 502
 				ptsd->a_rr.len++;
503
+				if(rr_update) {
504
+					ptsd->b_rr.len += rr->nameaddr.uri.len;
505
+					ptsd->b_rr.len++;
506
+				}
486 507
 			} else {
487 508
 				/* sip response - get b-side record route */
488 509
 				if(i==1) {
... ...
@@ -879,6 +900,11 @@ int tps_request_received(sip_msg_t *msg, int dialog)
879 900
 	}
880 901
 	if(dialog!=0) {
881 902
 		tps_append_xuuid(msg, &stsd.a_uuid);
903
+		if(_tps_rr_update) {
904
+			if(tps_storage_update_dialog(msg, &mtsd, &stsd, TPS_DBU_RPLATTRS|TPS_DBU_BRR)<0) {
905
+				goto error;
906
+			}
907
+		}
882 908
 	}
883 909
 	return 0;
884 910
 
... ...
@@ -934,7 +960,9 @@ int tps_response_received(sip_msg_t *msg)
934 960
 				TPS_DBU_CONTACT|TPS_DBU_RPLATTRS)<0) {
935 961
 		goto error;
936 962
 	}
937
-	if(tps_storage_update_dialog(msg, &mtsd, &stsd, TPS_DBU_RPLATTRS)<0) {
963
+	if(tps_storage_update_dialog(msg, &mtsd, &stsd,
964
+			(_tps_rr_update)?(TPS_DBU_RPLATTRS|TPS_DBU_BRR|TPS_DBU_ARR)
965
+					:TPS_DBU_RPLATTRS)<0) {
938 966
 		goto error;
939 967
 	}
940 968
 	tps_storage_lock_release(&lkey);
... ...
@@ -1037,7 +1065,9 @@ int tps_request_sent(sip_msg_t *msg, int dialog, int local)
1037 1065
 
1038 1066
 	if(dialog!=0) {
1039 1067
 		tps_storage_end_dialog(msg, &mtsd, ptsd);
1040
-		if(tps_storage_update_dialog(msg, &mtsd, &stsd, TPS_DBU_CONTACT)<0) {
1068
+		if(tps_storage_update_dialog(msg, &mtsd, &stsd,
1069
+					(_tps_rr_update)?(TPS_DBU_CONTACT|TPS_DBU_ARR)
1070
+						:TPS_DBU_CONTACT)<0) {
1041 1071
 			goto error;
1042 1072
 		}
1043 1073
 	}
Browse code

topos: more flexible contact_mode 1/2 param parsing by using existing parse functions

Henning Westerholt authored on 30/07/2020 15:53:37
Showing 1 changed files
... ...
@@ -303,6 +303,7 @@ error:
303 303
 int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd, int ctmode)
304 304
 {
305 305
 	str tmp;
306
+	int ret;
306 307
 
307 308
 	if(parse_sip_msg_uri(msg)<0) {
308 309
 		LM_ERR("failed to parse r-uri\n");
... ...
@@ -314,12 +315,17 @@ int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd, int ctmode)
314 315
 			LM_DBG("not an expected param format\n");
315 316
 			return 1;
316 317
 		}
317
-
318
-		tmp.s = msg->parsed_uri.sip_params.s;
319
-		// skip param and '=' sign
320
-		tmp.s += _tps_cparam_name.len + 1;
321
-		tmp.len = msg->parsed_uri.sip_params.len - _tps_cparam_name.len - 1;
322
-
318
+		// find parameter, there might be others
319
+		ret = tps_get_param_value(&msg->parsed_uri.params,
320
+			&_tps_cparam_name, &tmp);
321
+		if (ret < 0) {
322
+			LM_ERR("failed to parse param\n");
323
+			return -1;
324
+		}
325
+		if (ret == 1) {
326
+			LM_DBG("prefix para not found\n");
327
+			return 1;
328
+		}
323 329
 		if(memcmp(tmp.s, "atpsh-", 6)==0) {
324 330
 			ptsd->a_uuid = tmp;
325 331
 			return 0;
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
... ...
@@ -47,6 +47,8 @@
47 47
 #include "tps_storage.h"
48 48
 
49 49
 extern int _tps_param_mask_callid;
50
+extern int _tps_contact_mode;
51
+extern str _tps_cparam_name;
50 52
 
51 53
 str _sr_hname_xbranch = str_init("P-SR-XBranch");
52 54
 str _sr_hname_xuuid = str_init("P-SR-XUID");
... ...
@@ -298,26 +300,52 @@ error:
298 300
 /**
299 301
  *
300 302
  */
301
-int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd)
303
+int tps_dlg_message_update(sip_msg_t *msg, tps_data_t *ptsd, int ctmode)
302 304
 {
305
+	str tmp;
306
+
303 307
 	if(parse_sip_msg_uri(msg)<0) {
304 308
 		LM_ERR("failed to parse r-uri\n");
305 309
 		return -1;
306 310
 	}
307
-	if(msg->parsed_uri.user.len<10) {
308
-		LM_DBG("not an expected user format\n");
309
-		return 1;
310
-	}
311
-	if(memcmp(msg->parsed_uri.user.s, "atpsh-", 6)==0) {
312
-		ptsd->a_uuid = msg->parsed_uri.user;
313
-		return 0;
314
-	}
315
-	if(memcmp(msg->parsed_uri.user.s, "btpsh-", 6)==0) {
316
-		ptsd->a_uuid = msg->parsed_uri.user;
317
-		ptsd->b_uuid = msg->parsed_uri.user;
318
-		return 0;
311
+
312
+	if (ctmode == 1 || ctmode == 2) {
313
+		if(msg->parsed_uri.sip_params.len<10) {
314
+			LM_DBG("not an expected param format\n");
315
+			return 1;
316
+		}
317
+
318
+		tmp.s = msg->parsed_uri.sip_params.s;
319
+		// skip param and '=' sign
320
+		tmp.s += _tps_cparam_name.len + 1;
321
+		tmp.len = msg->parsed_uri.sip_params.len - _tps_cparam_name.len - 1;
322
+
323
+		if(memcmp(tmp.s, "atpsh-", 6)==0) {
324
+			ptsd->a_uuid = tmp;
325
+			return 0;
326
+		}
327
+		if(memcmp(tmp.s, "btpsh-", 6)==0) {
328
+			ptsd->a_uuid = tmp;
329
+			ptsd->b_uuid = tmp;
330
+			return 0;
331
+		}
332
+
333
+	} else {
334
+		if(msg->parsed_uri.user.len<10) {
335
+			LM_DBG("not an expected user format\n");
336
+			return 1;
337
+		}
338
+		if(memcmp(msg->parsed_uri.user.s, "atpsh-", 6)==0) {
339
+			ptsd->a_uuid = msg->parsed_uri.user;
340
+			return 0;
341
+		}
342
+		if(memcmp(msg->parsed_uri.user.s, "btpsh-", 6)==0) {
343
+			ptsd->a_uuid = msg->parsed_uri.user;
344
+			ptsd->b_uuid = msg->parsed_uri.user;
345
+			return 0;
346
+		}
319 347
 	}
320
-	LM_DBG("not an expected user prefix\n");
348
+	LM_DBG("not an expected prefix\n");
321 349
 
322 350
 	return 1;
323 351
 }
... ...
@@ -753,7 +781,7 @@ int tps_request_received(sip_msg_t *msg, int dialog)
753 781
 		return -1;
754 782
 	}
755 783
 
756
-	ret = tps_dlg_message_update(msg, &mtsd);
784
+	ret = tps_dlg_message_update(msg, &mtsd, _tps_contact_mode);
757 785
 	if(ret<0) {
758 786
 		LM_ERR("failed to update on dlg message\n");
759 787
 		return -1;
Browse code

topos: convert to memory logging helper

Henning Westerholt authored on 13/02/2020 21:52:04
Showing 1 changed files
... ...
@@ -163,8 +163,7 @@ int tps_add_headers(sip_msg_t *msg, str *hname, str *hbody, int hpos)
163 163
 	hs.len = hname->len + 2 + hbody->len;
164 164
 	hs.s  = (char*)pkg_malloc(hs.len + 3);
165 165
 	if (hs.s==NULL) {
166
-		LM_ERR("no pkg memory left (%.*s - %d)\n",
167
-				hname->len, hname->s, hs.len);
166
+		PKG_MEM_ERROR_FMT("(%.*s - %d)\n", hname->len, hname->s, hs.len);
168 167
 		return -1;
169 168
 	}
170 169
 	memcpy(hs.s, hname->s, hname->len);
Browse code

topos: fix typos in the debug messages

Daniel-Constantin Mierla authored on 12/02/2019 22:49:08
Showing 1 changed files
... ...
@@ -346,7 +346,7 @@ int tps_pack_message(sip_msg_t *msg, tps_data_t *ptsd)
346 346
 			i++;
347 347
 			vlen = tps_skip_rw(via->name.s, via->bsize);
348 348
 			if(ptsd->cp + vlen + 2 >= ptsd->cbuf + TPS_DATA_SIZE) {
349
-				LM_ERR("no more spage to pack via headers\n");
349
+				LM_ERR("no more space to pack via headers\n");
350 350
 				return -1;
351 351
 			}
352 352
 			if(i>1) {
... ...
@@ -393,7 +393,7 @@ int tps_pack_message(sip_msg_t *msg, tps_data_t *ptsd)
393 393
 		for(rr =(rr_t*)hdr->parsed; rr; rr=rr->next) {
394 394
 			i++;
395 395
 			if(ptsd->cp + rr->nameaddr.uri.len + 4 >= ptsd->cbuf + TPS_DATA_SIZE) {
396
-				LM_ERR("no more spage to pack rr headers\n");
396
+				LM_ERR("no more space to pack rr headers\n");
397 397
 				return -1;
398 398
 			}
399 399
 			if(isreq==1) {
Browse code

topos: proper condition to detect 3xx redirect for contact updates

- GH #1720

Daniel-Constantin Mierla authored on 23/11/2018 08:06:57
Showing 1 changed files
... ...
@@ -1077,8 +1077,8 @@ int tps_response_sent(sip_msg_t *msg)
1077 1077
 	tps_remove_headers(msg, HDR_RECORDROUTE_T);
1078 1078
 
1079 1079
 	/* keep contact without updates for redirect responses sent out */
1080
-	if(msg->first_line.u.reply.statuscode<300
1081
-			|| msg->first_line.u.reply.statuscode>=400) {
1080
+	if(msg->first_line.u.reply.statuscode>=300
1081
+			&& msg->first_line.u.reply.statuscode<400) {
1082 1082
 		contact_keep = 1;
1083 1083
 	}
1084 1084
 	if(contact_keep==0 && msg->first_line.u.reply.statuscode>100
Browse code

topos: do not add contact header in outgoing 1xx responses if not present

- GH #1720

Daniel-Constantin Mierla authored on 21/11/2018 09:42:02
Showing 1 changed files
... ...
@@ -1029,6 +1029,7 @@ int tps_response_sent(sip_msg_t *msg)
1029 1029
 	str lkey;
1030 1030
 	uint32_t direction = TPS_DIR_UPSTREAM;
1031 1031
 	str xvbranch = {0, 0};
1032
+	int contact_keep = 0;
1032 1033
 
1033 1034
 	LM_DBG("handling outgoing response\n");
1034 1035
 
... ...
@@ -1078,8 +1079,15 @@ int tps_response_sent(sip_msg_t *msg)
1078 1079
 	/* keep contact without updates for redirect responses sent out */
1079 1080
 	if(msg->first_line.u.reply.statuscode<300
1080 1081
 			|| msg->first_line.u.reply.statuscode>=400) {
1082
+		contact_keep = 1;
1083
+	}
1084
+	if(contact_keep==0 && msg->first_line.u.reply.statuscode>100
1085
+				&& msg->first_line.u.reply.statuscode<200
1086
+				&& msg->contact==NULL) {
1087
+		contact_keep = 1;
1088
+	}
1089
+	if(contact_keep==0) {
1081 1090
 		tps_remove_headers(msg, HDR_CONTACT_T);
1082
-
1083 1091
 		if(direction==TPS_DIR_DOWNSTREAM) {
1084 1092
 			tps_reinsert_contact(msg, &stsd, &stsd.as_contact);
1085 1093
 		} else {
Browse code

topos: keep original contact in 3xx responses sent out

- reported by Andrew Pogrebennyk

Daniel-Constantin Mierla authored on 24/07/2018 14:10:16
Showing 1 changed files
... ...
@@ -1074,12 +1074,17 @@ int tps_response_sent(sip_msg_t *msg)
1074 1074
 	mtsd.direction = direction;
1075 1075
 
1076 1076
 	tps_remove_headers(msg, HDR_RECORDROUTE_T);
1077
-	tps_remove_headers(msg, HDR_CONTACT_T);
1078 1077
 
1079
-	if(direction==TPS_DIR_DOWNSTREAM) {
1080
-		tps_reinsert_contact(msg, &stsd, &stsd.as_contact);
1081
-	} else {
1082
-		tps_reinsert_contact(msg, &stsd, &stsd.bs_contact);
1078
+	/* keep contact without updates for redirect responses sent out */
1079
+	if(msg->first_line.u.reply.statuscode<300
1080
+			|| msg->first_line.u.reply.statuscode>=400) {
1081
+		tps_remove_headers(msg, HDR_CONTACT_T);
1082
+
1083
+		if(direction==TPS_DIR_DOWNSTREAM) {
1084
+			tps_reinsert_contact(msg, &stsd, &stsd.as_contact);
1085
+		} else {
1086
+			tps_reinsert_contact(msg, &stsd, &stsd.bs_contact);
1087
+		}
1083 1088
 	}
1084 1089
 
1085 1090
 	tps_reappend_rr(msg, &btsd, &btsd.x_rr);
Browse code

topos: detect first direction for dlg requests before linking contact

- related to GH #1571

Daniel-Constantin Mierla authored on 03/07/2018 07:50:00
Showing 1 changed files
... ...
@@ -936,7 +936,7 @@ int tps_request_sent(sip_msg_t *msg, int dialog, int local)
936 936
 	memset(&mtsd, 0, sizeof(tps_data_t));
937 937
 	memset(&btsd, 0, sizeof(tps_data_t));
938 938
 	memset(&stsd, 0, sizeof(tps_data_t));
939
-	ptsd = &mtsd;
939
+	ptsd = NULL;
940 940
 
941 941
 	if(tps_pack_message(msg, &mtsd)<0) {
942 942
 		LM_ERR("failed to extract and pack the headers\n");
... ...
@@ -956,14 +956,6 @@ int tps_request_sent(sip_msg_t *msg, int dialog, int local)
956 956
 
957 957
 	tps_storage_lock_get(&lkey);
958 958
 
959
-	if(tps_storage_load_branch(msg, &mtsd, &btsd, 0)!=0) {
960
-		if(tps_storage_record(msg, ptsd, dialog)<0) {
961
-			goto error;
962
-		}
963
-	} else {
964
-		ptsd = &btsd;
965
-	}
966
-
967 959
 	if(dialog!=0) {
968 960
 		if(tps_storage_load_dialog(msg, &mtsd, &stsd)==0) {
969 961
 			ptsd = &stsd;
... ...
@@ -975,6 +967,16 @@ int tps_request_sent(sip_msg_t *msg, int dialog, int local)
975 967
 		mtsd.direction = direction;
976 968
 	}
977 969
 
970
+	if(tps_storage_load_branch(msg, &mtsd, &btsd, 0)!=0) {
971
+		if(tps_storage_record(msg, &mtsd, dialog, direction)<0) {
972
+			goto error;
973
+		}
974
+	} else {
975
+		if(ptsd==NULL) ptsd = &btsd;
976
+	}
977
+
978
+	if(ptsd==NULL) ptsd = &mtsd;
979
+
978 980
 	/* local generated requests */
979 981
 	if(local) {
980 982
 		/* ACK and CANCEL go downstream */
Browse code

topos: update contact only for INVTE requests within dialog

Daniel-Constantin Mierla authored on 24/12/2017 07:50:51
Showing 1 changed files
... ...
@@ -1002,9 +1002,9 @@ int tps_request_sent(sip_msg_t *msg, int dialog, int local)
1002 1002
 
1003 1003
 	if(dialog!=0) {
1004 1004
 		tps_storage_end_dialog(msg, &mtsd, ptsd);
1005
-	}
1006
-	if(tps_storage_update_dialog(msg, &mtsd, &stsd, TPS_DBU_CONTACT)<0) {
1007
-		goto error;
1005
+		if(tps_storage_update_dialog(msg, &mtsd, &stsd, TPS_DBU_CONTACT)<0) {
1006
+			goto error;
1007
+		}
1008 1008
 	}
1009 1009
 
1010 1010
 done:
Browse code

topos: sotre and load local side contacts in branch record

- recover them on retransmissions, otherwise no contact header is added
on initial request routing
- reported by GH #1356

Daniel-Constantin Mierla authored on 23/12/2017 18:42:36
Showing 1 changed files
... ...
@@ -931,7 +931,7 @@ int tps_request_sent(sip_msg_t *msg, int dialog, int local)
931 931
 	str xuuid;
932 932
 	uint32_t direction = TPS_DIR_DOWNSTREAM;
933 933
 
934
-	LM_DBG("handling outgoing request\n");
934
+	LM_DBG("handling outgoing request (%d, %d)\n", dialog, local);
935 935
 
936 936
 	memset(&mtsd, 0, sizeof(tps_data_t));
937 937
 	memset(&btsd, 0, sizeof(tps_data_t));
Browse code

topos: update contact in branch record before sending response

- might be updated in config execution
- reported by GH #1339

Daniel-Constantin Mierla authored on 05/12/2017 10:55:51
Showing 1 changed files
... ...
@@ -1081,6 +1081,9 @@ int tps_response_sent(sip_msg_t *msg)
1081 1081
 	}
1082 1082
 
1083 1083
 	tps_reappend_rr(msg, &btsd, &btsd.x_rr);
1084
+	if(tps_storage_update_branch(msg, &mtsd, &btsd, TPS_DBU_CONTACT)<0) {
1085
+		goto error;
1086
+	}
1084 1087
 	if(tps_storage_update_dialog(msg, &mtsd, &stsd, TPS_DBU_CONTACT)<0) {
1085 1088
 		goto error1;
1086 1089
 	}
Browse code

topos: use INVITE transaction record to route BYE if dlg has no B-contact

Daniel-Constantin Mierla authored on 15/08/2017 07:50:35
Showing 1 changed files
... ...
@@ -773,12 +773,25 @@ int tps_request_received(sip_msg_t *msg, int dialog)
773 773
 		}
774 774
 		use_branch = 1;
775 775