Module: kamailio
Branch: 4.4
Commit: dc6de500a862748463c8e3755b813b8c07ee68cb
URL: 
https://github.com/kamailio/kamailio/commit/dc6de500a862748463c8e3755b813b8c07ee68cb

Author: Daniel-Constantin Mierla <[email protected]>
Committer: Daniel-Constantin Mierla <[email protected]>
Date: 2016-03-30T14:33:35+02:00

topos: update the db storeage for confirmed dialogs

(cherry picked from commit ed262dfb056f94e2fc81bcb59cd744f4924a76ef)

---

Modified: modules/topos/tps_msg.c
Modified: modules/topos/tps_storage.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/dc6de500a862748463c8e3755b813b8c07ee68cb.diff
Patch: 
https://github.com/kamailio/kamailio/commit/dc6de500a862748463c8e3755b813b8c07ee68cb.patch

---

diff --git a/modules/topos/tps_msg.c b/modules/topos/tps_msg.c
index f11c0bb..c350db5 100644
--- a/modules/topos/tps_msg.c
+++ b/modules/topos/tps_msg.c
@@ -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;
@@ -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;
@@ -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));
@@ -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;
                }
        }
@@ -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));
diff --git a/modules/topos/tps_storage.c b/modules/topos/tps_storage.c
index 4fb7cd6..632d2ca 100644
--- a/modules/topos/tps_storage.c
+++ b/modules/topos/tps_storage.c
@@ -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;


_______________________________________________
sr-dev mailing list
[email protected]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to