Hello,

as I said, for authentication you just need to fetch the password from redis -- see:

  - https://www.kamailio.org/docs/modules/stable/modules/ndb_redis.html#ndb_redis.f.redis_cmd

Then pass it as parameter to pv_auth_check():

  - https://www.kamailio.org/docs/modules/stable/modules/auth.html#auth.f.pv_auth_check

The idea is very similar with the Ldap password storage, a mini how-to that you can adjust is available at:

  - https://www.kamailio.org/wiki/tutorials/mini-howto-admin/ldap-user-auth

Also accounting can be done with ndb_redis -- just store your needed details for call start with redis_cmd() when you get 200ok for INVITE (in an onreply_route block) and for call stop when you get BYE. For other events, just call the redis cmd when that event happens.

Cheers,
Daniel

On 13.06.17 23:29, Marko Tirs wrote:
Hello Daniel,
ok, no db_redis module yet.
How about accounting with Redis, is there any example how to use Redis for authentication and accounting?
Thank you
Regards
Marko




----- Forwarded Message -----
From: Daniel-Constantin Mierla <miconda@gmail.com>
To: Marko Tirs <marko.tirs@yahoo.com>; Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Sent: Thursday, June 1, 2017 5:04 PM
Subject: Re: [SR-Users] REDIS load problem - Kamailio 5.0.1 - db_redis not found

Hello,
at this moment there is no db_redis module in Kamailio, some people are working on it:
ndb_redis cannot be used as a db driver, in the way you try. If you need to fetch the password for authentication from redis, then use ndb_redis to get it and auth module to do authentication -- see pv_auth_check(...) functions.
Cheers,
Daniel

On 31.05.17 18:19, Marko Tirs wrote:
Hi all,

I'm trying to use the Redis database for authentication and later for accounting. I installed Redis on the server, I compiled Kamailio with ndb_redis and the module exists.

When I try to start Kamailio I get following errors:

 0(16737) ERROR: <core> [db.c:203]: db_bind_mod(): Module db_redis not found. Missing loadmodule?
 0(16737) ERROR: auth_db [auth_db_mod.c:175]: mod_init(): unable to bind to a database driver
 0(16737) ERROR: <core> [core/sr_module.c:968]: init_mod(): Error while initializing module auth_db (/usr/local/lib64/kamailio/modules/auth_db.so)
ERROR: error while initializing modules

Bellow are the relevant parts from config files.

Is there any example of kamailio.cfg with Redis configuration and commands for authentication and accounting?

Please help me to use Kamailio with Redis.

Thank you
Regards
Marko



kamctlrc
---------
DBENGINE=DBTEXT


kamailio.cfg
-------------
#!define WITH_REDIS
#!define WITH_AUTH

#!ifdef WITH_REDIS
#!define DBURL "redis://localhost:6379/"
#!endif

#!ifdef WITH_AUTH
loadmodule "auth.so"
loadmodule "auth_db.so"
#!endif

#!ifdef WITH_REDIS
loadmodule "ndb_redis.so"
#!endif

# ----- ndb_redis params -----
modparam("ndb_redis", "server", "name=srv1;addr=127.0.0.1;port=6379;db=1")

# ----- auth_db params -----
#!ifdef WITH_AUTH
modparam("auth_db", "db_url", DBURL)
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "load_credentials", "")
modparam("auth_db", "use_domain", MULTIDOMAIN)
#!endif


Virenfrei. www.avast.com


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - www.kamailioworld.com




_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - www.asipto.com
Kamailio World Conference - www.kamailioworld.com