alias realdst => realdst alias filename => filename
mysql -uroot -p -e "alter table `cdr` add column `filename` varchar(120) after `userfield`;" asterisk
globals { WAV=/records/wav; // WAV MP3=/records/mp3; // mp3 RECORDING=1; // , 1 - . }; macro recording (calling,called) { if ("${RECORDING}" = "1"){ Set(fname=${UNIQUEID}-${STRFTIME(${EPOCH},,%Y-%m-%d-%H_%M)}-${calling}-${called}); Set(monopt=nice -n 19 /usr/bin/lame -b 32 --silent "${WAV}/${fname}.wav" "${MP3}/${fname}.mp3" && rm -f "${WAV}/${fname}.wav" && chmod o+r "${MP3}/${fname}.mp3"); Set(CDR(filename)=${fname}.mp3); Set(CDR(realdst)=${called}); MixMonitor(${WAV}/${fname}.wav,b,${monopt}); }; }; _XXXXXX => { &recording(${CALLERID(number)},${EXTEN}); Dial(SIP/rtk/${EXTEN}); Hangup(); }
1392597899.17572-2014-02-17-07_44-83843ZZZ-32ZZ.mp3
1 0 * * * /root/sh/mvrecords.sh
#!/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin y=`date +%Y -d "-1 day"` ym=`date +%Y-%m -d "-1 day"` ymd=`date +%Y-%m-%d -d "-1 day"` mkdir -p /records/$y/$ym/$ymd/ mv /records/mp3/*$ymd* /records/mp3/$y/$ym/$ymd/
/var/www# ls -l total 60 -rw-r--r-- 1 fessae fessae 182 Nov 19 2011 callrates.csv drwxr-xr-x 3 fessae fessae 4096 Sep 26 2012 contrib -rw-r--r-- 1 fessae fessae 1986 Dec 22 2012 download.php -rw-r--r-- 1 fessae fessae 246 Sep 6 2013 downloads.php drwxr-xr-x 4 fessae fessae 4096 Apr 15 20:48 include -rw-r--r-- 1 fessae fessae 30384 Dec 2 20:21 index.php lrwxrwxrwx 1 root root 13 Apr 15 20:48 records -> /records/mp3/ drwxr-xr-x 2 fessae fessae 4096 Feb 13 2013 style drwxr-xr-x 3 fessae fessae 4096 Feb 18 21:07 templates
$recorded_file = $row['filename']; $mycalldate = substr("$calldate",0,10); $mycalldate_ym = substr("$calldate",0,7); $mydate = date("Ymd"); if ($mycalldate<$mydate){ if (file_exists("records/$mycalldate_ym/$mycalldate/$recorded_file")) { echo " <td class=\"record_col\"><a href=\"downloads.php?audio=records/$mycalldate_ym/$mycalldate/$recorded_file\" title=\" \"><img src=\"templates/images/sound.png\"</a> <object type=\"application/x-shockwave-flash\" data=\"include/player_mp3_maxi.swf\" width=\"150\" height=\"20\"> <param movie=include/player_mp3_maxi.swf/> <param name=FlashVars value=mp3=records/$mycalldate_ym/$mycalldate/$recorded_file /> </td>\n"; } else {echo " <td class=\"record_col\"> </td>\n"; } } else { if (file_exists("records/$recorded_file")) { echo " <td class=\"record_col\"><a href=\"downloads.php?audio=records/$recorded_file\" title=\" \"><img src=\"templates/images/sound.png\"</a> <object type=\"application/x-shockwave-flash\" data=\"include/player_mp3_maxi.swf\" width=\"150\" height=\"20\"> <param movie=include/player_mp3_maxi.swf/> <param name=FlashVars value=mp3=records/$recorded_file /> </td>\n"; } else {echo " <td class=\"record_col\"> </td>\n";} } }
include/config.inc.php
mysql -p mysql> alter table cdr alter filename set default 'none'; mysql> describe cdr; +-------------+-----------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+-----------------+------+-----+---------------------+----------------+ | id | int(9) unsigned | NO | PRI | NULL | auto_increment | | calldate | datetime | NO | MUL | 0000-00-00 00:00:00 | | | clid | varchar(80) | NO | | | | | src | varchar(80) | NO | MUL | | | | dst | varchar(80) | NO | MUL | | | | dcontext | varchar(80) | NO | | | | | channel | varchar(80) | NO | | | | | dstchannel | varchar(80) | NO | | | | | lastapp | varchar(80) | NO | | | | | lastdata | varchar(80) | NO | | | | | duration | int(11) | NO | | 0 | | | billsec | int(11) | NO | | 0 | | | disposition | varchar(45) | NO | | | | | amaflags | int(11) | NO | | 0 | | | accountcode | varchar(20) | NO | MUL | | | | uniqueid | varchar(32) | NO | MUL | | | | userfield | varchar(255) | NO | | | | | filename | varchar(120) | YES | | none | | +-------------+-----------------+------+-----+---------------------+----------------+ 18 rows in set (0.00 sec) mysql> \q Bye
Key Features
Fully Russian interface
Updated design
Tooltips
Correct export of records to a CSV file
The correct calculation of the cost of calls (plugin)
View the cost of each call (plugin)
The ability to specify a non-chargeable interval for the correct calculation of the cost
Ability to specify additional. rate. For example: The cost of the first minute is 1 rub., Then 10 kopecks each. (extra rate)
The file name of the call record is stored in the database
Ability to listen to the recording of the call through the web interface
You can click on the phone number and get information about it.
The player to listen to the call is loaded via javascript, so nothing slows down
If call records are archived, you will be prompted to download a record.
If you receive a fax, you can also download it.
Files for download are given by the script with the ability to resume
The folder for storing records can be located in any directory of your server.
And much more ...
Source: https://habr.com/ru/post/212815/
All Articles