support

chan mobile

WARNING: chan_mobile is alpha code from Digium HEAD source. It is not part of Asterisk 1.4. Use at your own risk!

I’ve been playing around with chan_mobile from the Asterisk 1.6 branch and I have it working with Asterisk 1.4. For those of you who don’t know chan_mobile allows you to register a Bluetooth cell phone as a trunk. This offers all kinds of interesting possibilities. Including free calling to in network cell phones and a fully mobile trixbox. Like a PBX in a motor home.

1. First you need

  • - a clean install of trixbox 2.6
  • - a phone with Bluetooth support.
  • - a Bluetooth adapter for your trixbox (The D-Link DBT-120 works very well)

2. From the command line install the chan_mobile RPM.

yum -y --enablerepo=trixboxbeta install chan_mobile

3. Now let's be sure the system has found your Bluetooth adapter type:

[trixbox1.localdomain ~]# hcitool dev

You should see something like this:

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

4. Copy the mac address of your Bluetooth adapter from the output of the previous command for the next step.
(eg. xx:xx:xx:xx:xx:xx). Now edit /etc/asterisk/mobile.conf:

nano /etc/asterisk/mobile.conf

In the first [adapter] section where "id=blue" replace the mac address with the one you copied down.

5. Now let’s make your trixbox discoverable:

[trixbox1.localdomain ~]# dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.SetMode string:discoverable

6. On your cell phone, turn Bluetooth on and search for devices. You should find your PBX as trixbox. Pair with a pin of 1234.

7. Make your phone discoverable via Bluetooth.

8. Make sure we can see your phone. Use the command:

[trixbox1.localdomain ~]# hcitool scan

You should see something like this:

Scanning ...
00:1B:63:D5:3F:06 Bob's iPhone

9. Restart asterisk

amportal stop
amportal start

10. 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.

[trixbox1.localdomain ~]# asterisk –r
trixbox1*CLI> mobile search

11. This will return something like the following:

Address Name Usable Type Port
00:1B:63:D5:3F:06 Bob's iPhoneYes Phone 8

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

Choose which device(s) you want to use and edit /etc/asterisk/mobile.conf

[trixbox1.local ~]# nano /etc/asterisk/mobile.conf

For a phone create an entry like the one below and paste in the MAC address on the address line and also make sure you use the port that was displayed during the mobile search. The 'id' of the device [bitinbrackets] can be anything unique name you want.

[my_phone]
address=xx:xx:xx:xx:xx:xx ; the address of the phone
port=x ; the port number (from mobile search)
context=from-pstn ; dialplan context for incoming calls
adapter=blue ; adapter to use

13. restart asterisk

amportal stop
amportal start

14. The CLI command 'mobile show devices' can be used at any time to show the status of configured devices, and whether or not the device is capable of sending / receiving SMS via Bluetooth:

asterisk -r

trixbox1*CLI> mobile show devices
ID Address Connected State SMS
my_phone 00:12:56:90:6E:00 Yes Free Yes

15. You should now be able to call your phone and have trixbox answer. Make sure you have a route in FreePBX that routs all incoming CID/DID to something.

16. Outbound calls on your Bluetooth cell phone.
Create a custom trunk

Outbound Caller ID = your mobile phone number
Maximum channels = 1
Custom Dial String = Mobile/my_phone/$OUTNUM$

my_phone is the name of your phone in mobile.conf

17. Setup an outgoing rule to use this trunk and make a call. Make sure the cell phone hangs up when you hang up the call. If there is a bug here you will get a big phone bill!

Notes:

If you want to change the pairing password you can edit /etc/bluetooth/passkeys/default and restart the Bluetooth service (service bluetooth reload)