A system to reject phone calls from my laptop

This post is about a system we devised and set up at home for me to be able to reject all the annoying phone calls I receive during the day from my laptop, without having to go pick up the phone. If you are also working from home like I do (yes, this is another cool option we have at Igalia!) you might find this hack useful. 😀

Demo:

In the video above, I call at home from my mobile once hiding my number (appear as unknown) and once without hiding it. A notification bubble with a “Hang Up” button then appears on the desktop. I click the “Hang Up” button when I want to reject the call. Then I check the call log that is available to see the last numbers that called during the day. For obvious reasons, I substituted my mobile number with a random one for the video. 🙂

Features List

My initial wish list for this program was short. I only needed 3 features:

  1. To be able to see the caller from my laptop and decide if it’s worth to get up, make a break and pick up the phone.
  2. To be able to easily reject the call with the press of a button.
  3. To be able to see a list of all the calls later, in case I needed to call back people I ignored when I was busy.

Let’s see how it was implemented:

Setup

We used a modem connected to the phone line and an Orange Pi device to talk to this modem through the serial port.

The modem configuration:

  • The modem was set up to not “pick up” the phone:
  • The modem was set up to display the caller ID along with the “ring” message:
    The caller ID is displayed after the first and before the second ring message (when it’s available).

On the Orange Pi side, the phonelined daemon is running. This daemon establishes a serial connection with the modem, sends some initialization commands and waits for data in the serial port:

  • When the first ring message arrives, the daemon sets a timer (alarm to call a signal handler in 3sec). If the caller id arrives in the meantime, it broadcasts a message ring <caller id> to all the connected clients and cancels the timer. Otherwise, it only broadcasts the ring.
  • It also records the calls to a log file.
The hardware.

Desktop notifications

Now, for us to receive notifications about the calls, we needed some clients to exchange data with the daemon.

Initially, we used this command line program by Nuclear that can take the following options:

I didn’t find it very convenient to run an instance to connect and see the messages and then another instance to hang up the phone while it was ringing so I was only using it to see the log.

Instead, I’ve written a small Perl script that uses the Gtk2::Notify to connect to the server through a socket and display the ring messages that are broadcasted by the server as bubble notifications. Every notification has a “Hang Up” button that sends the hangup message to the server when it’s pressed.

One note about how the server handles the “Hang Up” action:

In theory, the daemon should only send the ATH0 command to the modem to reject the call but it seems that our modem is able to do that only when it has already picked up the phone and not while the phone is ringing. So, what we ended up doing to reject the call was to send the ATH1 (and charge the annoying caller), wait 2 seconds and then send the ATH0 command.

Future improvements (new wish list)

I expanded my wish list a little bit. I am thinking to add these new features:

  • Let the Orange Pi device play the ringtone to be able to silence the sound remotely.
  • Have a phone book to assign some numbers to names.
  • Have a blacklist with all the annoying numbers (ads etc) in order to automatically reject calls from them from the server (without waiting for the ring message to reach the client).

Links

Code:

Leave a Reply

Your email address will not be published. Required fields are marked *