[SR-Users] Kamailio and Mongodb

Daniel-Constantin Mierla miconda at gmail.com
Mon Jul 4 13:21:40 CEST 2016


Hello,


On 01/07/16 16:39, C. wrote:
> Hi,
> I have followed instructions on setting up Kamailio with MongoDB
> backend, and successfully compiled and installed kamailio with the
> db_mongo module. It can start successfully. However, when I tried to
> add users using the command:
>
> kamctl add test testpasswd test at mysipserver.com
> <mailto:test at mysipserver.com>
>
> It fails because it is trying to default to MYSQL. Here is the result
> of that command:
>
> WARNING: database engine not found - tried 'MYSQL'
> ERROR: This command requires a database engine - none was loaded
>
> When I take a look at the kamctl script, it lists all the other kinds
> of database engines, except MongoDb, so this is probably why it is
> failing. How can I use kamctl to create the required Mongodb
> collections (like users, subscribers, etc) that Kamaiio will then
> use?My kamailio.cfg seem to be working ok, as I seem to be able to
> connect to the database (I modified the file to use db_mongo module),
> and I create the initial collections as listed here -
> https://www.kamailio.org/wiki/tutorials/kamailio-and-mongodb
>
indeed, kamctl doesn't support mongodb and it cannot be used to add
subscribers. Practically, behind adding a subscriber (when Mysql is
used) is an SQL INSERT query.

What you have to do is using mongodb insert command, like:

db.getCollection("subscriber").insert( { username: "alice", domain:
"a.com", password: "secret" } )

For whatever table you need in the mongodb, look inside:

  - utils/kamctl/mongodb/kamailio/

There are some json files that provide some attributes about the
columns, their types and default values.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://www.asipto.com - http://www.kamailio.org
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160704/5a392dab/attachment.html>


More information about the sr-users mailing list