Replacing a failed zpool ZFS drive

We have a Sun X4500 ‘Thumper’ that recently had a failed drive. Our zpools are all raidz2 with 4 spares. We were getting errors on the disk c1t5d0, although the drive hadn’t failed completely.

As we had not yet tested replacing a ‘live’ drive the disk was pulled from the system before running any commands to remove it from the pool.

You can run the following command to see the status of your pools –

zpool status

Continue reading

Using callwithus with Asterisk, FreePBX and A2Billing

The instructions below assume that you have got Asterisk, FreePBX and A2Billing installed and working together.

Below are the first steps in setting up a callwithis DID number and passing the call through to A2Billing. This number can then be used as an access number for your calling card clients.

Once you’ve signed up for your callwithus account and purchased your DID number the next thing you want to do is modify how your DID number gets presented to your Asterisk box so you can route it to a2billing.

On the callwithus website, click on DID on the left hand menu and then locate the DID number you want to use and click ‘edit’. Now under ‘DESTINATION’ add ‘/yourdidnumber’ the the end of ‘SIP/youraccountnumber’

This will cause callwithus to append your DID to the call details when it is passed through to your Asterisk server. See the image to the right for details.  




Next we want to go into FreePBX and register A2Billing as a ‘Custom Destination’.

If you don’t have the ‘Custom Destination’ menu in FreePBX you will need to go to the modules menu option and install the ‘Custom Applications’ module.
Enter ‘a2billing’ as the Description and ‘custom-a2billing,${EXTEN},1’ as the custom destination



Now we want to configure our callwithus trunk.




Configure your trunk as in the images here, obviously using your username and password. More information on how to setup your trunk can be found on the callwithus website here.




Now we just need to configure our inbound route. This inbound route decides what happens to a call when it is presented to your Asterisk server. Give it a meaningful description and then in the ‘DID Number’ box enter your callwithus DID in the same format you used in step one above.

Scroll down to the bottom of the configuration page and you should see the ‘a2billing’ ‘Custom Application’ that you setup earlier. Select this and then click on Submit. Don’t forget to click on ‘Apply Configuration’ at the top of the FreePBX page to get Asterisk to read your changes.


And that’s it for now. If you call your callwithus DID it should come to your Asterisk box and then be passed to a2billing. Depending on how you’ve got a2billing configured will determine what happens to that call now.

I’ll discuss in a later post some ideas about how to configure a2billing

Rhapsody, Ubuntu and Firefox 3

If you’re having trouble logging in to the Rhapsody website and you are running Firefox 3 on Ubuntu (or possibly other flavours of Unix) then the following might be useful.

If, every time you try to log in to the Rhapsody website, you are asked to install the Firefox plugin, even after apparently installing it, then the plugin is not getting installed correctly.

To install the plugin manually try –

Start a shell prompt

cd .mozilla/plugins/
unzip RhapsodyPlayerEngine_Inst_Linux.xpi

Then restart Firefox.

Hopefully, now you should be presented with a username/password box when you try to log in rather than the plugin install prompt.

Delicious bookmarks disappear

I really like the delicious plugin for firefox (this is being discontinued – see here for alternative – and have been recommending it to people for a while now.

Recently though using the plugin with firefox 3 on both Windows and Linux (Ubuntu) has been a real pain. “Favorite Tags”  and “Tag Bundles” have been disappearing and losing their settings. This has been going on for a few weeks now and the developers have been working hard on resolving the problem, which turned out to be a corruption in one of the settings files.

They have released a beta fix for this problem, which you currently have to sign up to a Yahoo group to download. Details of the problem and how to obtain the patch can be found here.

Hopefully they will release a mainstream version of this patch soon!

Blackberry/Google calendar only synching "Default Calendar"

I love my new Blackberry Curve! I had a small problem setting up the Google Calendar Sync and thought this might help someone else.

I had no problem installing the software from – just point your Blackberry web browser at that URL.

However, when I logged in and tried to sync my calendars (I have 5 different calendars setup) I only saw “Default Calendar” listed under “My Calendars”.

It turns out this was because I was logging in to Google Sync using a secondary e-mail address I have assigned to my Gmail account (ie I was logging into Google Sync using [email protected] rather than [email protected])

When I logged in to Google Sync using my Gmail username ([email protected]) all of my calendars were listed under options after the initial sync.

Encrypting traffic with a VPN

Dan Goodin has written an interesting article for about the benefits of using a personal VPN for your wireless internet traffic.

There are some downsides to running a VPN server at home. One of these is that all of your data must travel via your home PC/server and most peoples broadband connections will limit the speed that this will work at. The maximum speed of your VPN connection will be limited by the upload speed of your home broadband – which is normally quite slow. Also, dynamic IP addresses, port forwarding and NAT on your broadband router and having to leave your home PC powered on all the time could be a pain.

Another alternative could be to run OpenVPN on your own server (or vps) at a data center or, a cheaper alternative, to buy access to an OpenVPN server that has already been setup and configured.

Running OpenVPN

I’ve been playing with OpenVPN for the past couple of weeks and I’m pretty impressed. OpenVPN allows you to create a private network between 2 computers. These could be 2 servers or a client and a server. A few of the reasons for wanting to do this are –

  • bypassing your ISPs traffic shaping
  • making your traffic appear to originate from a different country
  • encrypting your laptop traffic over an insecure link – such as a coffee shop wifi connection
  • anonymous web surfing
  • bypassing a countries web access controls

Setup and configuration of the server component can be fairly complicated depending how you want to manage the certificates and networking on there. It’s possible to install it on Linux or Windows although I’ve only tested it on Linux. Running the server on Linux you also need to configure iptables to translate your private ‘vpn’ ip address to an external ip address on the vpn server.

Continue reading

ffmpeg and streaming video

I’ve been interested in trying to stream some of my videos from my server rather than from YouTube. YouTube is great but the video quality is pretty poor.

I’m running CentOS 5.2 and decided to just try installing ffmpeg from rpmforge rather than compiling it. Lazy but easy!

rpmforge is a repository where you can find lots of prebuilt packages that are not part of a standard Redhat/CentOS install. You can find instructions for setting it up here.

So, with rpmforge configured, this was all I needed

# yum install ffmpeg

Then I looked round for a player to stream the video (which were going to be in flash format). Flowplayer looked pretty nice. I just wanted something simple that would have only the video and controls on the page.

After looking over the sample html pages that come with flowplayer it was easy to create a page with just the video on there. So I uploaded my videos which were in mpg format.

Running the command

# ffmpeg -i video.mpg -s 320x288 -b1200000 -ar 44100 video.flv

converted the video to flash format with a pretty high quality but without making the files too large. I’m sure I could probably find better settings if I played around a bit more.

And here some examples of the end result –

Just out of interest – the aircraft is a Pegasus Quantum 582 which you can see a picture of here.

I no longer own it and and miss the summer evenings flying around the english countryside.

iptables for asterisk

If you’re running Asterisk on a VPS or a dedicated server then setting up your iptables firewall can be a tricky.

I thought I’d post my firewall script to help get you started. I save this script as /usr/local/bin/ and then add a line to run it from /etc/rc.local

It allows SSH’ing to the machine plus rules required for SIP connections (you will need other rules if you use IAX) plus some basic “bad stuff” filtering.

I’ve commented it so, hopefully, you’ll be able to figure out and chages you need.

Continue reading