User Tools

Site Tools


tutorials:kamailio-and-mongodb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials:kamailio-and-mongodb [2015/09/08 21:32]
miconda
tutorials:kamailio-and-mongodb [2019/01/07 09:24] (current)
henningw small addtion
Line 1: Line 1:
 ====== Kamailio and MongoDB ====== ====== Kamailio and MongoDB ======
  
 +Details about how to use Kamailio with a MongoDB backend.
 ===== Kamailio Database ===== ===== Kamailio Database =====
  
Line 51: Line 52:
 > db.getCollection("​version"​).insert({table_name:​ "​watchers",​ table_version:​ NumberInt(3) }) > db.getCollection("​version"​).insert({table_name:​ "​watchers",​ table_version:​ NumberInt(3) })
  
-db.getCollection("​version"​).insert({table_name:​ "​active_watchers",​ table_version:​ NumberInt(11) })+db.getCollection("​version"​).insert({table_name:​ "​active_watchers",​ table_version:​ NumberInt(11) })
  
 </​code>​ </​code>​
Line 59: Line 60:
 ==== Other Tables ==== ==== Other Tables ====
  
-MongoDB doesn'​t have a schema definition for documents stored in a collection.+MongoDB doesn'​t have a schema definition for documents stored in a collection. It is not required to create a collection before inserting a record to it.
  
-===== DB URL in Kamailio Config =====+Anyhow, if you want, you can create the collections in advance, using: 
 + 
 +<​code>​ 
 +> db.createCollection("​tablename"​) 
 +</​code>​ 
 +===== Kamailio Config ===== 
 + 
 +==== DB URL ==== 
 + 
 +You need to load the "​db_mongodb"​ module in the configuration.
  
 The corresponding database URL in kamailio.cfg:​ The corresponding database URL in kamailio.cfg:​
Line 75: Line 85:
 <​code>​ <​code>​
 #!define DBURL "​mongodb://​username:​password@localhost/​kamailio"​ #!define DBURL "​mongodb://​username:​password@localhost/​kamailio"​
 +</​code>​
 +
 +==== Other Parameters ====
 +
 +If you store location records in MongoDB, set the following parameter for usrloc modules:
 +
 +<​code>​
 +modparam("​usrloc",​ "​db_insert_null",​ 1)
 </​code>​ </​code>​
tutorials/kamailio-and-mongodb.1441740749.txt.gz · Last modified: 2015/09/08 21:32 by miconda