Asterisk voicemail notifications with MP3 

I found a lovely script for sending voicemail notifications in MP3 format instead of wav. It’s a bit of a hack, since Asterisk only provides you with an entire, MIME encoded email message as input. Anyway, I improved it somewhat and wanted to share. This version adds call info and an image to the MP3 file, and is more elegant IMHO – e.g. use of pushd/popd or mktemp.
Continue reading

Moving a Subversion repository 

From one server to another, no need for file transfers or anything like that. Do this on the new server.

mkdir /foo/bar/new
svnadmin create /foo/bar/new
ssh root@old.host "svnadmin dump /foo/bar/old" | svnadmin load /foo/bar/new

On your working copies you’ll need to say where the new repository location is:

svn switch --relocate https://old.host/svn https://new.host/svn /path/to/working/copy

Sending Asterisk 1.4 voicemails to multiple emails 

Here’s the complicated way to get Asterisk sending voicemail notifications to multiple email addresses. (The easy way? Use group mailboxes and/or sendmail aliases.) Once this modified module is compiled and installed, multiple addresses in voicemail.conf can be separated by a pipe character.

Continue reading

Change default MySQL password on Ubuntu 

When you install the MySQL package on Ubuntu Linux, it does not come with a blank password, as most packages and installations do. The package is set up so you can change the password like so:

sudo dpkg-reconfigure mysql-server-5.1

The top Google hits recommend stopping the service, restarting MySQL with privileges disabled, etc. This is not the way it was meant to be done, according to Ubuntu.

A2Billing authentication of forwarded calls 

So let me guess. You’re using A2Billing on FreePBX – I don’t know how TrixBox or AsteriskNOW work, but the concept is the same – and whenever you forward a phone to an outside number it doesn’t work. Callers get prompted with “Please enter the complete PIN number” instead of having the call completed.
Continue reading

FreePBX hangs at login 

Have you ever clicked on your FreePBX link, get prompted for a password, and then sit staring at your browser “connecting to…” your server forever? Restarting Apache doesn’t work, restarting MySQL doesn’t work, even restarting Asterisk doesn’t work. Meanwhile everything else is running just fine, but you need to restart the entire server before FreePBX starts working again.
Continue reading

Early History of Municipality of Maple Ridge with Port Hammond and Haney 

The valley of the Fraser River is the bed of an ancient arm of the sea which extended as far inland as Hope. It is to a large extent made up of alluvial deposits, according to Dr. Dawson. The Indians have a very ancient tradition which bears out in a legendary way this more scientific premise. They say that the receding of the sea from this district explains the presence of certain varieties of fish. From Lillooet Lake to the Fraser and from Lillooet River to the Stave River is the district of Maple Ridge, which as the name implies, is a shelf or table-land, declining at the two ends, that occurs in the rise of the land from the Fraser River towards the mountains in the far background. It is the neighboring [sic] Municipality to that of Coquitlam and shares most of the natural features of the latter, but having the advantage of lying considerably higher above the level of the river. Briefly, this is how this part came to be settled:
Continue reading

Cisco TAR file format 

I needed to upload the device manager HTML files to a Cisco switch separately because I was low on flash space. You can’t download the HTML separately from Cisco (at least not for the 2950 switch I was upgrading) so I had to make the TAR myself.

So I made up a TAR file with the usual tar -cf command and tried to load it, but got a checksum error:

Loading html.tar
PaxHeader/html (unknown file type)  -- ignored!
%Tar checksum error in ftp://1.2.3.4/html.tar

Turns out that Cisco requires and old format TAR file (compatible with V7 UNIX.) Create the archive with tar -cof and it will work out.

Using rrdtool with PHP 

The PHP interface to rrdtool hasn’t been updated in 5 years and appears to have been deprecated by the developer, who doesn’t provide any documentation for it. Fortunately, there’s no functionality in the extension, so it won’t go out of date as long as the rrdtool library on your system is up to date. I’ve managed to figure out the functions by looking at the source code and thought it might be helpful for someone.
Continue reading

Easy SVG grid 

I needed a grid in the background while I was debugging an SVG image I was creating, something like Photoshop’s transparency grid. Here’s what I did.

<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="400">
  <defs> 
    <pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse">
      <rect fill="black" x="0" y="0" width="10" height="10" opacity="0.1"/>
      <rect fill="white" x="10" y="0" width="10" height="10"/>
      <rect fill="black" x="10" y="10" width="10" height="10" opacity="0.1"/>
      <rect fill="white" x="0" y="10" width="10" height="10"/>
    </pattern>
  </defs>
  <rect fill="url(#grid)" x="0" y="0" width="100%" height="100%"/>
</svg>

“Actual” (apparently) English subtitles 

There are hundreds of lists online of “actual English subtitles” from Hong Kong action movies, but only a couple with the movie titles. That sort of thing bugs me, so here’s one more list on the internet that includes the movie titles. Of course, I haven’t seen these movies so the subtitles could still be made up. Who knows?

PHP 5.3 database connection problems 

My database scripts were all hanging after an upgrade from PHP 5.2.8 to 5.3.1 on Windows. Turns out it’s a problem with the new MySQLnd library that doesn’t like IPv6. You need to comment out the line in C:\Windows\system32\drivers\etc\hosts that resolves ::1 to localhost.

Thanks to Corey Gilmore for documenting it; I figure the more people get it online the quicker it will be for people to find it.

The New CBC Radio 3 

I often listen to CBC Radio 3 at work. Recently they updated their website; while it’s mostly a change for the better (yay, the player doesn’t stop updating!) there were a couple of things bugging me about it. With the old design, you always had access to the player and the main navigation, but now they stay at the top of the page. Not helpful when you’re scrolling through comments and whatnot.

So I wrote a Greasemonkey script that keeps the player and the left navigation bar in place. It also clears out the CBC header at the top, as well as the CBC Radio header that sits below that, for a cleaner page.

Continue reading