WWW.DUMAISNET.CA

Linksys SPA941 phone applications

The SPA941 is a good phone for the price. It has 4 line appearances and can be used as an intercom (will auto-answer using a directive in the sip header). 120.00 CAD$ is not bad for a sip phone. The configuration is only accessible from a web browser but you get a LOT of options to setup. I've always liked the sipura configuration pages. The phone doesn't have a backlight, a speaker-phone quality is not exceptional. Sound quality with the hand-set is very good though.


Personal Directory

An annoying thing with that phone is that it is impossible to provision the phone directory automatically. The good thing is, you can fill the list from the web page of the phone. So then, with wireshark I looked at how this information is posted. All you need is the following script that will simulate a browser submitting the list of numbers. You might wanna check the list of input fields ID, I am not sure if they will be the same on each devices depending on firmware version.

$fields = Array("43311","43503","43439","44655","44591","44783","44719","44911","44847","45039",
"44975","44143","44079","44271","44207","44399","44335","44527","44463","37487","37423","37615",
"37551","37743","37679","37871","37807","36975","36911","37103","37039","37231","37167","37359",
"37295","38511","38447","38639","38575","38767","38703","38895","38831","37999","37935","38127",
"38063","38255","38191","38383","38319","39535","39471","39663","39599","39791","39727","39919",
"39855","39023","38959","39151","39087","39279","39215","39407","39343","40559","40495","40687",
"40623","40815","40751","40943","40879","40047","39983","40175","40111","40303","40239","40431",
"40367","33391","33327","33519","33455","33647","33583","33775","33711","32879","32815","33007",
"32943","33135","33071","33263","33199","34415");

$conn = mysql_connect("localhost","username","password");
mysql_select_db("dbname");
$query = "SELECT * FROM phonebook ORDER BY name;";
$result = mysql_query($query);

$i=0;
$list="";
$n = mysql_num_rows($result);
while ($record = mysql_fetch_assoc($result)) {
        $name = $record['name'];
        $phone = $record['phone'];
        $name = urlencode($name);
        $phone=urlencode($phone);
        $field = $fields[$i];
        $list .= "$field=n%3D$name%3Bp%3D$phone";

        $i++;
        if ($i<$n) $list .= "&";
}

system("wget --post-data '$list' http://192.168.0.107/pdir.spa -t 1");

Executing that script will fetch all entries in the mysql server and post them on the phone located at 192.168.0.107

-- Section last modified Sunday, 04th October, 2009 @ 09:38pm