Browse code

topos: db storage of record route based on rr_update param

Daniel-Constantin Mierla authored on 07/01/2021 09:23:35
Showing 1 changed files
... ...
@@ -1492,6 +1492,29 @@ int tps_db_update_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd,
1492 1492
 			nr_ucols++;
1493 1493
 		}
1494 1494
 	}
1495
+	if(sd->b_tag.len>0 && ((mode & TPS_DBU_BRR) || (mode & TPS_DBU_ARR))) {
1496
+		if(((md->direction == TPS_DIR_DOWNSTREAM) && (msg->first_line.type==SIP_REPLY)) ||
1497
+					((md->direction == TPS_DIR_UPSTREAM) && (msg->first_line.type==SIP_REQUEST))) {
1498
+			if(((sd->iflags&TPS_IFLAG_DLGON) == 0) && (mode & TPS_DBU_BRR)) {
1499
+				db_ucols[nr_ucols] = &td_col_b_rr;
1500
+				db_uvals[nr_ucols].type = DB1_STR;
1501
+				db_uvals[nr_ucols].val.str_val = TPS_STRZ(md->b_rr);
1502
+				nr_ucols++;
1503
+			}
1504
+		} else {
1505
+			if(((sd->iflags&TPS_IFLAG_DLGON) == 0) && (mode & TPS_DBU_ARR)) {
1506
+				db_ucols[nr_ucols] = &td_col_a_rr;
1507
+				db_uvals[nr_ucols].type = DB1_STR;
1508
+				db_uvals[nr_ucols].val.str_val = TPS_STRZ(md->a_rr);
1509
+				nr_ucols++;
1510
+				db_ucols[nr_ucols] = &td_col_s_rr;
1511
+				db_uvals[nr_ucols].type = DB1_STR;
1512
+				db_uvals[nr_ucols].val.str_val = TPS_STRZ(md->s_rr);
1513
+				nr_ucols++;
1514
+			}
1515
+		}
1516
+	}
1517
+
1495 1518
 	if(nr_ucols==0) {
1496 1519
 		return 0;
1497 1520
 	}