PHP script for call status when using linksys/sipura devices

At the office we recently upgraded out phone system to use sip phones and chose some linksys SPA-941’s. I was looking for a way to display the caller ID of an incoming call on our computers and potentially the office display screen.

Ideally I wanted something that would connect on the SIP protocol and although there is probably something out there I haven’t had time to find it yet. As a quick (and slightly cumbersome) solution I rewrote a perl script I found here in to PHP.

It’s basically a class that connects to a linksys/sipura phone configuration page at a specified IP and reads the status out of the HTML, also grabbing the callers name and number. You’ll have to adapt it as necessary to poll the phone every x seconds. I’ve included an example file on how to use the class; at the moment the script will just print out the caller ID but you can do whatever you want with it, some examples could be:

  • store it in a database for call records
  • send the information to growl (mac only) to pop-up a message on the desktop
  • integrate the script in to your intranet

If anybody knows of a better way to get the caller ID from these phones, or by using a SIP client on a PC, please let me know!

Download the script here: php-linksys-status.zip

P.S. You’ll need curl (probably already installed) and PHP5 for this to work.