ipoddubny / webcdr

:telephone: CDR viewer for Asterisk with search, call recording player, bulk downloads, Excel export
MIT License
63 stars 34 forks source link

About voice recording in Asterisk #3

Open logs777 opened 8 years ago

logs777 commented 8 years ago

Please, do not get mad at me for talkativeness, I just want to recommend to add into manual information about recording voice in asterisk. I understand, that this is off topic, but with this (I don't know how to say it in English) "снизится порог вхождения". For example, I configured voice recording with this way:

  1. Make directory for voice records mkdir -p /var/spool/asterisk/monitor

  2. Install lame: download latest archive from here for example with wget , and after that:

    tar zxvf lame-3.*.gz 
    cd lame-3.*
    ./configure
    make
    make install
  3. Create file /usr/local/bin/conv2mp3.sh with the following content:

    #!/bin/sh
    LAME="/usr/local/bin/lame --noreplaygain"
    filename="$1"
    foldername="$2"
    $LAME -V2 $foldername/$filename.wav $foldername/$filename.mp3
    rm -f $foldername/$filename.wav
  4. Use this script in /etc/asterisk/extensions.conf to convert recorded WAV file to MP3 (also, this is example of recording voice in format needed by webcdr ) :

    exten => _8XX,1,Set(filename=${UNIQUEID})
    exten => _8XX,n,Set(foldername=/var/spool/asterisk/monitor/${STRFTIME(,,%Y)}/${STRFTIME(,,%m)}/${STRFTIME(,,%d)}/)
    exten => _8XX,n,MixMonitor(${foldername}/${filename}.wav,b,/usr/local/bin/conv2mp3.sh ${filename} ${foldername})
    exten => _8XX,n,Dial(SIP/${EXTEN},30,t)
logs777 commented 8 years ago

and to show webcdr, that voice recording is configured (step 8 of installation manual), user should change file /etc/asterisk/cdr_mysql.conf by adding alias, for example I added alias uniqueid => record

ipoddubny commented 7 years ago

It's fine if it works for you. Even better, if somebody finds it helpful.

The problem is that there are too many options to formulate a single solution that fits all. Some Linux distributions have mp3 software in official repositories, for example Ubuntu. For others, there may be unofficial packages. Or some people may prefer using ffmpeg, not lame. Some might as well use Opus instead of MP3 (as I do).

The intended use of record column is to set it explicitly as an additional field using cdr_odbc_adaptive only on those calls that have been monitored. Setting an alias in conf file will show recordings for all calls, even for those that have never been recorded.

Still, there should be some basic manual(s) for most common installations, so I'm keeping the issue open. Thanks for the feedback once again.

logs777 commented 7 years ago

Hello! Thank you for reply. Can you explain, how I can change record fields only for that calls, which have been monitored? I guess, that I should do it from Asterisk Dialplan =)

ipoddubny commented 7 years ago
...
Set(CDR(record)=${UNIQUEID})
MixMonitor(...)
...

It only works with cdr_adaptive_odbc. cdr_mysql and other database cdr drivers will discard additional fields.