Hello Community,
I'm trying to read data (hash) stored in redis database, from kamailio script.
I read the module documentation ndb_redis: http://www.kamailio.org/docs/modules/4.4.x/modules/ndb_redis.html#idp2630078... But I'but I don't understand what I'm doing wrong :/
With someone has had experience this?
*My platform:*
*root@kamailio-fts:~# cat /etc/issue* *Ubuntu 14.04.4 LTS \n \l*
*root@kamailio-fts:~# kamailio -V* *version: kamailio 4.4.1 (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_LISTEN 16, 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 4.8.2*
*My script:*
*modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379;db=1")* *modparam("ndb_redis", "init_without_redis", 1)*
*if(redis_cmd("srvN", "HMGET usuario:2002 status", "res")) {* *xlog("L_INFO","array size: $redis(res=>size) - type: $redis(res=>type) - value: $redis(res=>value[0]) $redis(res=>value[1]) \n"); * * }*
*The output of syslog (I don't see errors): *
*Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_row.c:95]: db_free_row(): freeing row values at 0x7fc2fd008a30* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_res.c:60]: db_free_rows(): freeing rows at 0x7fc2fd007020* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_res.c:134]: db_free_result(): freeing result set at 0x7fc2fd008a98* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: db_postgres [km_dbase.c:433]: db_postgres_free_query(): PQclear(0xcc9060) result set* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [socket_info.c:564]: grep_sock_info(): checking if host==us: 13==13 && [172.16.20.219] == [172.16.20.219]* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [socket_info.c:567]: grep_sock_info(): checking if port 5060 (advertise 0) matches port 5060* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [select.c:412]: run_select(): Calling SELECT 0x7fc2fcfc09a0* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: registrar [lookup.c:240]: lookup_helper(): contact for [2004] found by address* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: INFO: <script>: es un mensaje y estoy por enviarlo* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: INFO: <script>: array size: 2 - type: 2 - value: <null>* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:1312]: t_newtran(): DEBUG: t_newtran: msg id=4 , global msg id=4 , T on entrance=(nil)* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:466]: t_lookup_request(): t_lookup_request: start searching: hash=36630, isACK=0* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:424]: matching_3261(): DEBUG: RFC3261 transaction matching failed* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:648]: t_lookup_request(): DEBUG: t_lookup_request: no transaction found* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_hooks.c:358]: run_reqin_callbacks_internal(): DBG: trans=0x7fc2ed762d08, callback type 1, id 0 entered* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [md5utils.c:67]: MD5StringArray(): MD5 calculated: d79552e0dafc752469a90c3599ba2d42* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_funcs.c:368]: t_relay_to(): SER: new transaction fwd'ed*
It can be seen that $redis(res=>size) & $redis(res=>type) return values, not so with $redis(res=>value[0]).
*By last, I share de output of redis CLI:*
*127.0.0.1:6379 http://127.0.0.1:6379> hget usuario:2002 status * *"Online" *
Cheers, Fabián -
Hi, I dont have my config at cell will share mine later. Meanwhile can you try HGET only to pull that 1 value plus use $redis(res=>value) with that. Regards, Sammy On Jun 28, 2016 02:25, "Fabian Pignataro" fabian.pignataro84@gmail.com wrote:
Hello Community,
I'm trying to read data (hash) stored in redis database, from kamailio script.
I read the module documentation ndb_redis:
http://www.kamailio.org/docs/modules/4.4.x/modules/ndb_redis.html#idp2630078... But I'but I don't understand what I'm doing wrong :/
With someone has had experience this?
*My platform:*
*root@kamailio-fts:~# cat /etc/issue* *Ubuntu 14.04.4 LTS \n \l*
*root@kamailio-fts:~# kamailio -V* *version: kamailio 4.4.1 (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_LISTEN 16, 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 4.8.2*
*My script:*
*modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379;db=1")* *modparam("ndb_redis", "init_without_redis", 1)*
*if(redis_cmd("srvN", "HMGET usuario:2002 status", "res")) {* *xlog("L_INFO","array size: $redis(res=>size) - type: $redis(res=>type) - value: $redis(res=>value[0]) $redis(res=>value[1]) \n"); *
- }*
*The output of syslog (I don't see errors): *
*Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_row.c:95]: db_free_row(): freeing row values at 0x7fc2fd008a30* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_res.c:60]: db_free_rows(): freeing rows at 0x7fc2fd007020* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_res.c:134]: db_free_result(): freeing result set at 0x7fc2fd008a98* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: db_postgres [km_dbase.c:433]: db_postgres_free_query(): PQclear(0xcc9060) result set* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [socket_info.c:564]: grep_sock_info(): checking if host==us: 13==13 && [172.16.20.219] == [172.16.20.219]* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [socket_info.c:567]: grep_sock_info(): checking if port 5060 (advertise 0) matches port 5060* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [select.c:412]: run_select(): Calling SELECT 0x7fc2fcfc09a0* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: registrar [lookup.c:240]: lookup_helper(): contact for [2004] found by address* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: INFO: <script>: es un mensaje y estoy por enviarlo* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: INFO: <script>: array size: 2 - type: 2 - value: <null>* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:1312]: t_newtran(): DEBUG: t_newtran: msg id=4 , global msg id=4 , T on entrance=(nil)* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:466]: t_lookup_request(): t_lookup_request: start searching: hash=36630, isACK=0* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:424]: matching_3261(): DEBUG: RFC3261 transaction matching failed* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:648]: t_lookup_request(): DEBUG: t_lookup_request: no transaction found* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_hooks.c:358]: run_reqin_callbacks_internal(): DBG: trans=0x7fc2ed762d08, callback type 1, id 0 entered* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [md5utils.c:67]: MD5StringArray(): MD5 calculated: d79552e0dafc752469a90c3599ba2d42* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_funcs.c:368]: t_relay_to(): SER: new transaction fwd'ed*
It can be seen that $redis(res=>size) & $redis(res=>type) return values, not so with $redis(res=>value[0]).
*By last, I share de output of redis CLI:*
*127.0.0.1:6379 http://127.0.0.1:6379> hget usuario:2002 status * *"Online" *
Cheers, Fabián -
-- Ing. Fabián Pignataro
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Thanks Sammy !
I tried that, but it's doesn't work. Here below, both options:
*redis-cli* 127.0.0.1:6379> HGET usuario:2001 status "online"
*kamailio.cfg* if(redis_cmd("srvN", "HGET usuario:2001 status", "res")) { xlog("L_INFO","array size: $redis(res=>size) - type: $redis(res=>type) - value: $redis(res=>value)\n"); } *output /var/log/syslog* Jun 28 10:20:50 kamailio-fts /usr/sbin/kamailio[4665]: INFO: <script>: array size: <null> - type: 4 - value: <null> ------------------------------------------------------------------------------------------------------------------------------------------------------ *redis-cli* 127.0.0.1:6379> HGET usuario:2001 status "online"
*kamailio.cfg* if(redis_cmd("srvN", "HMGET usuario:2001 status", "res")) { xlog("L_INFO","array size: $redis(res=>size) - type: $redis(res=>type) - value: $redis(res=>value[0])\n"); } *output /var/log/syslog* Jun 28 10:25:47 kamailio-fts /usr/sbin/kamailio[4859]: INFO: <script>: array size: 1 - type: 2 - value: <null>
if you can share your code, it would be great :)
Thanks ! Fabián -
El mar., 28 de jun. de 2016 a la(s) 08:53, SamyGo govoiper@gmail.com escribió:
Hi, I dont have my config at cell will share mine later. Meanwhile can you try HGET only to pull that 1 value plus use $redis(res=>value) with that. Regards, Sammy On Jun 28, 2016 02:25, "Fabian Pignataro" fabian.pignataro84@gmail.com wrote:
Hello Community,
I'm trying to read data (hash) stored in redis database, from kamailio script.
I read the module documentation ndb_redis:
http://www.kamailio.org/docs/modules/4.4.x/modules/ndb_redis.html#idp2630078... But I'but I don't understand what I'm doing wrong :/
With someone has had experience this?
*My platform:*
*root@kamailio-fts:~# cat /etc/issue* *Ubuntu 14.04.4 LTS \n \l*
*root@kamailio-fts:~# kamailio -V* *version: kamailio 4.4.1 (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_LISTEN 16, 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 4.8.2*
*My script:*
*modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379;db=1")* *modparam("ndb_redis", "init_without_redis", 1)*
*if(redis_cmd("srvN", "HMGET usuario:2002 status", "res")) {* *xlog("L_INFO","array size: $redis(res=>size) - type: $redis(res=>type) - value: $redis(res=>value[0]) $redis(res=>value[1]) \n"); *
- }*
*The output of syslog (I don't see errors): *
*Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_row.c:95]: db_free_row(): freeing row values at 0x7fc2fd008a30* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_res.c:60]: db_free_rows(): freeing rows at 0x7fc2fd007020* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_res.c:134]: db_free_result(): freeing result set at 0x7fc2fd008a98* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: db_postgres [km_dbase.c:433]: db_postgres_free_query(): PQclear(0xcc9060) result set* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [socket_info.c:564]: grep_sock_info(): checking if host==us: 13==13 && [172.16.20.219] == [172.16.20.219]* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [socket_info.c:567]: grep_sock_info(): checking if port 5060 (advertise 0) matches port 5060* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [select.c:412]: run_select(): Calling SELECT 0x7fc2fcfc09a0* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: registrar [lookup.c:240]: lookup_helper(): contact for [2004] found by address* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: INFO: <script>: es un mensaje y estoy por enviarlo* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: INFO: <script>: array size: 2 - type: 2 - value: <null>* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:1312]: t_newtran(): DEBUG: t_newtran: msg id=4 , global msg id=4 , T on entrance=(nil)* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:466]: t_lookup_request(): t_lookup_request: start searching: hash=36630, isACK=0* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:424]: matching_3261(): DEBUG: RFC3261 transaction matching failed* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:648]: t_lookup_request(): DEBUG: t_lookup_request: no transaction found* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_hooks.c:358]: run_reqin_callbacks_internal(): DBG: trans=0x7fc2ed762d08, callback type 1, id 0 entered* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [md5utils.c:67]: MD5StringArray(): MD5 calculated: d79552e0dafc752469a90c3599ba2d42* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_funcs.c:368]: t_relay_to(): SER: new transaction fwd'ed*
It can be seen that $redis(res=>size) & $redis(res=>type) return values, not so with $redis(res=>value[0]).
*By last, I share de output of redis CLI:*
*127.0.0.1:6379 http://127.0.0.1:6379> hget usuario:2002 status * *"Online" *
Cheers, Fabián -
-- Ing. Fabián Pignataro
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Can you do the same with either reids on DB=1 or remove db=1 string from the ndb_redis url.
redis-cli 127.0.0.1:6379> select 1 127.0.0.1:6379[1]> GHET usuario:2001 status
OR
*modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379")*
If that doesn't help I'll be happy to share the relevant configs which I assure you are the same.
Thanks, Sammy
On Tue, Jun 28, 2016 at 9:33 AM, Fabian Pignataro < fabian.pignataro84@gmail.com> wrote:
Thanks Sammy !
I tried that, but it's doesn't work. Here below, both options:
*redis-cli* 127.0.0.1:6379> HGET usuario:2001 status "online"
*kamailio.cfg* if(redis_cmd("srvN", "HGET usuario:2001 status", "res")) { xlog("L_INFO","array size: $redis(res=>size) - type: $redis(res=>type) - value: $redis(res=>value)\n"); } *output /var/log/syslog* Jun 28 10:20:50 kamailio-fts /usr/sbin/kamailio[4665]: INFO: <script>: array size: <null> - type: 4 - value: <null>
*redis-cli* 127.0.0.1:6379> HGET usuario:2001 status "online"
*kamailio.cfg* if(redis_cmd("srvN", "HMGET usuario:2001 status", "res")) { xlog("L_INFO","array size: $redis(res=>size) - type: $redis(res=>type) - value: $redis(res=>value[0])\n"); } *output /var/log/syslog* Jun 28 10:25:47 kamailio-fts /usr/sbin/kamailio[4859]: INFO: <script>: array size: 1 - type: 2 - value: <null>
if you can share your code, it would be great :)
Thanks ! Fabián -
El mar., 28 de jun. de 2016 a la(s) 08:53, SamyGo govoiper@gmail.com escribió:
Hi, I dont have my config at cell will share mine later. Meanwhile can you try HGET only to pull that 1 value plus use $redis(res=>value) with that. Regards, Sammy On Jun 28, 2016 02:25, "Fabian Pignataro" fabian.pignataro84@gmail.com wrote:
Hello Community,
I'm trying to read data (hash) stored in redis database, from kamailio script.
I read the module documentation ndb_redis:
http://www.kamailio.org/docs/modules/4.4.x/modules/ndb_redis.html#idp2630078... But I'but I don't understand what I'm doing wrong :/
With someone has had experience this?
*My platform:*
*root@kamailio-fts:~# cat /etc/issue* *Ubuntu 14.04.4 LTS \n \l*
*root@kamailio-fts:~# kamailio -V* *version: kamailio 4.4.1 (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_LISTEN 16, 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 4.8.2*
*My script:*
*modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379;db=1")* *modparam("ndb_redis", "init_without_redis", 1)*
*if(redis_cmd("srvN", "HMGET usuario:2002 status", "res")) {* *xlog("L_INFO","array size: $redis(res=>size) - type: $redis(res=>type)
- value: $redis(res=>value[0]) $redis(res=>value[1]) \n"); *
- }*
*The output of syslog (I don't see errors): *
*Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_row.c:95]: db_free_row(): freeing row values at 0x7fc2fd008a30* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_res.c:60]: db_free_rows(): freeing rows at 0x7fc2fd007020* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_res.c:134]: db_free_result(): freeing result set at 0x7fc2fd008a98* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: db_postgres [km_dbase.c:433]: db_postgres_free_query(): PQclear(0xcc9060) result set* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [socket_info.c:564]: grep_sock_info(): checking if host==us: 13==13 && [172.16.20.219] == [172.16.20.219]* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [socket_info.c:567]: grep_sock_info(): checking if port 5060 (advertise 0) matches port 5060* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [select.c:412]: run_select(): Calling SELECT 0x7fc2fcfc09a0* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: registrar [lookup.c:240]: lookup_helper(): contact for [2004] found by address* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: INFO: <script>: es un mensaje y estoy por enviarlo* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: INFO: <script>: array size: 2 - type: 2 - value: <null>* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:1312]: t_newtran(): DEBUG: t_newtran: msg id=4 , global msg id=4 , T on entrance=(nil)* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:466]: t_lookup_request(): t_lookup_request: start searching: hash=36630, isACK=0* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:424]: matching_3261(): DEBUG: RFC3261 transaction matching failed* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:648]: t_lookup_request(): DEBUG: t_lookup_request: no transaction found* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_hooks.c:358]: run_reqin_callbacks_internal(): DBG: trans=0x7fc2ed762d08, callback type 1, id 0 entered* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [md5utils.c:67]: MD5StringArray(): MD5 calculated: d79552e0dafc752469a90c3599ba2d42* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_funcs.c:368]: t_relay_to(): SER: new transaction fwd'ed*
It can be seen that $redis(res=>size) & $redis(res=>type) return values, not so with $redis(res=>value[0]).
*By last, I share de output of redis CLI:*
*127.0.0.1:6379 http://127.0.0.1:6379> hget usuario:2002 status * *"Online" *
Cheers, Fabián -
-- Ing. Fabián Pignataro
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Ing. Fabián Pignataro
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
I changed this: *modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379;db=1")* by it: *modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379")*
And began to work.
Thanks my friend ! Fabián -
El mié., 29 de jun. de 2016 a la(s) 14:01, SamyGo govoiper@gmail.com escribió:
Can you do the same with either reids on DB=1 or remove db=1 string from the ndb_redis url.
redis-cli 127.0.0.1:6379> select 1 127.0.0.1:6379[1]> GHET usuario:2001 status
OR
*modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379")*
If that doesn't help I'll be happy to share the relevant configs which I assure you are the same.
Thanks, Sammy
On Tue, Jun 28, 2016 at 9:33 AM, Fabian Pignataro < fabian.pignataro84@gmail.com> wrote:
Thanks Sammy !
I tried that, but it's doesn't work. Here below, both options:
*redis-cli* 127.0.0.1:6379> HGET usuario:2001 status "online"
*kamailio.cfg* if(redis_cmd("srvN", "HGET usuario:2001 status", "res")) { xlog("L_INFO","array size: $redis(res=>size) - type: $redis(res=>type) - value: $redis(res=>value)\n"); } *output /var/log/syslog* Jun 28 10:20:50 kamailio-fts /usr/sbin/kamailio[4665]: INFO: <script>: array size: <null> - type: 4 - value: <null>
*redis-cli* 127.0.0.1:6379> HGET usuario:2001 status "online"
*kamailio.cfg* if(redis_cmd("srvN", "HMGET usuario:2001 status", "res")) { xlog("L_INFO","array size: $redis(res=>size) - type: $redis(res=>type) - value: $redis(res=>value[0])\n"); } *output /var/log/syslog* Jun 28 10:25:47 kamailio-fts /usr/sbin/kamailio[4859]: INFO: <script>: array size: 1 - type: 2 - value: <null>
if you can share your code, it would be great :)
Thanks ! Fabián -
El mar., 28 de jun. de 2016 a la(s) 08:53, SamyGo govoiper@gmail.com escribió:
Hi, I dont have my config at cell will share mine later. Meanwhile can you try HGET only to pull that 1 value plus use $redis(res=>value) with that. Regards, Sammy On Jun 28, 2016 02:25, "Fabian Pignataro" fabian.pignataro84@gmail.com wrote:
Hello Community,
I'm trying to read data (hash) stored in redis database, from kamailio script.
I read the module documentation ndb_redis:
http://www.kamailio.org/docs/modules/4.4.x/modules/ndb_redis.html#idp2630078... But I'but I don't understand what I'm doing wrong :/
With someone has had experience this?
*My platform:*
*root@kamailio-fts:~# cat /etc/issue* *Ubuntu 14.04.4 LTS \n \l*
*root@kamailio-fts:~# kamailio -V* *version: kamailio 4.4.1 (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_LISTEN 16, 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 4.8.2*
*My script:*
*modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379;db=1")* *modparam("ndb_redis", "init_without_redis", 1)*
*if(redis_cmd("srvN", "HMGET usuario:2002 status", "res")) {* *xlog("L_INFO","array size: $redis(res=>size) - type: $redis(res=>type)
- value: $redis(res=>value[0]) $redis(res=>value[1]) \n"); *
- }*
*The output of syslog (I don't see errors): *
*Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_row.c:95]: db_free_row(): freeing row values at 0x7fc2fd008a30* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_res.c:60]: db_free_rows(): freeing rows at 0x7fc2fd007020* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [db_res.c:134]: db_free_result(): freeing result set at 0x7fc2fd008a98* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: db_postgres [km_dbase.c:433]: db_postgres_free_query(): PQclear(0xcc9060) result set* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [socket_info.c:564]: grep_sock_info(): checking if host==us: 13==13 && [172.16.20.219] == [172.16.20.219]* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [socket_info.c:567]: grep_sock_info(): checking if port 5060 (advertise 0) matches port 5060* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [select.c:412]: run_select(): Calling SELECT 0x7fc2fcfc09a0* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: registrar [lookup.c:240]: lookup_helper(): contact for [2004] found by address* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: INFO:
<script>: es un mensaje y estoy por enviarlo* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: INFO: <script>: array size: 2 - type: 2 - value: <null>* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:1312]: t_newtran(): DEBUG: t_newtran: msg id=4 , global msg id=4 , T on entrance=(nil)* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:466]: t_lookup_request(): t_lookup_request: start searching: hash=36630, isACK=0* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:424]: matching_3261(): DEBUG: RFC3261 transaction matching failed* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_lookup.c:648]: t_lookup_request(): DEBUG: t_lookup_request: no transaction found* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_hooks.c:358]: run_reqin_callbacks_internal(): DBG: trans=0x7fc2ed762d08, callback type 1, id 0 entered* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: <core> [md5utils.c:67]: MD5StringArray(): MD5 calculated: d79552e0dafc752469a90c3599ba2d42* *Jun 27 11:48:12 kamailio-fts /usr/sbin/kamailio[31615]: DEBUG: tm [t_funcs.c:368]: t_relay_to(): SER: new transaction fwd'ed* It can be seen that $redis(res=>size) & $redis(res=>type) return values, not so with $redis(res=>value[0]). *By last, I share de output of redis CLI:* *127.0.0.1:6379 <http://127.0.0.1:6379>> hget usuario:2002 status * *"Online" * Cheers, Fabián - -- Ing. Fabián Pignataro _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Ing. Fabián Pignataro
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users