Eee PC Ubuntu WiFi On/Off

One of the minor issues I had since installing ubuntu on my eee pc was I couldn’t work out how to turn the wifi off. There’s a Fn+F2 key combo that works in xandros, but it didn’t work for me in ubuntu. I tried googling for the answer and got nowhere.

So, for google, to turn wifi off, I had to echo 0 > /proc/acpi/asus/wlan Turning it on is obviously echo 1 > /proc/acpi/asus/wlan

Another problem fixed (sort of), I wouldn’t mind fixing Fn+F2, but I’m happy enough with the echo for now.

Eee PC Greasemonkey Script

Inspired by Paul Fenwick’s entertaining talk on cleaning up the web at LCA (in other words, I ripped it off) I set out to make google reader more useable on the Eee.

But first, an invaluable Firefox plugin to have for the Eee is Nuke Anything Enhanced. It lets you right click on an object on a web page, and “nuke” it, make it disappear. The screen then rearranges itself using the space you just created. It gives you more reading room, and less clutter. It’s not gone for good, though, if you reload the page it will be back. It’s fine for one off things, but if it’s a page you’ll be opening frequently, like google reader in my case, you’ll want a permanent solution. Enter greasemonkey.

// ==UserScript==
// @name google reader for eee pc
// @namespace http://chesterton.id.au/
// @description Removes unnecessary elements
// @include http://*.google.com/reader/*
// ==/UserScript==

hideContent('selectors-box');
hideContent('gbar');
hideContent('logo');
hideContent('global-info');

function hideContent(id) {
   var node = document.getElementById(id);
   if (node) {
     node.style.display = "none";
   }
}

So I ripped hideContent off from Paul, I found with google reader removing the object broke the page, but hiding it worked, so I modified his function a little. I think his was called removeContent, or similar, and deleted rather than setting the display style to none.

Save the code as (eg) googlereader.user.js and open it in firefox. The .user.js part of the file name is important, the first part isn’t. Obviously you need to install greasemonkey, too.

Google Reader Greasemonkey Script

My Telephone Setup

I thought I’d document my current phone setup, probably look back in 10 years time and think how primitive it was. The brains of it are handled by freeswitch, I luurv freeswitch ;), running on a little VM with 128M of memory, and a few gigs of disk.

My internet provider is iinet, I get 10Mbps down and 1Mbps up. My VOIP provider is pennytel, chosen for their price. $5/month, includes $4 of free calls, it’s 8c a call untimed for Australia and about 20 other countries. Mobiles are 10.5c/minute billed by the second. They have a fax to email service for another $5/month, but no email to fax. So I can’t throw away the fax machine just yet. There’s a few other handy services they offer that I use, they come with the plan.

I was willing to pay extra and go with iinet’s VOIP for the reason of being closer network wise, and unshaped if I exceed my monthly download limit. But iinet only lets you use their VOIP from the iinet network, not sure why that would be, but I ruled them out based on that. Pennytel has the disadvantage of being further away network wise, and affected by shaping, so my phone doesn’t work from home if I get shaped. But it works wherever I am on the planet, assuming I can get a fairly consistent trip time. (I could be in America, and take and make calls from my Australian VOIP number)

My VOIP phone is a nokia E65 with WiFi and SIP. Dial a number, and it goes via SIP if it’s available, otherwise it uses the mobile network. Wifi drains the battery, but I’ve gotten used to charging it every other day, or whatever it is.

The only thing I haven’t tested much is QoS, I’ve recently adjusted it on my ADSL router, but there’s no real way of seeing if it works, other than experimenting. I’m considering putting the router in bridge mode, and using tc on linux. That’s going to require another network card, though.

I still have a landline, my fax machine is connected to it.

Phil Colbourn Writes About The Youtube Blackout

On 02/03/2008, at 10:30 AM, phil colbourn wrote:

Last week Pakistan Telecom was ordered by their government to block access to youtube. They did this by re-directing routes containing the youtube addresses to an internal dead-end. A mistake was made that advertised this to their peer and thus the remainder of the internet.

The IP range that was affected was 208.65.152.0/22. Pakistan added more specific routes for 208.65.153.0/24 which are a longer match and so take priority.

To see what happened go to this site and start the java applet.

http://bgplay.routeviews.org/bgplay/

To see how it should look enter this address: 208.65.152.0/22, yesterday’s date and todays date – don’t worry about the time fields.

The AS (autonomous system – roughly meaning a country or large ISP or large company) 36561 is where youtube packets should generally be sent. You can see all the lines from other domains leading to this AS for this address range.

Press the play button (a small triangle) to start the animation. You should see the links occasionally changing as changes are made or transmission links break or are fixed.

Now press the New Query button.

Then enter the address that poisoned BGP: 208.65.153.0/24, 23/2/2008 and 26/2/2008 – a period around the event.

Initially the page has no lines. This is because prior to the event, this route was not used. Just imaging all the links still go to AS 36561.

Press the Play button.

Over time you see the rouge Pakistan Telecom domain 17557 start to become the priority route for all youtube traffic until it seems to have all the routes. When the fault was fixed you can see the links moving back to AS 36561 where they should be.

Imagine how easy it is now to interrupt any domain or the whole internet? I think this risk will be fixed shortly.


Phil philcolbourn ;at; gmail.com

” Someone else has solved it and posted it on the internet for free ”

I Have A New Office

Just got a new office. An Eee PC (JB HiFi had them for $450), and a 3G wireless internet connection (5Gigs/month for $39/month). Not really sure how much time I’m going to get out of it with the usb wireless modem connected, I’ve been told the modem sucks the juice. Got a bit of experimenting to do with the battery, and to see if VoIP works.

Still running the default desktop, it looks fine to me, but I’ll be testing out other desktops like eeexubuntu. I was really surprised how quickly open office launched, the speed is impressive.

I’m looking forward to mornings with a coffee down the river.

Remotely Upgrading RHEL to Ubuntu

We were given a server to play with to do whatever we wanted, hosted in a US data centre. It was running RHEL 4.x, I could have worked with that, but it didn’t look like it was on a support contract, I wasn’t able to update it, anyway.

I thought about trying to convert it to centos, but realised it would be more fun to upgrade it to ubuntu gutsy.

Quick steps from memory

  1. swapoff -a
  2. mkfs.ext3 /dev/VolGroup00/LogVol01 (old swap)
  3. mount /dev/VolGroup00/LogVol01 /mnt
  4. wget debootstrap.deb (from gutsy)
  5. ar x debootstrap.deb
  6. tar -C / -xzf data.tar.gz
  7. debootstrap –arch=i386 gutsy /mnt
  8. chroot /mnt
  9. mount proc, edit /etc/fstab and /etc/network/interfaces
  10. apt-get install ubuntu-minimal ubuntu-standard linux-image postfix openssh-server plus a few other packages, some that were recommends.
  11. copied gutsy /boot/* to the real /boot and created a new entry in menu.lst
  12. created an account and uploaded some ssh keys
  13. probably some steps I’ve forgotten
  14. reboot

Easy peasy, just waiting for it to come up, it’s been 5 hours now, still waiting. Must be the slowest booting server ever.

Guess I’ll be calling the states now. :’(

FreeSWITCH – Google Talk – Dingaling – Jingle All The Way

I got freeswitch working with google talk. There were a few bugs in mod_dingaling that were causing segfaults, they’re fixed in the latest update.

I called from gtalk on my XP vm to my e65 via SIP, audio is working. I commented out the line <param name=”ext-rtp-ip” value=”$${external_rtp_ip}”/> from conf/jingle_profiles/client.xml .

To make calls from the SIP e65 to google talk users, I added to the dialplan conf/dialplan/default.xml

<extension name=”sip2jingle”>
  <condition field=”source” expression=”mod_sofia”/>
  <condition field=”destination_number” expression=”^gmail\+([^\@]+)\@?(.*)$”>
    <action application=”bridge” data=”dingaling/gmail.com/$1@gmail.com”/>
  </condition>
</extension>

Then from the e65 I dial gmail+user@switch.gruntnet .

See FreeSWITCH and Google Talk for the rest of the setup.

I still need to do more testing, and understand how it traverses through the NAT firewall before I give out my google talk address to people. Did I mention the I love freeswitch?

Train Spotting

After high school, I landed a job in the railways as an apprentice telecommunications technician where I worked with rob for 10 years or so. It was a fairly rich environment to work in, with pretty much every telecommunications technology accounted for, with training on the lot. Opportunities to move around, and stay fresh.

Perhaps it’s no surprise, but there are a lot of train nuts in the railways, and rob was one of them. Growing up watching freight trains go past his front yard in Queensland planted the seed, getting a job in the railways didn’t help. On his wedding day, he got up early and with his best man, went photographing trains.

He has started a train site http://www.robertstrains.net. It’s not complete, but if you’re into trains or photography, you’ll find something of interest there.

Be warned, although rob has a good eye for photography, being published in multiple magazines, his web designing skills are interesting. I think rob has used every feature and widget available in the software he’s using. ;)

Oh, it’s 01/01/08, so Merry Easter.

FreeSWITCH and Google Talk

One of the reasons I chose to spend time with freeswitch over yate was google talk integration. Was a good choice, I think, for more than just gtalk.

The endpoint that talks to gtalk is mod_dingaling, and it’s not compiled by default. So to enable it, uncomment #endpoints/mod_dingaling from modules.conf in your source tree and recompile.

I had to install gnutls-devel to get gtalk working, but check freeswitch.spec for other build packages you might need.

The configuration is pretty straight forward. Make sure in conf/autoload_configs/modules.conf.xml mod_dingaling is loaded.

I set it up as a client, I think later I might play around with it as a server. My conf/jingle_profiles/client.xml looks like this:

<include>
  <!– Client Profile (Original mode) –>
  <profile type=”client”>
    <param name=”name” value=”gmail.com”/>
    <param name=”login” value=”michael.chesterton@gmail.com/gtalk”/>
    <param name=”password” value=”bellybutton”/>
    <param name=”server” value=”talk.google.com”/>
    <param name=”dialplan” value=”XML”/>
    <param name=”context” value=”public”/>
    <param name=”message” value=”Press Belly Button to Begin”/>
    <param name=”rtp-ip” value=”$${bind_server_ip}”/>
    <param name=”ext-rtp-ip” value=”$${external_rtp_ip}”/>
    <param name=”auto-login” value=”true”/>
    <!– SASL “plain” or “md5″ –>
    <param name=”sasl” value=”plain”/>
    <!– if the server where the jabber is hosted is not the same as the one in the jid –>
    <!–<param name=”server” value=”alternate.server.com”/>–>
    <!– Enable TLS or not –>
    <param name=”tls” value=”true”/>
    <!– disable to trade async for more calls –>
    <param name=”use-rtp-timer” value=”true”/>
    <!– default extension (if one cannot be determined) –>
    <param name=”exten” value=”5551212″/>
    <!– VAD choose one –>
    <!– <param name=”vad” value=”in”/> –>
    <!– <param name=”vad” value=”out”/> –>
    <param name=”vad” value=”both”/>
    <!–<param name=”avatar” value=”/path/to/tiny.jpg”/>–>
  </profile>
</include>

When editing conf/jingle_profiles/client.xml, pay attention to the line   <profile type=”client”> make sure it’s profile , and not x-profile. It comes as x-profile out of the box to stop it from loading. 5551212 is the phone gtalk calls will go to as defined by exten

One other thing is do is add a vcard to your directory entry, I added it to conf/directory/default/1000.xml and directory/default/5551212.xml, mine looks like:

<include>
  <user id=”1000″ mailbox=”1000″>
    <params>
      <param name=”password” value=”1234″/>
      <param name=”vm-password” value=”1234″/>
       <param name=”vm-mailto” value=”chesty@chesterton.id.au”/>
<!–
       <param name=”vm-email-all-messages” value=”true”/>
–>
    </params>
    <variables>
      <variable name=”user_context” value=”default”/>
      <variable name=”ruleset” value=”internal” />
      <variable name=”effective_caller_id_name” value=”Michael Chesterton”/>
      <variable name=”effective_caller_id_number” value=”1000″/>
    </variables>
    <vcard xmlns=’vcard-temp’>
      <FN>Michael Chesterton</FN>
      <N>
        <FAMILY>Chesterton</FAMILY>
        <GIVEN>Michael</GIVEN>
        <MIDDLE/>
      </N>
      <NICKNAME>Michael</NICKNAME>
      <URL>http://barrang.com.au/</URL>
      <BDAY>1974-11-21</BDAY>
      <ORG>
        <ORGNAME>Barrang</ORGNAME>
        <ORGUNIT>Barrang</ORGUNIT>
      </ORG>
      <TITLE>Owner</TITLE>
      <ROLE>Engineer</ROLE>
      <TEL><WORK/><VOICE/><NUMBER>5551212</NUMBER></TEL>
      <TEL><WORK/><CELL/><NUMBER>614205555</NUMBER></TEL>
      <TEL><WORK/><FAX/><NUMBER/></TEL>
      <TEL><WORK/><MSG/><NUMBER/></TEL>
      <ADR>
        <WORK/>
        <EXTADD/>
        <STREET/>
        <LOCALITY>Panania</LOCALITY>
        <REGION>NSW</REGION>
        <PCODE>2213</PCODE>
        <CTRY>Australia</CTRY>
      </ADR>
      <TEL><HOME/><VOICE/><NUMBER/></TEL>
      <TEL><HOME/><FAX/><NUMBER/></TEL>
      <TEL><HOME/><MSG/><NUMBER/></TEL>
      <ADR>
        <HOME/>
        <EXTADD/>
        <STREET/>
        <LOCALITY/>
        <REGION/>
        <PCODE/>
        <CTRY/>
      </ADR>
      <EMAIL><INTERNET/><PREF/><USERID>michael.chesterton@barrang.com.au</USERID></EMAIL>
      <JABBERID>michael.chesterton@gmail.com</JABBERID>
      <DESC>
        More information about me is located on my
        personal website: http://barrang.com.au/
      </DESC>
    </vcard>
  </user>
</include>

That will get you signed in to gtalk ready to receive and make calls. Now we need a dialplan to direct gtalk calls to a SIP phone. Part of my conf/dialplan/public.xml looks like:

<extension name=”public_did”>
  <condition field=”caller_id_number” expression=”^([^@]+)” break=”never”>
    <action application=”set” data=”effective_caller_id_number=$1″/>
  </condition>
  <condition field=”destination_number” expression=”^(5551212)$”>
    <action application=”set” data=”call_timeout=18″/>
    <action application=”set” data=”continue_on_fail=true”/>
    <action application=”set” data=”hangup_after_bridge=true”/>
    <action application=”bridge” data=”sofia/switch.gruntnet/1000,sofia/switch.gruntnet/1001″/>
    <action application=”answer”/>
    <action application=”voicemail” data=”default $${domain} 1000″/>
  </condition>
</extension>

The first condition field strips out the @ character from the caller id number, my e65 doesn’t like the @ character and rejects the call. Gtalk sets the caller id number as something like barrang.com@gmail.com/Talk.v1047F0FC7A5. The rest I’ve already talked about here

I’ve only tested setting up a call from an XP vm to my SIP enabled mobile phone, I haven’t tested audio yet. But I’m getting there, I’m waiting for a friend to install gtalk so they can test with me. Then I just need a dialplan entry so I can make gtalk calls from SIP clients.

FreeSWITCH and Voicemail

I updated my FreeSWITCH svn tree the other day and was surprised how much had changed. The configuration structure was completely rearranged. I had to start from scratch. Lots of new goodies, though.

My VoIP provider has their own voicemail system that kicks in after 20 seconds, there doesn’t appear to be a way to turn it off. I want to use my own voicemail using FreeSWITCH, so I’ve got to answer the call before 20 seconds are up.

First thing I needed was some sounds. There’s some prerecorded sounds available via make sounds-install, except it doesn’t work in trunk at the moment. They are easily downloaded manually, though. I chose http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.pre3.tar.gz and http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.pre3.tar.gz

Unpack the files in /usr/local/freeswitch/sounds/. I found that FreeSwitch was looking for the sounds in (for example) /usr/local/freeswitch/sounds/en/us/callie/voicemail/ but the sounds unpacked to en/us/callie/voicemail/8000/. So I went through every 8000/ directory and moved the sound files to the parent.

Check in conf/autoload_configs/modules.conf.xml that mod_voicemail is being loaded. There’s a few things to edit in conf/autoload_configs/voicemail.conf.xml, the main one being the storage-dir. I created a directory /usr/local/freeswitch/vm and set <param name=”storage-dir” value=”/usr/local/freeswitch/vm”/>. The only other thing that really needs setting is email-from. I haven’t setup email yet.

Now we just need a dialplan to send unanswered calls to voicemail

<extension name=”public_did”>
  <condition field=”destination_number” expression=”^(5551212)$”>
    <action application=”set” data=”call_timeout=18″/>
    <action application=”set” data=”continue_on_fail=true”/>
    <action application=”set” data=”hangup_after_bridge=true”/>
    <action application=”bridge” data=”sofia/switch.gruntnet/1000,sofia/switch.gruntnet/1001″/>
    <action application=”answer”/>
    <action application=”voicemail” data=”default $${domain} 1000″/>
  </condition>
</extension>

In this plan, when someone calls 5551212 (that’s the number my VoIP provider sends calls to) we set the timeout to 18 seconds, so if it’s not answered before then, it goes to voicemail.

continue_on_fail means if the bridge fails for whatever reason, one being no one answered it, continue processing the rest of the plan so the call goes to voicemail.

hangup_after_bridge means if someone answered the phone within the 18 seconds, then stop processing the rest of the plan when the call terminates, ie, don’t send it to voicemail.

I’m sending the call to two phones in parallel, 1000 and 1001. If neither of them pickup the call, FreeSWITCH answers the call, and launches the voicemail application, sending the call to voicemail box 1000

I commented out <param name=”vm-email-all-messages” value=”true”/> in conf/directory/default/1000.xml because I haven’t setup email yet. Plus if you do enable that option, the messages aren’t saved on FreeSWITCH, they get emailed and deleted.

The only other thing left to do is call 1000 from 1000 to access voicemail, and setup a greeting

Annoyingly my Nokia E65 doesn’t appear to subscribe to new message notification. So I’m going to have to setup some sort of email/sms solution later to alert me of new messages