Guilty Pleasures

Perhaps yet another misleading title for this post, but bear with me. When I was a child we used to play outside a lot. I always remember the neighbours complaining if we made too much noise. Such is life. There was one period of time that I knew I would get in trouble though. We would get told off big time!! When?? Every day between 2 and 4 in the afternoon. There was even a sign in big red letters telling us all to keep quiet at ‘rest time’ (loosely translated). There was no sign about making noise after 11pm, but there was one for the afternoon nap. It was THAT important.

These days seem long gone now. Does anybody have time for an afternoon nap?? I certainly don’t recall seeing any such signs around.

I just LOVE an afternoon nap. It’s one of modern life’s guiltiest pleasures. You just know you have things to do, and you’re not supposed to just switch off, but you slip into bed, close the door, pull the blinds down, and even 30 minutes get you feeling like a whole new person. Oh the pure joy.



Alas, even with no kids playing around (do kids play outside anyway??), there is always an odd telephone call to wake you up and make you feel even worse (either from guilt or just for being woken up). This can also happen in the morning. Well, for some people it’s late morning or even early afternoon, but I do like to stay in bed late and have a good lie-in.

So what’s the problem?? I can easily unplug my phones. Well, it’s a no brainer with the mobile. The only time it’s switched off is when I’m asleep anyway. But the landline?? I don’t get many people to call me at home these days, but particularly if my mobile is switched off, people (my mum is the worst offender) will make an effort and check that I’m alive. I know I can unplug it, and on my fancy Asterisk box I can even set it to Do Not Disturb by simply calling *78. But I usually forget about it, or forget to plug it in again, and frankly it’s a hassle.



What I want to do is switch the ringing off as soon as I switch off my mobile phone. Have those two aware of each other somehow. How??

Well, this is not a solution for everybody, but it works for me. The idea was taken from Nerd Vittles but modified for my needs and even improved it. No need to install bluetooth software on my Asterisk box. I already have it on my Ubuntu at home. Most bluetooth dongles are pretty much plug&play these days with most Linux desktop distros.

Who is this solution for? or what do you need?

  • Asterisk – the best open source VOIP system
  • ssh access to your asterisk (with ssh keys to avoid password prompts)
  • Voip Phone
  • bluetooth enabled on your home Linux box (mine is Ubuntu 8.04)
  • Blueproximity
  • A bluetooth enabled mobile phone

So what’s going on and how??

If you’re familiar with Asterisk, ssh and some basic scripting, you’ll have no problems following it. I’m not going to spell out each step, but feel free to ask if you need.

The idea is very simple. Blueproximity is meant to be used to lock/unlock your PC when you’re close or far from it, based on signal from your bluetooth phone. It’s extensible enough to launch any script you choose, so I simply configured it so when I’m at home – my bluetooth phone is within a reasonable proximity – it launches a script to enable my home phone to ring. When I’m out of reach (mobile or bluetooth is off) – it automatically redirects calls to my home phone to my voicemail.

Nerd Vittles‘s set-up was to forward calls to your mobile. You can do that too. However, the biggest downsides of this solution is that you need the bluetooth installed on your Asterisk server. Mine is hosted in Germany, so just a little too far to detect my mobile’s bluetooth signal.

My desktop however, is more than capable to cover the entire flat.

So I created a little script on my remote Asterisk box which changes the dialplan to either forward direct to voicemail, or to my home extension:

#!/bin/sh

# DND On - Do Not Disturb

asterisk -rx "dialplan add extension 1234,1,Voicemail(u1234@default) into inbound replace"
#!/bin/sh

# DND Off - Ring my phone

asterisk -rx "dialplan add extension 1234,1,Dial(SIP/1234,20,trj) into inbound replace"

I then created two matching scripts on my home desktop which simply call those scripts remotely:

#!/bin/sh

ssh my.asterisk.box "dnd-on"
#!/bin/sh

ssh my.asterisk.box "dnd-off"

I obviously use ssh keys to authenticate to my asterisk box without a password.

Now all is left is to set up Blueproximity to launch those scripts instead of the default gnome-screensaver-command

I set the lock proximity in Blueproximity to the max and the unlock to slightly lower.

All I have to do to have some quiet time and enjoy my guilty pleasure is simply switch off my mobile.

Leave a Reply

css.php