Ryo CDR: another asterisk CDR viewer

    For an asterisk, probably, only the lazy did not write cdr viewer. There are a lot of such solutions: asterisk cdr viewer , agcdr ,   asterisk cdr viewer mod  ( article on Habr), cdr-stats and many more that I do not know.

    But the functionality of cool filters, sortings, groupings was not required, but you just need to view data on calls per day, the ability to listen to the conversation record and password protection. So that the business aunt, sitting in the back seat of the car, while her husband, driving around traffic jams, takes her home, could take a tablet and look at the data on the calls of her employees and quickly listen to the recordings of conversations.

    After a short search on the github, I came across webcdr. Slightly processed it with a file: removed the unnecessary, added http basic authorization and received the necessary version of cdr viewer. With the familiar aunty Twitter Bootstrap-style web interface. Aunt happy.


    Further a few details.

    Ryo CDR

    We have asterisk 11, mysql 5.6 on our host with Ubuntu 14. Asterisk records conversations, adds data about calls to the database. We will also need installed node.js, npm and bower.


    wget https://github.com/antirek/ryocdr/archive/v0.0.11.tar.gz
    tar -xzf v0.0.11.tar.gz
    cd ryocdr-0.0.11
    npm install
    bower install   // добавьте опцию --allow-root, если устанавливаете под root
    npm run build

    Configuration file

      port: 9030,  // порт веб-интерфейса Ryo CDR
      recordspath:"/var/records",   //базовый путь к записям разговоров
      db: {
        client: "mysql",
        connection: {
          host: "",
          user: "user",
          password: "password",
          database: "cdr",
      cdr: {
        table: "cdr"
      auth: true,  // авторизация basic по паролю
      username: 'admin',
      password: 'password'


    Launch app.js

    node app.js

    Or use pm2 manager

    pm2 start app.js  --name "ryocdr-app"

    Also, the path to the configuration file can be specified through the environment variable RYOCDR_CONFIG, then the application will use the specified config, and not located in the local directory. This, for example, is convenient when you use Ryo CDR in a docker container.
    export RYOCDR=/etc/ryocdr/config

    Storage of record paths in the database

    The path to the record file is stored in the record database field. For example, we may have such a dialplan (lua):

        local basePath = '/var/records';
        local date = os.date("*t");
        local uniqueid = channel.UNIQUEID:get();
        local fname = string.format("%s_%s-%s-%s_%s:%s:%s", uniqueid, date.year, date.month, date.day, date.hour, date.min, date.sec);
        local WAV = "/wav/";
        local MP3 = string.format("/mp3/%s-%s-%s/", date.year, date.month, date.day);
        local recordCommand = "/usr/bin/nice -n 19 mkdir -p %s && /usr/bin/lame -b 16 --silent %s%s.wav %s%s.mp3";
        local options = string.format(recordCommand, basePath..MP3, basePath..WAV, fname, basePath..MP3, fname);
        app.mixmonitor(string.format("%s%s.wav,b,%s", basePath..WAV, fname, options));
        channel["CDR(record)"]:set(string.format("%s%s.mp3", MP3, fname));

    Those. the file was recorded by mixmonitor in wav, converted by the command to mp3, and the path of the converted file in the folder with mp3-shki was saved to the database by the CDR dialplan application.

    In the Ryo CDR configuration file, you can specify the base location of conversation records in the recordspath parameter. And in the database itself, store only the path relative to this base path.

    The structure of the CDR database

    The structure of the cdr table is traditional, supplemented by the record field for conversation records ( table structure ).

    Installation video Ryo CDR

    Caution, video without bubbling installation comments, but with music.

    Maybe someone else will come in handy. Bugs, wishes, constructive criticism - please inform.

    Ryo CDR: https://github.com/antirek/ryocdr

    PS Special thanks to Ivan for webcdr, I had to adapt a little for my needs.

    PPS One of my aunt’s requests was voice control for listening to the recordings of conversations: “So this is normal, next, scroll, scroll, so normal, next.” WebAudio should try adding.

    Also popular now: