Skip to content

SIP answering machine running on Raspberry Pi

Notifications You must be signed in to change notification settings

fabianhu/SIP-Pi

 
 

Repository files navigation

Sip-Tools - Automated calls and answering machine

  • sipcall - Automated calls over SIP/VOIP with TTS
  • sipserv - Answering machine for SIP/VOIP with TTS

Dependencies:

Copyright (C) 2012 by Andre Wussow, [email protected]

major changes 2017 by Fabian Huslik, github.com/fabianhu

For more informations please visit http://binerry.de/post/29180946733/raspberry-pi-caller-and-answering-machine.

Installation on Raspberry Pi 2/3 with Raspian

  1. Build and install PjSIP as explained below
  2. install eSpeak sudo apt-get install espeak espeak-data
  3. Copy Project folder to Raspberry Pi and hitmake in this folder
  4. configure sipserv.cfg to your needs (see example configuration)
  5. test drive using./sipserv --config-file sipserv.cfg
  6. this is not(yet) a "real" service, so include ./sipserv-ctrl.sh start command into your favourite autostart.
  7. stop the SIP service using sipserv-ctrl.sh stop
  8. install lame sudo apt-get install lame for the MP3 compression of recordings (mail.sh)

sipserv

Pickup a call, have a welcome message played or read. Do some actions by pressing (DTMF) keys on your phone. This service uses a generic approach. All actions are configurable via config file. One special usage is the special ability to record the caller while playing the intro. Please contact your lawyer, if this is legal in your country. With the sample configuration you can have a blacklist and only the special (=blacklisted) calls answered.

##Usage:
sipserv [options]

##Commandline:
###Mandatory options:

  • --config-file=string Set config file

###Optional options:

  • -s=int Silent mode (hide info messages) (0/1)

##Config file:
###Mandatory options:

  • sd=string Set sip provider domain.

  • su=string Set sip username.

  • sp=string Set sip password.

  • ln=string Language identifier for espeak TTS (e.g. en = English or de = German).

  • tts=string String to be read as a intro message

###and at least one dtmf configuration (X = dtmf-key index):

  • dtmf.X.active=int Set dtmf-setting active (0/1).
  • dtmf.X.description=string Set description.
  • dtmf.X.tts-intro=string Set tts intro.
  • dtmf.X.tts-answer=string Set tts answer.
  • dtmf.X.cmd=string Set shell command.

###Optional options:

  • rc=int Record call (0=no/1=yes)
  • af=string announcement wav file to play; tts will not be read, if this parameter is given. File format is Microsoft WAV (signed 16 bit) Mono, 22 kHz;
  • cmd=string command to check if the call should be taken; the wildcard # will be replaced with the calling phone number; should return a "1" as first char, if you want to take the call.
  • am=string aftermath: command to be executed after call ends. Will be called with two parameters: $1 = Phone number $2 = recorded file name

##a sample configuration can be found in sipserv-sample.cfg

##sipserv can be controlled with

./sipserv-ctrl.sh start and 
./sipserv-ctrl.sh stop

Build PjSIP

build directly on Raspberry Pi:

cd ~/tmp # any temporary directory
wget http://www.pjsip.org/release/2.1/pjproject-2.1.tar.bz2 
tar xvfj pjproject-2.1.tar.bz2 
cd pjproject-2.1.0/
./configure --disable-video 
make dep 
make
sudo make install

You will have plenty of time to brew some coffe during make. Enjoy while waiting.

Cross build of PjSIP for Raspberry:

export CC=/opt/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc
export LD=/opt/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc
export CROSS_COMPILE=/opt/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-
#export AR+=" -rcs"

export LDFLAGS="-L/opt/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/lib/gcc/arm-linux-gnueabihf/4.8.3 -L/opt/raspi_tools/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/lib -ldl -lc"

./aconfigure --host=arm-elf-linux --prefix=$(pwd)/tmp_build --disable-video 

make dep

make

sipcall

Make outgoing calls with your Pi.

##Usage:

  • sipcall [options]

##Mandatory options:

  • -sd=string Set sip provider domain.
  • -su=string Set sip username.
  • -sp=string Set sip password.
  • -pn=string Set target phone number to call
  • -tts=string Text to speak

##Optional options:

  • -ttsf=string TTS speech file name
  • -rcf=string Record call file name
  • -mr=int Repeat message x-times
  • -s=int Silent mode (hide info messages) (0/1)

see also source of sipcall-sample.sh

License

This tools are free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This tools are distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

About

SIP answering machine running on Raspberry Pi

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C 85.4%
  • Shell 7.5%
  • Python 6.7%
  • Makefile 0.4%