Module: kamailio
Branch: master
Commit: dd1872fb5f876fc004c320a1daba55a5ce6f3dc2
URL:
https://github.com/kamailio/kamailio/commit/dd1872fb5f876fc004c320a1daba55a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-12-23T19:42:36+01:00
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
---
Modified: src/modules/topos/tps_msg.c
Modified: src/modules/topos/tps_storage.c
---
Diff:
https://github.com/kamailio/kamailio/commit/dd1872fb5f876fc004c320a1daba55a…
Patch:
https://github.com/kamailio/kamailio/commit/dd1872fb5f876fc004c320a1daba55a…
---
diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c
index 26e25b42c0..632d8119be 100644
--- a/src/modules/topos/tps_msg.c
+++ b/src/modules/topos/tps_msg.c
@@ -931,7 +931,7 @@ int tps_request_sent(sip_msg_t *msg, int dialog, int local)
str xuuid;
uint32_t direction = TPS_DIR_DOWNSTREAM;
- LM_DBG("handling outgoing request\n");
+ LM_DBG("handling outgoing request (%d, %d)\n", dialog, local);
memset(&mtsd, 0, sizeof(tps_data_t));
memset(&btsd, 0, sizeof(tps_data_t));
diff --git a/src/modules/topos/tps_storage.c b/src/modules/topos/tps_storage.c
index 5662b80654..6502f491f3 100644
--- a/src/modules/topos/tps_storage.c
+++ b/src/modules/topos/tps_storage.c
@@ -728,6 +728,26 @@ int tps_db_insert_branch(tps_data_t *td)
db_vals[nr_keys].val.str_val = TPS_STRZ(td->s_cseq);
nr_keys++;
+ db_keys[nr_keys] = &tt_col_a_contact;
+ db_vals[nr_keys].type = DB1_STR;
+ db_vals[nr_keys].val.str_val = TPS_STRZ(td->a_contact);
+ nr_keys++;
+
+ db_keys[nr_keys] = &tt_col_b_contact;
+ db_vals[nr_keys].type = DB1_STR;
+ db_vals[nr_keys].val.str_val = TPS_STRZ(td->b_contact);
+ nr_keys++;
+
+ db_keys[nr_keys] = &tt_col_as_contact;
+ db_vals[nr_keys].type = DB1_STR;
+ db_vals[nr_keys].val.str_val = TPS_STRZ(td->as_contact);
+ nr_keys++;
+
+ db_keys[nr_keys] = &tt_col_bs_contact;
+ db_vals[nr_keys].type = DB1_STR;
+ db_vals[nr_keys].val.str_val = TPS_STRZ(td->bs_contact);
+ nr_keys++;
+
if (_tpsdbf.use_table(_tps_db_handle, &tt_table_name) < 0) {
LM_ERR("failed to perform use table\n");
return -1;
@@ -898,6 +918,8 @@ int tps_db_load_branch(sip_msg_t *msg, tps_data_t *md, tps_data_t
*sd,
db_cols[nr_cols++] = &tt_col_s_cseq;
db_cols[nr_cols++] = &tt_col_a_contact;
db_cols[nr_cols++] = &tt_col_b_contact;
+ db_cols[nr_cols++] = &tt_col_as_contact;
+ db_cols[nr_cols++] = &tt_col_bs_contact;
if (_tpsdbf.use_table(_tps_db_handle, &tt_table_name) < 0) {
LM_ERR("failed to perform use table\n");
@@ -942,6 +964,8 @@ int tps_db_load_branch(sip_msg_t *msg, tps_data_t *md, tps_data_t
*sd,
TPS_DATA_APPEND_DB(sd, db_res, n, &sd->s_cseq); n++;
TPS_DATA_APPEND_DB(sd, db_res, n, &sd->a_contact); n++;
TPS_DATA_APPEND_DB(sd, db_res, n, &sd->b_contact); n++;
+ TPS_DATA_APPEND_DB(sd, db_res, n, &sd->as_contact); n++;
+ TPS_DATA_APPEND_DB(sd, db_res, n, &sd->bs_contact); n++;
done:
if ((db_res!=NULL) && _tpsdbf.free_result(_tps_db_handle, db_res)<0)
@@ -1251,7 +1275,9 @@ int tps_db_update_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t
*sd,
db_vals[nr_keys].val.str_val = TPS_STRZ(sd->a_uuid);
} else {
if(sd->b_uuid.len<=0) {
- LM_ERR("no valid dlg uuid\n");
+ LM_ERR("no valid dlg uuid (%d:%.*s - %d:%.*s)\n",
+ sd->a_uuid.len, sd->a_uuid.len, ZSW(sd->a_uuid.s),
+ sd->b_uuid.len, sd->b_uuid.len, ZSW(sd->b_uuid.s));
return -1;
}
db_vals[nr_keys].val.str_val = TPS_STRZ(sd->b_uuid);