[sr-dev] [kamailio] Error in writing to sqlite DB (pua) when db_mode = 0 (#345)

Vasiliy Ganchev notifications at github.com
Fri Dec 18 15:42:19 CET 2015


Hi Daniel!

have the same errors in logs (as in first post) in kamailio-4.2.5
Tried your patch suggested here, have [the same result as sternik](https://github.com/kamailio/kamailio/issues/345#issuecomment-153397799)

Added the check for "from_tag", now my test code looks like:

```
--- pua.c	(revision 30772)
+++ pua.c	(working copy)
@@ -1112,8 +1112,24 @@
 						q_vals[puri_col].val.str_val = *(p->pres_uri);
 						q_vals[pid_col].val.str_val = p->id;
 						q_vals[flag_col].val.int_val = p->flag;
-						q_vals[callid_col].val.str_val = p->call_id;
-						q_vals[fromtag_col].val.str_val = p->from_tag;
+
+						if(p->call_id.s) {
+							LM_DBG("p->callid = %.*s\n", p->call_id.len, p->call_id.s);
+							q_vals[callid_col].val.str_val = p->call_id;
+						} else {
+							LM_DBG("p->callid is empty\n");
+							q_vals[callid_col].val.str_val.s = "";
+							q_vals[callid_col].val.str_val.len = 0;
+						}
+							if(p->from_tag.s) {
+							LM_DBG("p->from_tag = %.*s\n", p->from_tag.len, p->from_tag.s);
+							q_vals[fromtag_col].val.str_val = p->from_tag;
+						} else {
+							LM_DBG("p->from_tag is empty\n");
+							q_vals[fromtag_col].val.str_val.s = "";
+							q_vals[fromtag_col].val.str_val.len = 0;
+						}
+
```

testing this I get read of initial errors, now the log looks like:

```
Dec 18 15:35:58 /usr/sbin/kamailio[15101]: DEBUG: pua [pua.c:1111]: db_update(): INSERTDB_FLAG
Dec 18 15:35:58 /usr/sbin/kamailio[15101]: DEBUG: pua [pua.c:1119]: db_update(): p->callid is empty
Dec 18 15:35:58 /usr/sbin/kamailio[15101]: DEBUG: pua [pua.c:1131]: db_update(): p->from_tag is empty
Dec 18 15:35:58 /usr/sbin/kamailio[15101]: DEBUG: db_sqlite [dbase.c:183]: db_sqlite_submit_query(): submit_query: insert into pua (pres_uri,pres_id,flag,event,watcher_uri,call_id,to_tag,from_tag,etag,tuple_id,cseq,expires,desired_expires,record_route,contact,remote_contact,version,extra_headers ) values (?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11,?12,?13,?14,?15,?16,?17,?18)
Dec 18 15:35:58 /usr/sbin/kamailio[15101]: DEBUG: pua [pua.c:1111]: db_update(): INSERTDB_FLAG
Dec 18 15:35:58 /usr/sbin/kamailio[15101]: DEBUG: pua [pua.c:1119]: db_update(): p->callid is empty
Dec 18 15:35:58 /usr/sbin/kamailio[15101]: DEBUG: pua [pua.c:1131]: db_update(): p->from_tag is empty
Dec 18 15:35:58 /usr/sbin/kamailio[15101]: DEBUG: db_sqlite [dbase.c:183]: db_sqlite_submit_query(): submit_query: insert into pua (pres_uri,pres_id,flag,event,watcher_uri,call_id,to_tag,from_tag,etag,tuple_id,cseq,expires,desired_expires,record_route,contact,remote_contact,version,extra_headers ) values (?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11,?12,?13,?14,?15,?16,?17,?18)
```

Now, as I understood, the suggested patch, is not for release usage?
Do you have explanation, why the callid and from_tag could be empty?
Do you need any additional info or testing?

Cheers!

---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/345#issuecomment-165793474
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20151218/d156a0cc/attachment.html>


More information about the sr-dev mailing list