Asterisk

Proximity Checking and ZyXEL lameness

[index] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

Intelligent Call Routing (22-Oct-2004)

As I'd mentioned earlier, one of the main functions that interested me in working with Asterisk was to be able to have people dial a single phone number to reach me and to have that one number ring simultaneously in a variety of locations. I was eager to have a single number that could ring me at home at my desk or on my mobile.

In practice I've found this to be invaluable. I no longer have to pay $6 a month to the phone company for call forwarding and I no longer have to manually enable forwarding when I leave the house and then remember to disable it when I get home. When someone calls it just automagically rings both my mobile and my desk phone. It rocks.

But in practice I've also found this to be a bit lame and annoying. Most of the time I'm not out running errands -- Most of the time I am home and there's no need to ring my mobile. In fact, even worse, when people would call I'd answer my desk phone and we'd both be treated to 5 or 6 seconds of listening to my mobile phone ring in the background while the voicepulse call timed out. It was noisy and distracting and it didn't take long before I was motivated to find a better solution.

On my work Asterisk box I played nice tricks with the "is channel available" function to rollover SIP calls to land lines for my cow-orkers. They generally run their SIP client software and then shut it down (or their entire machine) when they're not sitting at the computer. This makes call routing quite painless. If their SIP client is connected, send the call there, if not send it to their mobile or voice line.

But my SIP client is a Cisco 7960. It's always on. I had no interest in using a manual "I'm here / I'm away" context switch but I wanted some way for Asterisk to know if I was home or not before it chose the call path. Enter Bluetooth: my mobile phone advertises itself via bluetooth! I decided to use it for automatic presence detection.

I spent the day today figuring out Bluetooth on Linux. (Linux is poo). It required buying new hardware because I was never able to get my iogear usb bluetooth dongle to work right. I picked up a nice Linksys bluetooth dongle that has a nice, big antenna on it. With it, I can run "hciscan" and detect the presence of my mobile phone, which is visible and advertises itself over bluetooth.

I wrote a little AGI script for Asterisk that does a scan for my mobile's bluetooth address. If my mobile phone is in range the dialplan doesn't include it in the call. If my mobile is not in range, the call includes the mobile number. Works like a charm. Calls follow me off-site but I don't burden my ears or my voicepulse account with calls to the mobile when I'm sitting at home. As a slacker I am completely in favor of automation that doesn't require me to change my habits. This is a far superior solution compared to a manual "home/away" switch that I'd have to maintain.

Every five minutes in cron I run this script, which looks for a link to my phone. If no such link exists, then it attempts to establish one:

#!/bin/sh

/usr/bin/hcitool con | grep -q "00:0A:D9:59:DA:34" \
 || (hcitool scan | grep "00:0A:D9:59:DA:34" && hcitool cc 00:0A:D9:59:DA:34 )

My extension dialplan is as follows:

exten => 201,1,AGI(nugget-home.agi)
exten => 201,2,GotoIf($[${nuggethome} = yes]?5)
exten => 201,3,Macro(extension,${NUGGETDESK}&${HOUSE}&${NUGGETMOBILE})
exten => 201,4,Hangup()
exten => 201,5,Macro(extension,${NUGGETDESK}&${HOUSE})
exten => 201,6,Hangup()

This is calling the nugget-home.agi script which is literally one line:

#!/bin/sh
hcitool con | grep -q "00:0A:D9:59:DA:34" \
   && echo "SET VARIABLE nuggethome yes \"\"\n" \
   || echo "SET VARIABLE nuggethome no \"\"\n"

It's magic!

ZyXEL phone is not working out very well

I'm less and less happy with the ZyXEL phone as time goes on. I turned on "qualify=500" for its sip account and now my asterisk logs are full of this crap:

Oct 23 02:27:09 NOTICE[245775]: chan_sip.c:6609 handle_response: Peer 'zyxel' is now TOO LAGGED!
Oct 23 02:27:31 NOTICE[245775]: chan_sip.c:6603 handle_response: Peer 'zyxel' is now REACHABLE!
Oct 23 02:28:31 NOTICE[245775]: chan_sip.c:6609 handle_response: Peer 'zyxel' is now TOO LAGGED!
Oct 23 02:28:41 NOTICE[245775]: chan_sip.c:6603 handle_response: Peer 'zyxel' is now REACHABLE!
Oct 23 02:31:43 NOTICE[245775]: chan_sip.c:6609 handle_response: Peer 'zyxel' is now TOO LAGGED!
Oct 23 02:31:53 NOTICE[245775]: chan_sip.c:6603 handle_response: Peer 'zyxel' is now REACHABLE!
Oct 23 02:33:54 NOTICE[245775]: chan_sip.c:6609 handle_response: Peer 'zyxel' is now TOO LAGGED!
Oct 23 02:34:15 NOTICE[245775]: chan_sip.c:6603 handle_response: Peer 'zyxel' is now REACHABLE!
Oct 23 02:37:17 NOTICE[245775]: chan_sip.c:6609 handle_response: Peer 'zyxel' is now TOO LAGGED!
Oct 23 02:37:27 NOTICE[245775]: chan_sip.c:6603 handle_response: Peer 'zyxel' is now REACHABLE!
Oct 23 02:39:28 NOTICE[245775]: chan_sip.c:6609 handle_response: Peer 'zyxel' is now TOO LAGGED!
Oct 23 02:39:38 NOTICE[245775]: chan_sip.c:6603 handle_response: Peer 'zyxel' is now REACHABLE!

The phone is not proving to be very usable. It's slow and unreliable. I am finding it far nicer to use my pots-line cordless which is connected to an FXS port on my TDM400P.

Next: Why does URL-based dialing seem like the forgotten feature?

contacts comments