Tuesday, February 25, 2014

Call Record on Fritz.Box

Call Record - Fritz.Box 



I want automatic calls record on Fritz.box. After few days of Goggling found a solution :)

a few options: 

  1. On new (7320) Fritz devices provides this feature out of box. But it has many limitations; 
  • it is only for 10 minutes.
  • Not automatic, each call records must be allowed with key presses during the calls.
     2. Asterix PBX + Freepbx.
  • needs compilation, configuration and massive PBX knowledge. Probably uses lots of resources on HW side and from human side too... :)
Solution is

     3. FritzCap.

http://www.ip-phone-forum.de/showthread.php?t=232682
This is the call record solution on server side.
  • Download Fritzcap 2.0.0 (or 2.1 depending on your firmware)
  • Extract it, and configure-only the password in fritzcap.conf 
  • pick up the fritzbox handset and dial #96 * 5 * 
  • python fritzcap.py -c -d -m
thats all! Your all calls are recorded automatically.

Make it permanent:

make a shell script in /etc/init.d directory.



#touch /etc/init.d/fritzcap

edit file and insert this
python /yourroute/fritzcap.py -c -d -m
Save file.

#chmod +x fritzcap
#update-rc.d fritzcap defaults
#sync
#reboot
check it is runing:
#ps ax | grep fritzcapHauskeeping script.

# ps ax | grep fritzcap
 1817 ?        S      0:00 /bin/sh /etc/init.d/fritzcap start
 1822 ?        Sl     0:08 python /usr/local/bin/fritzcap.py -c -d -m
 2171 pts/1    S+     0:00 grep fritzcap
Hauskeeping script.

Cap and Wav files are large, convert mixed wav to mp3 and delete all source files.
Convert to mp3 with CRON. for example in the night when system not loaded.

# crontab -l
to check present cron

Just edit crontab.
# crontab -e
30 2 * * * /usr/local/bin/wav2mp3.sh

# cat wav2mp3.sh                                                                                                      

#!/bin/sh
# wav to mp3
cd /usr/local/bin/captures
nice -19 find /usr/local/bin/captures -name '*mix*.wav' |
while read i
do
if [ ! -f ${i%.wav}.mp3 ]; then
    nice -19 lame -h -b 128 "$i" "${i%.wav}.mp3"
fi
done
cd /usr/local/bin/captures
nice -19 find /usr/local/bin/captures -name '*.mp3' |
while read i
do
FILESIZE=$(stat -c%s "$i")
if [ "$FILESIZE" -gt 1000 ]
then
    nice -19 rm -f ${i%_mix_0_1.mp3}*.wav
    nice -19 rm -f ${i%_mix_0_1.mp3}.cap
fi
done

#repair cap file:
#python /usr/local/bin/fritzcap.py -d /usr/local/bin/captures/2014-03-10/160627/capture_20140310160627.cap


6 comments:

  1. Hi,
    a very good guide! But, how can I fritzcap install and use? Do I need python?
    Thank you in advance.

    ReplyDelete
  2. Thanks. :)
    You need to install python either on Fritz, or NAS. I run fritzcap and python on NAS.
    Robert

    ReplyDelete
  3. Thank you for quick response!
    I thought you must install python on your computer.
    How can I install the python
    a) on FritzBox and
    b) on NAS
    Can you describe step by step?
    And what do and then? Where should I what to open and what to enter where?
    Thank you again!

    ReplyDelete
  4. Hi.
    Python needed to run fritcap either on NAS, Fritz box, or a pc.
    Fritzcap software will connect to Fritz capture interface and will record the Fritz box voice traffic.
    So Fritzcap could be anywhere on your local lan.

    Is it clear now?

    Unfortunately I'm on holiday, :) can't help on python install.
    On Debian system :
    #apt-get install python

    Best Regards,
    Robert




    ReplyDelete
    Replies
    1. When I try to run your wav2mp3.sh it succeeds on the conversion but it fails when it tries to remove the .cap and .wav files after the conversion with the following error: line 16: [: : integer expression expected
      stat: illegal option — c

      Could you please help me to solve the last bit of this magnificent work ? Thanks in advance. I am running macOS Sierra

      Delete