# Asterisk Project : Using chan_mobile

Added by mdavenport , edited by mdavenport on Aug 31, 2010

chan_mobile.so must be loaded either by loading it using the Asterisk CLI, or by adding it to /etc/asterisk/modules.conf
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. This requires a free adapter.
Headsets will generally have to be put into 'pairing' mode before they will show up here.
This will return something like the following :-

    *CLI> mobile search
    Address Name Usable Type Port
    00:12:56:90:6E:00 LG TU500 Yes Phone 4
    00:80:C8:35:52:78 Toaster No Headset 0
    00:0B:9E:11:74:A5 Hello II Plus Yes Headset 1
    00:0F:86:0E:AE:42 Daves Blackberry Yes Phone 7

This is a list of all bluetooth devices seen and whether or not they are usable with chan_mobile. The Address field contains the 'bd address' of the device. This is like an ethernet mac address. The Name field is whatever is configured into the device as its name. The Usable field tells you whether or not the device supports the Bluetooth Handsfree Profile or Headset profile. The Type field tells you whether the device is usable as a Phone line (FXO) or a headset (FXS) The Port field is the number to put in the configuration file.

Choose which device(s) you want to use and edit /etc/asterisk/mobile.conf. There is a sample included with the Asterisk-addons source under configs/mobile.conf.sample.

Be sure to configure the right bd address and port number from the search. If you want inbound calls on a device to go to a specific context, add a context= line, otherwise the default will be used. The 'id' of the device [bitinbrackets] can be anything you like, just make it unique.

If you are configuring a Headset be sure to include the type=headset line, if left out it defaults to phone.

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.

    *CLI> mobile show devices
    ID Address Group Adapter Connected State SMS
    headset 00:0B:9E:11:AE:C6 0 blue No Init No
    LGTU550 00:E0:91:7F:46:44 1 dlink No Init No

As each phone is connected you will see a message on the Asterisk console :-

    Loaded chan_mobile.so => (Bluetooth Mobile Device Channel Driver)
    – Bluetooth Device blackberry has connected.
    – Bluetooth Device dave has connected.

To make outbound calls, add something to you Dialplan like the following :- (modify to suit)

    ; Calls via LGTU5500
    exten => _9X.,1,Dial(Mobile/LGTU550/${EXTEN:1},45)
    exten => _9X.,n,Hangup

To use channel groups, add an entry to each phones definition in mobile.conf like group=n where n is a number.

Then if you do something like Dial(Mobile/g1/123456) Asterisk will dial 123456 on the first connected free phone in group 1.

Phones which do not have a specific 'group=n' will be in group 0.

To dial out on a headset, you need to use some other mechanism, because the headset is not likely to have all the needed buttons on it. res_clioriginate is good for this :-

    *CLI> originate Mobile/headset extension NNNNN@context

This will call your headset, once you answer, Asterisk will call NNNNN at context context