📜 ⬆️ ⬇️

Ryo CDR: another asterisk CDR viewer

For an asterisk, probably, only the lazy one did not write the cdr viewer. There are plenty of such solutions: asterisk cdr viewer , agcdr , asterisk cdr viewer mod ( article on Habré), cdr-stats and many more that I don’t know.

But the functionality of cool filters, sorting groups was not required, but you just need to view the data on calls for the day, the ability to listen to the recording of the conversation and password protection. So that the business aunt, sitting in the back seat of the car, while her husband, driving around the evening traffic jams, drove her home, could take a tablet and see the data on the calls of his employees and quickly listen to the recordings of conversations.

Not long after searching the githabu, I stumbled upon a webcdr . I processed it a bit with a file: I removed the extra, added http basic authorization and got the necessary cdr viewer option. With familiar aunty web interface in the style of Twitter Bootstrap. Auntie happy.
')
image

Next, some details.



Ryo CDR

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

Installation

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

 { tz:"+0400", port: 9030, //  - Ryo CDR recordspath:"/var/records", //     db: { client: "mysql", connection: { host: "127.0.0.1", user: "user", password: "password", database: "cdr", charset:"utf8" } }, cdr: { table: "cdr" }, auth: true, //  basic   username: 'admin', password: 'password' }; 


Launch

Run app.js

 node app.js 


Or use the manager pm2

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


Also, the path to the configuration file can be specified via 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 the Ryo CDR in a docker container.
 export RYOCDR=/etc/ryocdr/config 


Keeping paths to the database records

The path to the record file is stored in the database field record. For example, we might 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 is recorded by mixmonitor in wav, converted by the command to mp3, and the path of the converted file in the folder with mp3-shki is saved in the database by the CDR dialplan application.

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

DB structure CDR

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

Ryo CDR installation video

Beware, video without boomy about installation, but with music.



Perhaps someone else will come in handy. Bugs, suggestions, constructive criticism - please report.

Links
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 the aunt's requests was voice control of listening to the recordings of conversations: “So this is normal, the next one, to squander, flush, so normal, the next one”. WebAudio should try to add.

Source: https://habr.com/ru/post/276899/


All Articles