Daily Archives: March 9, 2015

Let Raspberry Pi do your Calling and Answering

In certain projects or experiments where you are monitoring an entity such as temperature or pressure, it is impractical to be physically present for any length of time. However, it may be important for you to know when the measured entity breaches a high or a low set point. For example, if something is not working out as it should – say temperature or humidity too high – you may wish to start or control another activity rather quickly to compensate.

In such cases, the handy, credit card sized single board computer, the Raspberry Pi or RBPi can be of immense help. RBPi can call, sms or inform you via web-interface, in case things are tending to go beyond their limits. Although sms and web-interface work equally well, for cases that are more important a call gets more attention than the others do.

When receiving a call, you expect the other party to speak up. Programs such as eSpeak and Festival endow an RBPi with capabilities of synthesized speech. Both tools allow you to cache speech as wav-files. eSpeak is more adjustable and creates wav files a bit faster than Festival; however, their performance is similar. You can select any one of the programs depending on your preference and install it with a ‘sudo apt-get install …’ command.

For making calls, it is simpler to use a sip/voip based system. Here again, you can select between two capable tools – PJSIP or Linphone. Of the two, Linphone is difficult to include into an application script. PJSIP has a command line interface and provides a powerful api that you can use within your own sip-based project. However, you will need to download and compile it for Raspbian.

After compilation, you may find some echo or jitter when making normal calls to another phone. To get rid of these, you will need two other tools – sipcall and sipserv. Sipcall will help you to make a completely automated call to a specified number using a text to speech converter. That makes it very useful when using via bash-scripts. For example, you can ask it to check the state of a sensor and place a call if a critical threshold is reached. On the other hand, Sipserv is more like a service, where you make a call to query information and/or execute a command via phone. Of course, your sip-provider must support inbound DTMF. Both tools are available here, but you will need the pkg-config-package tool to compile them.

The original author has also created simple bash-scripts that can check the actual load and place a call if the load is found too high. For stopping/starting the service available, he has provided a simple configuration and a bash-script that you can use for Sipserv. Readme files and general info is available for the user. For more details, refer here.

Although the tools are rather ‘proof of concept’ than a final product, they work well. The author permits changes and extensions to his original work and invites suggestions on any improvements, more especially for the current sound problems of echo and jitter.