[SR-Users] Using the db_redis module for integration with usrloc

Andreas Granig agranig at sipwise.com
Tue Feb 27 11:54:05 CET 2018


Hi Lucian,

Yes, it's probably worth noting in the README that for use_domain=0 the
usrdom key should be adjusted. So does it work for you now?

Eventually, I'll extend the module to ship with default key definitions
for the most common modules, however it'll take some time because it
needs an analysis of the query patterns each module performs.

Best,
Andreas

On 2018-02-23 11:05, Lucian Balaceanu wrote:
> Hello,
> 
> Just a quick note to say that I debugged the issue down to having the
> MULTIDOMAIN set to 0 and as such most probably the
> "&usrdom:username,domain" should have been in my case just
> "&usrdom:username".
> Also if parsing of a field in redis comes out as having errors, just
> tweak the type of value according to that field in the schema_path. I
> had problems with usrloc's  expires and last_modified which I changed
> from "int" to "string".
> 
> Thank you,
> Lucian
> 
> On 22.02.2018 12:00, Lucian Balaceanu wrote:
>> Hello Andreas,
>>
>>
>> Congratulations for adding db_redis, which I find a very interesting
>> and useful module.
>>
>> I know it is not yet in its final form, but I have tried to make a
>> REGISTER/INVITE save()/lookup() scenario by adding the db_redis
>> snippets from the README in the default Kamailio configuration (usrloc
>> db_mode=3).
>> The save() succeeds, but only a "location:entry::uloc-5a8d7eb2-6bd1-1"
>> hash and a "location:timer::0:0" set are created (I seem to miss the
>> location:usrdom). Besides this, the lookup("location") fails.
>> I guess I have made some wrong configurations? The REGISTER/INVITE
>> scenario works fine for you with only the upmentioned changes to the
>> config?
>>
>>
>> My *config* contains:
>>
>> loadmodule "db_redis.so"
>> #!define DBURL_USRLOC "redis://127.0.0.1:6379/5"
>> #!define DBURL_ACC    "redis://127.0.0.1:6379/6"
>> #!define DBURL_AUTH   "redis://127.0.0.1:6379/7"
>>
>> modparam("db_redis", "schema_path",
>> "/home/XXX/utils/kamctl/db_redis/kamailio")
>> modparam("db_redis", "keys",
>> "location=entry:ruid&usrdom:username,domain&timer:partition,keepalive")
>> modparam("db_redis", "keys", "acc=entry:callid,time_hires&cid:callid")
>> modparam("db_redis", "keys", "subscriber=entry:username,domain")
>>
>> modparam("usrloc", "db_mode", 3)
>> modparam("usrloc", "use_domain", MULTIDOMAIN)
>> modparam("usrloc", "db_url", DBURL_USRLOC)
>>
>> The lookup("location") leads to this *log*:
>>
>> /1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:1683]: db_redis_query(): querying prefix (table)
>> 'location'//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:508]: db_redis_build_query_keys(): build query keys//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:281]: db_redis_find_query_key(): checking for existence
>> of entry key 'ruid' in query//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:332]: db_redis_find_query_key(): key 'ruid' for type
>> 'entry' not found, unable to use this type//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:534]: db_redis_build_query_keys(): no direct entry key
>> found, checking type keys//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:537]: db_redis_build_query_keys(): checking type 'usrdom'//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:281]: db_redis_find_query_key(): checking for existence
>> of entry key 'username' in query//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:291]: db_redis_find_query_key(): found key in entry key//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:119]: db_redis_val2str(): converting str value '33'
>> with len 2 to str//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:323]: db_redis_find_query_key(): entry key so far is
>> 'location:usrdom::33'//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:281]: db_redis_find_query_key(): checking for existence
>> of entry key 'domain' in query//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:332]: db_redis_find_query_key(): key 'domain' for type
>> 'usrdom' not found, unable to use this type//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:537]: db_redis_build_query_keys(): checking type 'timer'//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:281]: db_redis_find_query_key(): checking for existence
>> of entry key 'partition' in query//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:332]: db_redis_find_query_key(): key 'partition' for
>> type 'timer' not found, unable to use this type//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:1726]: db_redis_query(): unable to build query keys,
>> falling back to full table scan//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:1741]: db_redis_query(): done performing query//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: usrloc
>> [udomain.c:645]: db_load_urecord(): aor 33 not found in table location//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: db_redis
>> [redis_dbase.c:2145]: db_redis_free_result(): perform redis free result//
>> //{1 1 INVITE 1-23806 at 127.0.1.1}  0(23787) DEBUG: registrar
>> [lookup.c:233]: lookup_helper(): '33' Not found in usrloc//
>> /
>>
>> Any input is appreciated.
>>
>> Many thanks,
>> Lucian Balaceanu
>>
>>
>>
> 



More information about the sr-users mailing list