Module: kamailio
Branch: master
Commit: 22c07bbd962ea5e0ff814d059c279a435a4e7338
URL: 
https://github.com/kamailio/kamailio/commit/22c07bbd962ea5e0ff814d059c279a435a4e7338

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2017-03-09T11:30:44+01:00

topos_redis: updated topos dialog update api

---

Modified: src/modules/topos_redis/topos_redis_storage.c
Modified: src/modules/topos_redis/topos_redis_storage.h

---

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

---

diff --git a/src/modules/topos_redis/topos_redis_storage.c 
b/src/modules/topos_redis/topos_redis_storage.c
index 100e823..6a39f03 100644
--- a/src/modules/topos_redis/topos_redis_storage.c
+++ b/src/modules/topos_redis/topos_redis_storage.c
@@ -809,7 +809,8 @@ int tps_redis_load_dialog(sip_msg_t *msg, tps_data_t *md, 
tps_data_t *sd)
 /**
  *
  */
-int tps_redis_update_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd)
+int tps_redis_update_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd,
+               uint32_t mode)
 {
        char* argv[TPS_REDIS_NR_KEYS];
        size_t argvlen[TPS_REDIS_NR_KEYS];
@@ -871,9 +872,14 @@ int tps_redis_update_dialog(sip_msg_t *msg, tps_data_t 
*md, tps_data_t *sd)
        argvlen[argc] = rkey.len;
        argc++;
 
-       TPS_REDIS_SET_ARGS(&md->b_contact, argc, &td_key_b_contact, argv, 
argvlen);
+       if(mode & TPS_DBU_CONTACT) {
+               TPS_REDIS_SET_ARGS(&md->b_contact, argc, &td_key_b_contact,
+                               argv, argvlen);
+               TPS_REDIS_SET_ARGS(&md->b_contact, argc, &td_key_b_contact,
+                               argv, argvlen);
+       }
 
-       if(msg->first_line.type==SIP_REPLY) {
+       if((mode & TPS_DBU_RPLATTRS) && 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) {
@@ -890,6 +896,10 @@ int tps_redis_update_dialog(sip_msg_t *msg, tps_data_t 
*md, tps_data_t *sd)
                }
        }
 
+       if(argc<=2) {
+               return 0;
+       }
+
        rrpl = _tps_redis_api.exec_argv(rsrv, argc, (const char **)argv, 
argvlen);
        if(rrpl==NULL) {
                LM_ERR("failed to execute redis command\n");
diff --git a/src/modules/topos_redis/topos_redis_storage.h 
b/src/modules/topos_redis/topos_redis_storage.h
index cdeb56f..a3f62c2 100644
--- a/src/modules/topos_redis/topos_redis_storage.h
+++ b/src/modules/topos_redis/topos_redis_storage.h
@@ -38,7 +38,8 @@ int tps_redis_insert_branch(tps_data_t *td);
 int tps_redis_clean_branches(void);
 int tps_redis_load_branch(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd);
 int tps_redis_load_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd);
-int tps_redis_update_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd);
+int tps_redis_update_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd,
+               uint32_t mode);
 int tps_redis_end_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd);
 
 #endif


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to