Page tree
Skip to end of metadata
Go to start of metadata


This module stores CDRs (Call Detail Record) directly to a MongoDB database.

Install & Configure

To compile the module in FreeSWITCH, uncomment the module in modules.conf and add the module to freeswitch/conf/autoload_configs/modules.conf.xml for autoload.

Uncomment in modules.conf:

Add in freeswitch/conf/autoload_configs/modules.conf.xml:

Schema Definition

Compared to other modules, such as mod_cdr_pg_csv or mod_cdr_sqlite, there is no need with MongoDB to define a schema due to the nature of NoSQL

MongoDB Server Configuration

Recent versions of MongoDB (on 64-bit platforms) preallocate by default a 3GB journal. If you simply want to test this module in a non-production environment, or if you have low call volume, you can disable this journal preallocation. To do so, make sure that that the journal config option is commented out, and instead add a nojournal option:

This is equivalent to launching the MongoDB server with the --nojournal command line option. Once the server is running with journalling disabled, you can safely delete the journal files (usually in /var/lib/mongodb/journal).

Module Configuration

The default configuration file can be found in freeswitch/conf/autoload_configs/cdr_mongodb.conf.xml.

Default values are shown.


If you have enabled authentication on your MongoDB server, simply uncomment and configure the username and password params.

Replica Sets

Replica sets are the preferred method of replication in MongoDB, superseding the older master/slave style replication. Replica sets support up to 12 member servers, and the configuration is largely automatic. To enable replica set support in the module, simply specify more than one server in the host param. Members can run on different ports if desired.

For example, the following will connect to a 3-member replica set, comprised of localhost and two additional servers. The third server is running on a non-standard port:

Remember to configure the replica_set_name to match what your MongoDB replica set is configured as.

Unix Domain Sockets

If the MongoDB server is running on the same host as your FreeSWITCH server, you can configure the module to connect via a Unix domain socket. This may provide a small performance boost over connecting via TCP. Specify the path to the Unix domain socket in the host param, and specify a port number less than zero, e.g.: