Browse Source

topos_redis: updated topos dialog update api

Daniel-Constantin Mierla 8 years ago
parent
commit
22c07bbd96

+ 13 - 3
src/modules/topos_redis/topos_redis_storage.c

@@ -809,7 +809,8 @@ error:
 /**
 /**
  *
  *
  */
  */
-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];
 	char* argv[TPS_REDIS_NR_KEYS];
 	size_t argvlen[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;
 	argvlen[argc] = rkey.len;
 	argc++;
 	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
 		if(sd->b_tag.len<=0
 				&& msg->first_line.u.reply.statuscode>=200
 				&& msg->first_line.u.reply.statuscode>=200
 				&& msg->first_line.u.reply.statuscode<300) {
 				&& 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);
 	rrpl = _tps_redis_api.exec_argv(rsrv, argc, (const char **)argv, argvlen);
 	if(rrpl==NULL) {
 	if(rrpl==NULL) {
 		LM_ERR("failed to execute redis command\n");
 		LM_ERR("failed to execute redis command\n");

+ 2 - 1
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_clean_branches(void);
 int tps_redis_load_branch(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd);
 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_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);
 int tps_redis_end_dialog(sip_msg_t *msg, tps_data_t *md, tps_data_t *sd);
 
 
 #endif
 #endif