Asterisk - the open source soft PBX (PPC)

Abstract
The idea for this concept came from a bluetooth cordless cellphone extender that I saw at someone's house like this one: Bluetooth to Cordless Phone. Sometime later, I read about chan_mobile which is an Asterisk channel driver that allows you to use a bluetooth capable cell phone as an FXS channel. Asterisk will accept a ATA that you could "open" from VOIP phone service such as Vonage as an FXO channel.

Well that was enough to get me started, so I implemented this solution first on an Ubuntu box. I'm still working on getting it fully implemented on a PPC linkstation. Bluetooth audio (SCO) has been the sticking point, but I'm confident that kernel 2.6.28+ will be the answer.

This would allow you to use a Linkstation running Asterisk in order to turn a cellphone into a trunk for 1 or more SIP Phones or ATAs. Asterisk is pretty powerful and would allow you to integrate POTS/PSTN lines (with a FXO/FXS adapter like the SPA3102), a VOIP service (such as Vonage), and now a Cell Phone too!

Prerequisites
This article assumes that you have installed FreeLink on PPC Box that has been U-booted. You also will need to upgrade to a 2.6.28+ Kernel, (the bluetooth SCO audio driver doesn't seem to work right otherwise).

In order to implement this on a ARM box you would need to cross compile asterisk, as it will not natively compile on this architecture. Your results may vary with MIPSel, but this article might be a good starting point: Asterisk - the open source soft PBX (MIPSel)

Install various pre-requisite libraries
apt-get install make apt-get install gcc apt-get install g++ apt-get install libc-dev apt-get install bison apt-get install ncurses-dev apt-get install libssl-dev apt-get install libnewt-dev apt-get install zlib1g-dev apt-get install initrd-tools apt-get install cvs apt-get install procps apt-get install doxygen apt-get install adduser apt-get install libasound2 apt-get install libc-client2007b apt-get install libc6 apt-get install libcap2 apt-get install libcurl3 apt-get install libgcc1 apt-get install libgsm1 apt-get install libncurses5 apt-get install libnewt0.52 apt-get install libogg0 apt-get install libpopt0 apt-get install libpri1.0 apt-get install libradiusclient-ng2 apt-get install libsnmp15 apt-get install libspeex1 apt-get install libspeexdsp1 apt-get install libsqlite0 apt-get install libssl0.9.8 apt-get install libstdc++6 apt-get install libtonezone1 apt-get install libunwind7 apt-get install libvorbis0a apt-get install libvorbisenc2 apt-get install libvpb0 apt-get install unixodbc apt-get install zlib1g apt-get install bluetooth bluez-utils libbluetooth2 libbluetooth2-dev

Get Asterisk package
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.6.0.6.tar.gz tar xvzf asterisk-1.6.0.6.tar.gz  cd asterisk-1.6.0.6

Complete Asterisk Installation
./configure

If you see asterisk symbol in the end, configuration is successful. Else, grep for “no” in config.log and try to install those missing libraries/utilities.

make make install make samples make progdocs

Install Asterisk Addons and chan_mobile
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-addons-1.6.0.tar.gz tar zxvf asterisk-addons-1.6.0.tar.gz cd /usr/src/asterisk/asterisk-addons-1.6.0 ./configure make menuselect Choose chan_mobile press x to exit make As root user make install

Bluetooth settings and pairing
edit /etc/bluetooth/hcid.conf and replace the contents with:

options { autoinit yes; security auto; pairing multi; passkey "1234"; }# Default settings for HCI devices device { name "Asterisk PBX"; class 0x000100; iscan enable; pscan enable; lm accept; lp rswitch,hold,sniff,park; }

Restart bluetooth

/etc/init.d/bluetooth restart

Makre sure bluetooth works and get MAC address for bluetooth adapter

hcitool dev

You should see something like this:

Devices: hci0 00:16:38:39:44:88

Copy the hardware address from the output of the following command for the next step. (eg. xx:xx:xx:xx:xx:xx). Use this address for /etc/asterisk/mobile.conf

Pair your cellphone with your "asterisk box"
dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.SetMode string:discoverable


 * 1) Grab your cell phone, turn Bluetooth on and search for devices.
 * 2) You should find your PBX as Asterisk PBX.
 * 3) Pair with a pin of 1234.
 * 4) Make your phone discoverable via Bluetooth.

+ hcitool scan

You should see something like this:

hcitool scan Scanning ... 00:1B:XX:XX:XX:XX Someones iPhone

If you see your phone above all is well and we can now search for your bluetooth devices using the CLI command 'mobile search'. Be patient with this command as it will take 8 - 10 seconds to do the discovery.

First start the asterisk console

asterisk –r

In the console type in the command mobile search

asterisk*CLI> mobile search

This will return something like the following:

Address Name Usable Type Port 00:1B:XX:XX:XX:XX Someones iPhone Yes Phone 8

This is a list of all bluetooth devices seen and whether or not they are usable with chan_mobile.


 * 1) The Address field contains the 'bd address' of the device. This is like an ethernet mac address.
 * 2) The Name field is whatever is configured into the device as its name.
 * 3) The Usable field tells you whether or not the device supports the Bluetooth Handsfree Profile or Headset profile.
 * 4) The Type field tells you whether the device is usable as a Phone line (FXO) or a headset (FXS).
 * 5) The Port field is the number to put in the configuration file: /etc/asterisk/mobile.conf.

Configuration Files
To be done

mobile.conf
Choose which device(s) you want to use and edit /etc/asterisk/mobile.conf, For a phone create a stanza like the one below and paste:
 * 1) The MAC address on the address line
 * 2) The port that was displayed during the mobile search.
 * 3) The 'id' of the device [bitinbrackets] can be anything you like, just make the unique.

[general] interval=30		; Number of seconds between trying to connect to devices. [adapter] id=blue address=XX:XX:XX:XX:XX:XX [iphone] address=00:1B:XX:XX:XX:XX	; the address of the phone port=8				; the rfcomm port number (from mobile search) context=from-mobile		; dialplan context for incoming calls adapter=blue			; adapter to use group=1				; this phone is in channel group 1
 * The following is a list of adapters we use.
 * id must be unique and address is the bdaddr of the adapter from hciconfig.
 * Each adapter may only have one device (headset or phone) connected at a time.
 * Add an [adapter] entry for each adapter you have.
 * forcemaster=yes	; attempt to force adapter into master mode. default is no.
 * alignmentdetection=yes ; enable this if you sometimes get 'white noise' on asterisk side of the call
 * its a bug in the bluetooth adapter firmware, enabling this will compensate for it.
 * default is no.
 * The following is a list of the devices we deal with.
 * Every device listed below will be available for calls in and out of Asterisk.
 * Each device needs an adapter=xxxx entry which determines which bluetooth adapter is used.
 * Use the CLI command 'mobile search' to discover devices.
 * Use the CLI command 'mobile show devices' to see device status.
 * To place a call out through a mobile phone use Dial(Mobile/[device]/NNN.....) or Dial(Mobile/gn/NNN......) in your dialplan.
 * To call a headset use Dial(Mobile/[device]).
 * nocallsetup=yes		; set this only if your phone reports that it supports call progress notification, but does not do it. Motorola L6 for example.