IoT Bytes

Bits and Bytes of IoT

Incoming Call Details Logger with Raspberry Pi

Pradeep Singh | 18th Jun 2018

telephone

I was looking for a way to monitor the incoming call details / missed calls on my landline number remotely (especially when I am away from home). As I had a “USRobotics USR5637 USB Modem” with me, I decided to create a simple WebApp that can log the call details for me and display them in an HTML based page.

1. Hardware Setup:

I used Python 2.7, Flask framework, SQLite3 DB and USRobotics USR5637 USB Modem connected to a Raspberry Pi (model 2 or 3) to create the incoming call detail logger Web Application. The following picture shows the modem connection with Raspberry Pi –

modem_setup

You can use an “RJ11 Male to Two Female Socket 4-pin Telephone Phone Line Splitter” as shown in the following picture to connect the phone line with your landline phone and the USRobotics modem at the same time –
male_to_female_splitter

2. Download the Python Flask App Code:

If you want to run this web app on your Raspberry Pi, you can ssh into the Raspberry Pi and download the python script from my Github Repository Octocat using the following command –

git clone https://github.com/pradeesi/Incoming_Call_Detail_Logger

On successful file download, you should see a new folder named as “Incoming_Call_Detail_Logger” in your current directory. cd into this directory and list the files. You should see all the files as shown in the following command output – 

pi@raspberrypi:~ $ cd Incoming_Call_Detail_Logger/
pi@raspberrypi:~/Incoming_Call_Detail_Logger $ ls
README.md  call_detail_logger.py  templates
pi@raspberrypi:~/Incoming_Call_Detail_Logger $

Before you execute the python Web App, make sure you set the correct Time Zone on your Raspberry Pi, otherwise, your call report will not show the correct time. You can set the time zone using the following command –

sudo dpkg-reconfigure tzdata

3. Start the Python Flask App:

Now you are ready to start the Web Application using the following command –

python call_detail_logger.py

After this, you can access the Incoming Call Details Report Web Page using the following URL (Change the Raspberry Pi IP Address accordingly) –

http://:5000/call_details

4. Application Screenshots:

If the application was started successfully, you should see the following console output on your Raspberry Pi ssh terminal –

pi_console

Following is the web browser screenshot with a sample call details report. Here “SP Time” and “SP Date” columns show the Time and Date from the service provider.

call_details

5. Limitations:

  1. This program will ONLY log the incoming call details (Number, Date and Time of the call) in an SQLite database. It will not log the outgoing call details or the call duration.
  2. As the Web App uses Bootstrap CSS framework, make sure you have internet access on the host where you are trying to open the Web Page. This is not a show stopper, but in case bootstrap CSS files aren’t available, you will see a very basic HTML table with call data.

Conclusion:

This is not a production ready code but it will provide you with more than enough knowledge to build a module for your Smart Connected Home. You can also split the code into two modules, one with the Modem Interaction and other with the Web App. This will allow you to deploy the Web App onto a Public Cloud platform making it accessible on the go.


 

Related Articles:

USB Analog Modem with Raspberry Pi

Record Audio from Phone Line with Raspberry Pi

Play Audio File on Phone Line with Raspberry Pi

Python Script to Reset USB Modem COM Port on Raspberry Pi

Python Script to Autodetect Modem COM Port on Raspberry Pi

References:

Wikipedia – Voice modem command set

USRobotics 56K USB Modem Voice Commands

USRobotics 56K USB Modem – Data and General Commands

Voice +V Commands – Developer’s Guide

Blog Home Page:

Let’s Decipher IoT…

Advertisements

2 thoughts on “Incoming Call Details Logger with Raspberry Pi

  1. Pradeep, thank you very much for your Raspberry Pi and US Robotics 5637 blogs and projects. They were a big inspiration for me to develop my own Pi-based call attendant/blocker project. Your code examples seeded many of the project’s classes; I’ve tried you give you the proper attributions. Here’s my project: https://github.com/emxsys/callattendant

    Best regards,
    –Bruce

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: