This software provides a "softphone", a Voice over IP client using the SIP protocol, to play audio WAV files via telephony running on a Raspberry Pi.
Dependencies:
- PJSUA API (http://www.pjsip.org)
Based on https://github.com/binerry/RaspberryPi/, modified by and forked from https://github.com/fabianhu/SIP-Pi.
# Install dependencies
sudo apt install autoconf checkinstall libgpac-dev libmp3lame-dev libopencore-amrnb-dev \
libopencore-amrwb-dev libtheora-dev libvorbis-dev yasm zlib1g-dev libsdl-sound1.2-dev \
libportaudio-dev git python3 ffmpeg
# Install pjsip
wget http://www.pjsip.org/release/2.7.2/pjproject-2.7.2.tar.bz2
tar xvfj pjproject-2.7.2.tar.bz2 && rm pjproject-2.7.2.tar.bz2
cd pjproject-2.7.2/
./configure --disable-video --disable-libwebrtc
make dep && make clean && make
sudo make install
cd ~/
# Build cgcall
git clone https://github.com/philipptrenz/cgcall.git
cd cgcall
make
cgcall --config path/to/cgcall.cfg [-s 1]
- --config string Set config file
Optional:
- -s int Silent mode (0/1)
- sd=string Set sip provider domain.
- su=string Set sip username.
- sp=string Set sip password.
- af=string announcement wav file to play. File format is Microsoft WAV (signed 16 bit) Mono, 22 kHz
- 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.
- 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
Hint: Audio files can be converted via ffmpeg -i inputaudio -ac 1 -ar 22000 -acodec pcm_s16le output.wav
A sample configuration can be found in cgcall-sample.cfg
sudo cp scripts/cgcall.sh /etc/init.d/cgcall
sudo update-rc.d cgcall defaults
Now cgcall gets started at boot and can be controlled via sudo service cgcall [start|stop|restart|status]
I designed a Rasperry Pi 2/3 case to be 3D printed, check it out at Thingiverse.