### Description

Configured the location module to load the expires column as a datetime instead 
of an integer but db_redis ignored the parameter and loaded the data with the 
default schema. As of today, the default schema has last_modified and expires 
columns as integers but stores them as timestamps.

```
id/int,ruid/string,username/string,domain/string,contact/string,received/string,path/string,expires/**int**,q/double,callid/string,cseq/int,last_modified/**int**,flags/int,cflags/int,user_agent/string,socket/string,methods/int,instance/string,reg_id/int,server_id/int,connection_id/int,keepalive/int,partition/int,
9
```

### Troubleshooting

#### Reproduction

Use db_redis as backend and use the location module.

While handling INVITE:

if (!lookup("location")) {
        sl_send_reply("404", "User Not Found");
        return;
}

While handling REGISTER:

if (!save("location"))
      sl_reply_error();

#### Debugging Data

#### Log Messages

```
8(34) ERROR: <core> [db_ut.c:92]: db_str2int(): Unexpected characters: [-04-01 
07:17:14]
 8(34) ERROR: <core> [db_val.c:76]: db_str2val(): error while converting 
integer value from string
 8(34) ERROR: db_redis [redis_dbase.c:1062]: db_redis_convert_row(): Failed to 
convert redis column 'expires' to db value
 8(34) ERROR: db_redis [redis_dbase.c:1231]: db_redis_perform_query(): Failed 
to convert redis reply for row
 8(34) ERROR: db_redis [redis_dbase.c:1243]: db_redis_perform_query(): failed 
to perform the query
 8(34) ERROR: db_redis [redis_dbase.c:1829]: db_redis_query(): failed to do the 
query
 8(34) ERROR: usrloc [udomain.c:641]: db_load_urecord(): db_query failed
```

#### SIP Traffic

<!--
If the issue is exposed by processing specific SIP messages, grab them with 
ngrep or save in a pcap file, then add them next, or attach to issue, or 
provide a link to download them (e.g., to a pastebin site).
-->

```
(paste your sip traffic here)
```

### Possible Solutions

I patched the default schema with the following and it worked.

```
id/int,ruid/string,username/string,domain/string,contact/string,received/string,path/string,expires/**timestamp**,q/double,callid/string,cseq/int,last_modified/**timestamp**,flags/int,cflags/int,user_agent/string,socket/string,methods/int,instance/string,reg_id/int,server_id/int,connection_id/int,keepalive/int,partition/int,
9
```

### Additional Information

  * **Kamailio Version** - output of `kamailio -v`

```
version: kamailio 5.2.2 (x86_64/linux) 
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, 
DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, 
F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, 
USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, 
BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown 
compiled with gcc 6.3.0
```

* **Operating System**:

<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 
16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `uname -a`)
-->

```
Linux gke-production-cluster-default-pool-fb621121-qz3r 4.14.65+ #1 SMP Thu Oct 
25 10:42:50 PDT 2018 x86_64 GNU/Linux
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1917
_______________________________________________
Kamailio (SER) - Development Mailing List
[email protected]
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to