Browse code

usrloc: update call-id value in db when matching record by ruid

Daniel-Constantin Mierla authored on 24/04/2013 15:26:15
Showing 1 changed files
... ...
@@ -838,6 +838,11 @@ int db_update_ucontact_ruid(ucontact_t* _c)
838 838
 		return 0;
839 839
 	}
840 840
 
841
+	if(_c->ruid.len<=0) {
842
+		LM_ERR("updating record in database failed - empty ruid\n");
843
+		return -1;
844
+	}
845
+
841 846
 	n1 = 0;
842 847
 	keys1[n1] = &ruid_col;
843 848
 	vals1[n1].type = DB1_STR;
... ...
@@ -928,15 +933,10 @@ int db_update_ucontact_ruid(ucontact_t* _c)
928 933
 	vals2[n2].val.time_val = _c->last_modified;
929 934
 	n2++;
930 935
 
931
-	keys2[n2] = &ruid_col;
932
-	if(_c->ruid.len>0)
933
-	{
934
-		vals2[n2].type = DB1_STR;
935
-		vals2[n2].nul = 0;
936
-		vals2[n2].val.str_val = _c->ruid;
937
-	} else {
938
-		vals2[n2].nul = 1;
939
-	}
936
+	keys2[n2] = &callid_col;
937
+	vals2[n2].type = DB1_STR;
938
+	vals2[n2].nul = 0;
939
+	vals2[n2].val.str_val = _c->callid;
940 940
 	n2++;
941 941
 
942 942
 	keys2[n2] = &instance_col;
... ...
@@ -1101,8 +1101,7 @@ int db_delete_ucontact_ruid(ucontact_t* _c)
1101 1101
 		return 0;
1102 1102
 	}
1103 1103
 
1104
-	if(_c->ruid.len<=0)
1105
-	{
1104
+	if(_c->ruid.len<=0) {
1106 1105
 		LM_ERR("deleting from database failed - empty ruid\n");
1107 1106
 		return -1;
1108 1107
 	}