Build an app that makes phone calls from Raspberry Pi

This project was contributed by Andy Fundinger, a professional Python developer and trainer. As an assignment for Mother’s day, Andy built this integration as a way to teach his students how to make calls to their mother’s using Plivo and Raspberry Pi. Below are the instructions on how to build it yourself.

In this integration, you’ll be able to: Make calls to pre-set numbers using a keypad attached to Raspberry Pi

What is Raspberry Pi?

Raspberry

The key specs of Rapsberry Pi (a.k.a RasPi) are:

  • Linux based operating system
  • 700 MHz ARM11 CPU
  • 256MB (or 512MB) RAM
  • SD Card Storage
  • 2 USB ports
  • Composite and HDMI Video out
  • Stereo audio out
  • 8 GPIO pins
  • Wired Ethernet

It’s less protected than say an Arduino, but it’s still pretty sturdy. To learn more check out the official website of Raspberry Pi.

Build your own Raspberry Pi call button

1. RasPi Circuit Diagram and inputs flow via GPIO.

The inputs are very simple since they were meant to be only a small portion of the class. I hooked up a four button keypad to four of the Raspberry Pi GPIO pins as inputs and then run a continuous loop to check if the buttons have been pushed.

Circuit Diagram#1

Circuit

Circuit Diagram#2

Circuit Schem

2. Call flow via Plivo Voice API

Plivo normally expects that you’ll be using it for a web app so I had to fake that somewhat. Rather than building a full web app, I just had each student create a single page that had at least the minimum viable xml to dial a specified number in response to the call being answered. We also played with having a little more in that xml file. But basically we told Plivo that it was a web service and Plivo was ok with that. We used Python Anywhere for this mostly so the students would walk out with an account there.

params = {
'from': "14245550100",
'to': '12015550164',
'answer_url':"http://example.com/static/call_mom/answerThenCallMom.xml",
'answer_method': "GET"
}
p.make_call(params)

Then you will execute a script that will make a HTTP GET request for “answerThenCallMom.xml” which could be as simple as this:

<Response>
    <Dial>
        <Number>14245550100</Number>
    </Dial>
</Response>

You can check the code for my Raspberry Pi project on Github

Contributed by: Andy Fundinger

Is anything on this page unclear? Suggest edits and help us improve our documentation!