SPA942 Personal Directory

I’ve been setting up Asterisk at work recently, as our old PABX has reached it’s limits.
We picked up half a dozen SPA942’s for some initial testing.
I have to say that while the phones are nice as an end user, however some of the administration functions seem to come up a bit short.
One of the big issues for us was that the personal directory on the phones doesn’t actually have to option to be populated from Asterisk (or any other PBX other than SPA9000). I have to admit though, I’m not really one to accept that something can’t be done.
After trying a number of things, I upgraded to the latest firmware (5.1.5 at time of writing) and after some more stuffing around, I was finally able to get the following line to populate the Personal Directory:

wget --post-data '24686=n%3DGeoff;p%3D6004;r%3D1&25390=n%3DMatt;p%3D6001;r%3D1' http://myphoneIP/pdir.spa

A few things about the command.
Firstly, the command will enter in two contacts in the Directory. These will be under entry #5 (24686) and entry #2 (25390). A complete list of all the codes here can be seen in the source of the Personal Directory page in the phone’s web interface.
So taking the first of the two entries (24686), what we’re posting is:

n%3DGeoff;

n=Geoff; (we need to escape the ‘=’ signs so that wget will actually pass the info on correctly)
n is the Display Name that will appear in the Directory

p%3D6004;

p=6004;
p is the extension number (or phone number). My extension is 6004.

r%3D1

r=1
r is the ring to use. 0 is no sound, just flashing. Play around with the other numbers to find the ringtone you want to use.

To add more than one entry at a time, simply separate the strings with ‘&’.

From here I’m going to look into LDAP integration, so that I can autorun the command, pulling the users and extensions out of Active Directory.

Be Sociable, Share!

22 thoughts on “SPA942 Personal Directory”

  1. Handy piece of information. It also works on the SPA-941.The only thing to note is that the directory table cell ID’s differ from phone to phone. (or at least thats what I have experienced)

  2. Very helpfull indeed.
    I created a simple shell-script to update the personal directory in my SPA921 phone from a file.

    The script needs a file called tel_list which contains on each line the name and telephonenumber, with a “,” as seperation.
    e.g.:

    Foo Bar,12345
    Foo & Bar,23456

    I’ve placed the script here:
    http://got.td-er.nl/SPA921/update_phonebook
    and a test-file http://got.td-er.nl/SPA921/tel_list

    The script generates an update-script which does the actual updating.
    It writes the entries in the tel_list file into the first memory-cells, leaving the rest untouched.
    For each wget-operation, (max) 6 cells will be updated and between each update the script sleeps for 10 seconds to give the phone some time to process each update.

  3. At work I wrote a python script that pulls directory info from a LDAP server and populates it to a SPA9xx phone. If anyone is interested I’ll put it up somewhere. 🙂

  4. @lester I’d love to see it done in python. I’m slowly migrating my scripts away from php so it would be great to see what you’ve come up with.

  5. I have a SPA942 and im trying to run this examples, but nothing happens. What could it be? the firmware is: 6.1.3(a) and I can add phones using
    http://phoneip/pdir.htm this makes a post to
    http://phoneip/pdir.spa… but from my php script or from command line wget doesnt do anything.

    with wget i get:

    D:\www\socket>
    D:\www\socket>wget –post-data=’17006=n%3Dgino;p%3D200′ http://192.168.1.7/pdir.
    spa
    –2009-09-25 12:59:53– http://192.168.1.7/pdir.spa
    Connecting to 192.168.1.7:80… connected.
    HTTP request sent, awaiting response… No data received.
    Retrying.

    Can you please help?

    thanks

  6. I’ve never tried with wget from windows, so not sure if there’s a difference there.
    I’ve also noticed in the past that when the firmware updates, so do the ID’s of the form fields. Check the source of pdir.htm to check that the ‘17006’ matches up with one that’s there.
    I’m not sure about the firmware version you’re using. I’ll try and check up tomorrow to see what I’m running on our system. If I get a chance I’ll update a handset and let you know.

  7. Yes 17006 matches up one memory slot. Appart from WGET y have tried with a simple http post using a form… but nothings happens… I will try to do this from a linux. If you can give me any more information it will be great!!

    thanks!!

  8. Ok, I can confirm that I’m using 6.1.3(a) as well without any issues.
    Try wget from linux, but also perhaps pay close attention to the quotation marks you’re using.
    Also, check your wget syntax for post-data
    On Linux it’s

    --post-data

    where as you’ve got

    -post-data

    (one leading dash rather than two – might just be the way my blog renders things though).
    Let me know how you go.

  9. I have recently bought a couple dozen of them spa942 telephones and I stumbled on your blog…

    Interested this post I opened a putty instance and logged in to my asterisk box, Here i pasted the string and fired the command only to see my unix box spew out:
    Connecting to 192.168.10.136:80… connected. HTTP request sent, awaiting response… No data received. Retrying.

    I’ve read the previous comments and identified the form field names in the html file. I put in the following : wget –post-data ‘24046=n%3DGeoff;p%3D6004;r%3D1&23982=n%3DMatt;p%3D6001;r%3D1’ http://192.168.10.136/pdir.spa

    where 24046 and 23982 are the field names identified in the html file…

    Any help would be appreciated,

    Triplebeam
    The Netherlands

  10. I don’t know why some people are having issues with this and others aren’t. Seems really strange.
    Not sure why it would matter, but the phones I’ve been using are AU models. I wouldn’t think that would make a difference, as they seem to use the same firmware.
    What you entered looked fine. I know there are options in the phones to restrict access to the web interface – maybe check that those aren’t on.

  11. For Pablo and Triplebeam or anyone else getting the ‘HTTP request sent, awaiting response… No data received. Retrying.’ message: did you paste the code from this post? If so check the ampersand and make sure it is not the unicode version, which it probably is. I had the same problem and it’s from copying the HTML output on this page. It should only be a single, real, ampersand in between the entries.

Leave a Reply

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