<h3>Description</h3>
<p>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.</p>
<pre><code>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
</code></pre>
<h3>Troubleshooting</h3>
<h4>Reproduction</h4>
<p>Use db_redis as backend and use the location module.</p>
<p>While handling INVITE:</p>
<p>if (!lookup("location")) {<br>
sl_send_reply("404", "User Not Found");<br>
return;<br>
}</p>
<p>While handling REGISTER:</p>
<p>if (!save("location"))<br>
sl_reply_error();</p>
<h4>Debugging Data</h4>
<h4>Log Messages</h4>
<pre><code>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
</code></pre>
<h4>SIP Traffic</h4>

<pre><code>(paste your sip traffic here)
</code></pre>
<h3>Possible Solutions</h3>
<p>I patched the default schema with the following and it worked.</p>
<pre><code>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
</code></pre>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>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
</code></pre>
<ul>
<li><strong>Operating System</strong>:</li>
</ul>

<pre><code>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
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1917">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZYWxzwz1fGqmp9BgJtpqYWteA1JGks5vcbfZgaJpZM4cVDSy">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZdQxbs9ocVyYUdHKFovtQUoz96Ufks5vcbfZgaJpZM4cVDSy.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"db_redis location schema (#1917)"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1917"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1917",
"url": "https://github.com/kamailio/kamailio/issues/1917",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>