Skip to content

Commit

Permalink
topos: update the db storeage for confirmed dialogs
Browse files Browse the repository at this point in the history
(cherry picked from commit ed262df)
  • Loading branch information
miconda committed Mar 30, 2016
1 parent 1b0638e commit dc6de50
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/topos/tps_msg.c
Expand Up @@ -668,6 +668,8 @@ int tps_request_received(sip_msg_t *msg, int dialog)
uint32_t direction = TPS_DIR_DOWNSTREAM;
int ret;

LM_DBG("handling incoming request\n");

if(dialog==0) {
/* nothing to do for initial request */
return 0;
Expand Down Expand Up @@ -765,6 +767,8 @@ int tps_response_received(sip_msg_t *msg)
str ftag;
uint32_t direction;

LM_DBG("handling incoming response\n");

if(msg->first_line.u.reply.statuscode==100) {
/* nothing to do - it should be absorbed */
return 0;
Expand Down Expand Up @@ -840,6 +844,8 @@ int tps_request_sent(sip_msg_t *msg, int dialog, int local)
str xuuid;
int direction = TPS_DIR_DOWNSTREAM;

LM_DBG("handling outgoing request\n");

memset(&mtsd, 0, sizeof(tps_data_t));
memset(&btsd, 0, sizeof(tps_data_t));
memset(&stsd, 0, sizeof(tps_data_t));
Expand Down Expand Up @@ -872,7 +878,7 @@ int tps_request_sent(sip_msg_t *msg, int dialog, int local)
}

if(dialog!=0) {
if(tps_storage_load_dialog(msg, &btsd, &stsd)==0) {
if(tps_storage_load_dialog(msg, &mtsd, &stsd)==0) {
ptsd = &stsd;
}
}
Expand Down Expand Up @@ -923,6 +929,8 @@ int tps_response_sent(sip_msg_t *msg)
int direction = TPS_DIR_UPSTREAM;
str xvbranch = {0, 0};

LM_DBG("handling outgoing response\n");

memset(&mtsd, 0, sizeof(tps_data_t));
memset(&stsd, 0, sizeof(tps_data_t));
memset(&btsd, 0, sizeof(tps_data_t));
Expand Down
15 changes: 15 additions & 0 deletions modules/topos/tps_storage.c
Expand Up @@ -1009,6 +1009,21 @@ int tps_storage_update_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd)
db_uvals[nr_ucols].val.str_val = TPS_STRZ(md->b_rr);
nr_ucols++;

if(msg->first_line.type==SIP_REPLY) {
if(sd->b_tag.len<=0
&& msg->first_line.u.reply.statuscode>=200
&& msg->first_line.u.reply.statuscode<300) {
db_ucols[nr_ucols] = &td_col_b_tag;
db_uvals[nr_ucols].type = DB1_STR;
db_uvals[nr_ucols].val.str_val = TPS_STRZ(md->b_tag);
nr_ucols++;

db_ucols[nr_ucols] = &td_col_iflags;
db_uvals[nr_ucols].type = DB1_INT;
db_uvals[nr_ucols].val.int_val = 1;
nr_ucols++;
}
}
if (_tpsdbf.use_table(_tps_db_handle, &td_table_name) < 0) {
LM_ERR("failed to perform use table\n");
return -1;
Expand Down

0 comments on commit dc6de50

Please sign in to comment.