Hello. I try to do my own dispatcher with redis db. I have problem with disconnecting module wrom redis. Redis server is remote microsoft public server. This good solution for many companies and it works stable THe FIrst Isuue I saw when used
modparam("ndb_redis", "server", "name=srv1;addr=non_local_serv;port=6379;db=4;pass=mypass")
[TOASTERISK] redis_cmd("srv1", "EXISTS $si", "s"); xlog("L_INFO","ASTERISK with ip $si is {$redis(s=>value)}"); $var(setid)=0; if ($redis(s=>value) == 0) { xlog("L_INFO","Request {$rm} from $si != {$var(dest)} It means call NOT from ASTRISK"); }
And when this call begins I get <null> s value. But If I EXISTS it from redis comsole there is successfull reply.
Sometimes I see this at kamailio log
redisc_exec(): Redis error: Server closed the connection
I tried MONITOR redis from cli, but nothing happends when disconnect. (nothing means -nothing at the cli)
So I tried one more thing: I have some pools of requests 1. When options recieved to kam from asterisk
if (is_method("OPTIONS")) { if ($sp == 50600) { redis_cmd("srv1", "AUTH mylonglongpass"","r") redis_cmd("srv1", "SET $si $TS", "r"); redis_cmd("srv1", "EXPIRE $si 20", "r"); } }
It works fine (Intresting that this works fine with the PASS through modparam key too)
Second pool when KAmailio choose ASTERISK to send INVITE from redis
#DISPATCHER_NEW #$setid - is another var that gets from sql db. $var(priority)=1; redis_cmd("srv1", "AUTH mylonglongpass", "p");
while ($redis(b=>value) == 0) { xlog("L_INFO","{$rm} priority now is $var(priority) and setid $var(setid)\n"); redis_cmd("srv1", "EXISTS $var(setid):$var(priority)", "e"); xlog("L_INFO","ASTERISK with customer $var(setid) and priority $var(priority) id {$redis(e=>value)} (if 1 - exists, 0 - not exisits)"); ## Regis correctly get reply always
if ($redis(e=>value) == 1) { redis_cmd("srv1", "GET $var(setid):$var(priority)", "a");
#get IP of asterisk. Always get right value too xlog("L_INFO","ASTERISK with customer $var(setid) and priority $var(priority) is {$redis(a=>value)} (if 0 - not exisits)"); redis_cmd("srv1", "GET $redis(a=>value)", "b"); #check timestamp that set at redis OPTION request
## There are I have truble when use AUTH command because redis return <null> after GET. If i do GET from cli - all ok.
xlog("L_INFO","ASTERISK with customer $var(setid) and priority $var(priority) have timestamp {$redis(b=>value)} (if null - no timestamp. This means it down. Get new asterisk)"); if ($redis(b=>value) == 1){ $du="sip:"+$redis(a=>value)+":50600"; } else{ $var(priority)=$var(priority)+1; } }
Offcource I checked all parameteres - database name and another connection attrs of modparam
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/108
I think this discussion will get better responses on mailing lists 'sr-users [at] lists.sip-router.org', because it is more about configuration rather than development. sr-users is the place where you can find more Redis users that can help from past experiences.
On the other hand, ndb_redis should reconnect, maybe the microsoft public server has some policies on traffic and number of connections. Have you tested for sake of double-checking with a local redis server?
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/108#issuecomment-78874046
Hello,
I have committed a patch fixing authentication when ndb_redis module reconnects to redis server.
I am not sure if this was your problem, but I suspect your problem was authentication related.
ndb_redis module only provides an interface to hiredis library. It has nothing to do with websockets, etc.
Hope it helps, Vicente.
On 03/13/2015 09:55 AM, Daniel-Constantin Mierla wrote:
I think this discussion will get better responses on mailing lists 'sr-users [at] lists.sip-router.org', because it is more about configuration rather than development. sr-users is the place where you can find more Redis users that can help from past experiences.
On the other hand, ndb_redis should reconnect, maybe the microsoft public server has some policies on traffic and number of connections. Have you tested for sake of double-checking with a local redis server?
— Reply to this email directly or view it on GitHub https://github.com/kamailio/kamailio/issues/108#issuecomment-78874046.
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Closing after Vicente's patch. If still an issue, re-open.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/108#issuecomment-86725598
Closed #108.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/108#event-266367016