micolous.id.au

the result of a blogging accident

Saturday, May 17, 2008

It’s Cisco-o-clock!

Filed under: Coding, VoIP Hardware — micolous @ 02:41

I thought I’d put up a couple of small new scripts I wrote for my Cisco IP phone.

The first is a simple image converter. It converts images from any format that the [Python Imaging Library (PIL)][pil] supports and turns it into a Cisco IP Phone Image format (CIP) – a Python version of Cisco’s `gif2cip`). For convenience, the new lines in the images are displayed as a colon, so you can use it in other things where you need to chop up the images into parts by line (for example, my clock). If you want to display the image statically, you would remove them. It assumes you’re using 2-bits-per-pixel (4 colour) output for the Cisco 7940/7960, and that your image is an 8-bit greyscale image. If you have an alpha channel or it’s RGB, the image won’t convert.

It uses a very basic algorithm to downsample the image to 2-bits-per-pixel which probably isn’t perfect in the nature of LCDs, so you may need to tweak the colour value curve in your graphics program if you’re using something other than text. It will also automatically invert the image so black on your computer is black on the LCD. You can [grab the script here][image2cisco].

“It’s ten past two on the [rocket clock][playschool]!”

The second program is a big digital clock Python CGI script. It’s based on the same idea as the “Clock” script from the [Cisco IP Phone Services SDK][servicessdk] (which was originally in classic ASP), with a bigger font and the full date displayed at the bottom of the screen. The image for the digits is embedded in the Python script (which is why the file is so big), which you can change by using the image converter program. You can [grab the script here][clock], and [the source PNG images for the digits here][digits] (only needed if you want to modify the digits). Remember to set the execute bit if you’re using plain CGI (you don’t need to do this if you use mod_python).

I always believe you can’t have too many clocks. :P

[pil]: http://www.pythonware.com/products/pil/
[image2cisco]: /static/projects/asterisk/cisco-hax/image2cisco.py
[clock]: /static/projects/asterisk/cisco-hax/clock.py
[digits]: /static/projects/asterisk/cisco-hax/digits.zip
[servicessdk]: http://www.cisco.com/en/US/prod/collateral/voicesw/ps6788/phones/ps379/product_data_sheet09186a00800925a8.html
[playschool]: http://en.wikipedia.org/wiki/Play_School_%28Australian_TV_series%29

Friday, January 19, 2007

Cisco 7960/7940 VoIP Phones vs. Adelaide/SA’s timezone.

Filed under: VoIP, VoIP Hardware — micolous @ 22:23

The Cisco 7960/7940 (and probably also some others) seem to have this daft issue where they assume Darwin/NT’s timezone rules of GMT+9.5 hours, and no daylight savings time. So, some additions to the TFTP configuration file `SIPDefault.cnf` are required.

sntp_server: 129.127.40.3 ; ntp.adelaide.edu.au

time_zone: CAST
dst_offset: 1

dst_start_month: October
dst_start_day_of_week: Sun
dst_start_week_of_month: 8 ; Last
dst_start_time: 2

dst_stop_month: March
dst_stop_day_of_week: Sun
dst_stop_week_of_month: 8 ; Last
dst_stop_time: 3

Here I’ve used Adelaide University’s (S)NTP server, but you could easily substitute another server. These will observe standard rules only, and won’t take into account when the Victorian government feels the need to needlessly change the daylight savings rules of the whole country to suit the Commonwealth Games, where daylight savings changes would normally apply a week after the closing ceremony. Then again, some Victorian government officials have this strange idea that Australia is just them and New South Wales.

At least Sydney was nice about it and didn’t shove it down our throats. :)

Sunday, June 11, 2006

SA Police Speed Camera Monitor for Asterisk

Filed under: Asterisk, Coding, VoIP — micolous @ 11:38

I’ve written a PHP-AGI script that uses Asterisk 1.2, PHP 4.3 and Festival to download and speak the locations of speed cameras published on the SA Police website. For high-traffic PBX systems, it may be desirable to cache the locations on the local machine to reduce PBX load.

Because the script generates wave files on demand, on some systems multiple threads running it may conflict with one another.

Included are extra prompts needed for the script. They are for demonstration purposes only – if you want to put it in your own system, you’ll need to rerecord the prompts.

Download v0.1 of the script.

UPDATE (2006-12-05): This script probably doesn’t work anymore, as SAPOL nicely screwed up their website. :(

Monday, May 1, 2006

conf.py v0.3

Filed under: Asterisk, Coding, VoIP — micolous @ 11:42

There’s a small update to conf.py. This version fixes some formatting bugs with the channel and flags fields that ment that they would occasionally overlap in varying directions, depending on the length of the channel name. This version fixes the bug by doing tests to actualy see where the channel name ends, and going by that. So you can now download v0.3 of the script.

Friday, March 10, 2006

Cirrus CPH-B661 Ethernet VoIP Phone

Filed under: Toys, VoIP, VoIP Hardware — micolous @ 19:52

I’ve recently bought one of these devices from eBay, for a mere 70$. Bargin basement, considering the cost of an ATA is 70$, plus the cost of a phone, and that many other IP Phones sell for 300-400$, and I wasn’t willing to spend that much money on a phone.

It’s a nice gadget, it has a “straight through” RJ-45 100mbit socket, and a crossover socket, allowing you to use an existing cable for your computer for your phone as well – something ideal in offices or other situations where there is limited cabling and you want to save money on VoIP rollout.

There are five different firmwares for the device: H.323, IAX2, MGCP, Net2Phone, and SIP. By default, my unit had a SIP firmware on it, however it is painlessly switchable by downloading the firmware from Cirrus’ website, then uploading it via a web interface. It takes about 5 minutes to complete the update. Something interesting about the images is that the filesystem isn’t encrypted or encrapted at all – and you can see the raw HTML source in the file, as well as some of the strings used on the phone. Initial minipulation hasn’t really been successful, however I could be in the wrong place, or there may be a checksum on the file to prevent modified or corrupted firmware from being uploaded to the device.

A couple of issues I had was that I found the manual difficult to follow to configure the device via the handset. After I switched the device to using DHCP (it was using a static IP of 192.168.1.100 by default), it then was trivial to configure via a web interface.

Something I noticed using the original firmware that when reading out the “index” of the speed dial, that the numbers weren’t really right. So for number “98″, it would read “9 ten 8″. In v1.50 of the firmware, this issue was resolved.

I notice you can set a “phone number” to be displayed on the phone as any string you wish using the web interface, but not the handset. I actually use this functionality (it simply pops up that it’s my phone), and then it displays my local extension number. It would be good if that sort of thing was consistant.

The “Flash” button doesn’t do a “flash” (or “recall”) at all, but in fact accesses an interactive speed dial menu. Additionally, the abbreviations for some of the buttons could be better (“anscal”, “miscal”, “diacal”), and there should be some functionality to change the ringing, and dialtone, much like the Sipura ATA units do.

So, we shall see how this all goes….

Older Posts »

Powered by WordPress