chan_mobile [WORKING well with iPhone 4s]


I just saw AndrewZ’s comment in response to the question posed by zlotowinfo.

Has anyone had any experience running the chan_mobile channel driver? I’m thinking of dipping my toes in the water as I could see it could be quite a useful solution to route my mobile calls via Asterisk (and also maximise the value of my monthly mobile call allowance).

I’ve been googling away and there a few articles like the one on which highlight key implementation decisions (in terms of compatibility and functionality), such as:

[] Choice of bluetooth dongle
] Latest supported version of bluez bluetooth utilities and libraries
[*] Supported handsets

I’ve also read on asterisk support forums that a minor patch (to chan_mobile.c) may be required for this to work, although I think this relates to Debian-based installs, rather than CentOS.

For info I would be recompiling Asterisk to install the channel driver. I’m running * on FPBX running on a CentOS 6.2 x86_64 box. Im considering buying some MSI BToes 2.0 EDR Micro Dongles as they appear to be the most compatible on the list in the article (they are also pretty cheap to buy here).

I’d be pairing up to either an iPhone 4S or a BlackBerry Curve 8900. I’m also lucky enough to have a Vodafone SureSignal (pico cell repeater) installed so my mobile signal is quite strong.

Any tips or thoughts?


  1. cp /usr/src/asterisk-addons-trunk/configs/mobile.conf.sample /etc/asterisk/mobile.conf
  2. vi /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;

  1. /etc/init.d/bluetooth restart

You’ll probably be told that your system couldn’t stop bluetooth (because it wasn’t running) and
then it’ll restart.

  1. Now let’s make sure everything is running that should be:

/etc/init.d/bluetooth status

You should see messages that look like this:

hcid (pid somenumber) is running …
sdpd (pid somennumber) is running …

If you’re alerted that some other application isn’t running, we don’t care.

  1. Now let’s be sure the system has found your Bluetooth adapter:

hcitool dev

You should see something like this:


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

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

vi /etc/asterisk/mobile.conf

In the first [adapter] stanza where “id=blue” replace the mac address with the one you copied down.

Thank you very much for the how to.

Hopefully my BT dongles will be arriving in the next week or so and I can get the setup underway!


I have this working successfully using an iPhone 4S (with v5.1 firmware) and using the MSI BToes 2.0 EDR Micro Dongle.

The lessons learnt here are that overall success with chan_mobile is critically dependent on the dongle and phone used. Getting a solid and stable Bluetooth phone to Asterisk connection has proven to be anything but easy and predictable.

In my attempts to get this setup and working on my system I tried pairing and using the following handsets without much success (and I have to say quite a bit of aggravation):
[] Sony Ericsson T630
Result: Paired successfully, was visible with # hcitool scan and showed up under CLI> mobile search. After configuring in chan_mobile.conf, the phone would connect with Asterisk, initialising, then failing and disconnecting repeatedly with Asterisk.
] RIM BlackBerry Curve 8900
Result: Paired successfully (after quite a few tries), was visible with # hcitool scan and showed up under CLI> mobile search. After configuring in chan_mobile.conf, the phone would connect with Asterisk, initialising, then failing and disconnecting repeatedly with Asterisk. Finally the BB crashed!!
[*] RIM BlackBerry Curve 9360
Result: Paired successfully (easier than the 8900), however was NOT visible with # hcitool scan although the phone name would be displayed with # hcitool name {BT address}. Further it did not show up under CLI> mobile search. With a sort of ‘kludged’ configuration in chan_mobile.conf (I guessed the port number as the phone would not show up with the Asterisk mobile search command), the phone would connect with Asterisk, initialising, then failing and disconnecting repeatedly with Asterisk.


Some general observations getting this far:
Clearly your mileage may vary with all of this and unfortunately is very specific to your situation with lots of variables (phones and dongles being the biggest factors) that may throw spanners in works; but this may help some poor souls who persevere through Bluetooth purgatory to get things talking…
[] Much of the chan_mobile installation and configuration info out on the web is pretty old and out of date. For instance since Asterisk 1.6 chan_mobile has been bundled with the core Asterisk release (rather than add ons). To install it simply recompile Asterisk and on the first page of menuselect select chan_mobile to be included from the list
] If possible have on hand several different BT dongles (adapters) that you can try out with your handsets. A CSR (Cambridge Silicon Radio) chipset based BT dongle is pretty widely perceived to give the best chance of success, but as I’ve demonstrated not always…to obtain details of your BT dongle, issue command # hciconfig -a with the adapter plugged in
[] I’m using a default ISO install of Centos 6.2 x86_64 - NOT a default OS install from a FreePBX/Asterisk based distro, therefore I have GNOME installed (I know tsk, tsk but hey it works for me and the system is 99% of the time at runlevel 3 rather than 5 with GUI). As such Bluetooth on my asterisk box is using the default bluez v4.66 utilities, libraries and gnome-bluetooth configuration utility that comes with the default CentOS 6.2 install (using GNOME).
] The configuration files for the bluetooth adapters on my setup are NOT in the usually documented place. Rather they are found in /var/lib/bluetooth/{BT address} with a subdirectory created for each adapter. I think the usually documented place is /etc/bluetooth/hcid.conf (which file incidentally did not even exist on my system). Within the respective /var/lib/bluetooth/{BT address} directory the following configuration files are found:
[] classes a list of BT device addresses (BDA) and their corresponding class (e.g 0x7a020c)
] config configuration summary of given adapter, including ascii name, class and mode (e.g. discoverable)
[] features a list of BDAs and their corresponding feature set ID (e.g BFFECFFEDBFF7B87)
] lastseen a list of BDAs and the corresponding timestamps of when they were last seen
[] lastused a list of BDAs and the corresponding timestamps of when they were last used
] linkkeys a list of BDAs and their associated link key
[] manufacturers a list of BDAs and their associated manufacturer codes (e.g. 15 6 16643)
] names a list of BDAs and their corresponding device names
[] profiles a list of BDAs and their supported BT profiles in hex
] sdp a list of BDAs and the corresponding output of their service discovery profile (SDP) in hex
[*] trusts a list of BDAs and their trust statuses
Thanks to the advice found here on that little config file location tip.

[*] (Updated on 18 April) - Your mileage may vary with this one. I’ve been experiencing a niggling issue over the past month of using chan_mobile, that I have just resolved, where an inbound call to the mobile phone, during the ringing state, would cause the CLI/logs to completely FLOOD with transcode warnings of the type: WARNING[11724]: chan_sip.c:6376 sip_write: Asked to transmit frame type slin, while native formats is 0x4 (ulaw) read/write = 0x4 (ulaw)/0x4 (ulaw).
Very annoying actually as each time my iPhone rang I would get about 10,000 warnings in the logs! After much searching I found out that there is a bug in channel.c which requires a (very simple) patch to resolve. See my other post for details or alternatively get the requisite patch from JIRA

In summary the iPhone 4S in combination with the BToes micro dongle is performing admirably. Inbound and outbound calls work well and are hanging up cleanly. Bluetooth is behaving nicely and reconnecting automatically when the phone comes into range and no nuisance disconnects. I may perhaps put this down to the Bluetooth 4.0 stack this phone is using…or simply dumb luck!!

I may push the boat out a bit further and try my hand at using some different BT adapters to get those BlackBerry handsets working. I think I’m going to try a BT v2.1 + EDR spec adapters with Class 1 support to get the greater range. I’ve also read that v2.1 may improve the pairing ability over v2.0.

So we’ll see where that goes…

I have the bluetooth part up and running and can pair with an old android phone (HTC Nexus) using the EDR BT adaptor (CSR chipset) but command “hcitool scan” is always just returning to the command line without finding anything. Can’t get my iPhone 4s to pair at all (will try another BT adaptor as soon as i can get my hands on one).

Also have issues with mobile.conf - even if I could get a hardware address back via hcitool scan I can’t find mobile.conf to update it because /etc/asterisk/mobile.conf and /usr/src/ doesn’t have an asterisk-addons-trunk directory in it to copy from as per the beginning of this post.

Would appreciate any help

Simcity - thanks for the quick response.

I am using the latest freePBX distro with all updates applied (so running at 2.10.x), so i’m using Asterisk 1.8 and as you say chan_mobile should already be in there.

yum info bluez* gives;

asterisk -rx “module show” | grep chan_mobile gives exactly the line indicated.

I looked for chan_mobile in /etc/asterisk but could not find it there (could only find the chan_dahdi.conf file). Where should it be?

I have “unlimited” minutes on my cellphone tariff and call mobile phones quite a bit as part of my work so I was particutlarly keen to get this working as it will potentially save me quite a lot of money and allow me to use a desk phone for all calls.

What version of Asterisk and FreePBX are you running? Did you install from distro or source? It’s a bit difficult to help you without some basic information like this.

Saying all that…

Firstly ensure that you have the following packages installed:


You can check by typing yum info bluez* at the command prompt, if installed you should see something like “Repo: installed” beneath each package.

Secondly ensure that you do actually have chan_mobile compiled into asterisk. To check this type:

asterisk -rx "module show" | grep chan_mobile at the command prompt.
You should have returned something like:

If you do not get this response or similar, then you need to recompile asterisk from source and ensure you select chan_mobile from the first page of menuselect.

Finally, and with all due respect to andrewswitzerland - his instructions really only apply to Asterisk 1.6. If you are running Asterisk 1.8 or above, then chan_mobile is actually already included within the core distribution rather than asterisk addons, so all that stuff about copying mobile.conf is waaaaaaay out of date. The correct configuration file is actually chan_mobile.conf.

Trust me when I say there is no sure fire way of getting chan_mobile working on your setup. Even if you have the basics working, it’s more good fortune that anything to find a successful phone and dongle pairing. I have tried 4 different bluetooth dongles and 5 different phones. Only one combination actually worked with Asterisk!!

Good luck!!!

Do let us know how you get on.

Go to your source file directory /usr/src and you should have an asterisk directory there, something like asterisk-1.8.12. Based on the asterisk source directory name in your system, simply issue the following commands (obviously replace to reflect your asterisk source directory in the first command):

cp /usr/src/asterisk- /etc/asterisk/chan_mobile.conf cd /etc/asterisk chown asterisk:asterisk chan_mobile.conf chmod 664 chan_mobile.conf

You now have a working copy of chan_mobile.conf in /etc/asterisk that you can edit to suit. You will need to have entries in this file that looks something like this (it will become clearer where the entries go when you inspect the template):



[iPhone] address=gg:hh:ii:jj:kk:ll port=8 context=from-mobile-custom-1 adapter=blue group=1

You will need to edit the BT adapter address based on the output of the hcitool dev command. The adapter id can be whatever you want, just ensure it is consistent with the entry for the phone. To get the actual phone BT address, issue the command hcitool scan or otherwise issue the command mobile search from the asterisk CLI. The latter is better as it will actually return the port number, which you need as well. You may need to re-issue this command several times (and be patient) as it sometimes returns nothing or is slow to return its findings.

On my system I also have a context called “from-mobile-custom-1” the entry within extensions_custom.conf which looks like:

exten => s,1,Noop(Entering macro-from-mobile-custom-1 with DID = ${DID} and setting to: xxxxxxxxxxx)
exten => s,n,Set(__FROM_DID=xxxxxxxxxxx)
exten => s,n,Goto(from-trunk,xxxxxxxxxxx,1)

where xxxxxxxxxxx is my mobile phone number. This context handles inbound calls to my mobile. Outbound calls are dealt with using a custom trunk, within which the custom dial string is set as Mobile/iPhone/$OUTNUM$ where “iPhone” matches the entry for my phone in chan_mobile.conf as above.

Note - you will need to restart bluetooth, asterisk (or possibly even your system) to enable some configuration changes

Finally in terms of dongles, the one that is actually working on my system with my iPhone is an MSI BToes 2.0 EDR Micro Dongle.

These dongles didn’t work:

Sweex BT214 Bluetooth 2.1 Micro USB Adapter Class 1
Belkin Bluetooth USB plus EDR Adapter, 100m range, v2.1

plus a couple of others which I can’t now find…

Could I ask for details of the bluetooth adaptors that you tried with the iPhone 4S that didn’t work (so i know which ones to avoid buying) - I was going to try a D-link DBT-120 which seems sucessful for many.

Also - I had previously been fololowing these instructions (for Asterisk 1.8) that mentions a mobile.conf file;

Simcity - thanks again for your assistance.

I don’t have an asterisk source directory - I googled for a sample and manually created chan_mobile.conf accordingly (XX and YY do have the real addresses);




My MSI BToes adapter arrived today and my iPhone can see the PBX but refuses to pair with it (says Pairing Unsuccessful - make sure “My PBX” is ready to pair and the PIN code is correct and then try again). Pairing works OK with an old android phone (Nexus One).

I’ll try again with a dlink DBT-120 bluetooth adapter later in the week as soon as I can get my hands on one, though i’m a bit disappointed to not have better results given that i’m using the same phone and bluetooth hardware.

Hmmm. Yes its anything but easy getting this working. I was ‘lucky’ in some ways as I rolled my own solution, based on CentOS 6.2 and manually installed the LAMP stack, Asterisk and FreePBX from source.

As such I was able to use the Gnome GUI and the associated gnome-bluetooth graphical configuration utility to get the phone pairing with the server. This is as opposed to the ‘manual’ pairing method, where hcid.conf is directly edited - as described in the tutorial you posted a link to.

Getting the basic phone/dongle pairing is imperative. Unfortunately if the phone isn’t pairing cleanly to begin with, then you have no hope going to the next step, getting chan_mobile and Asterisk talking to the phone.

On my system, with the BT dongle plugged in (but phone disconnected), typing hciconfig -a at the command prompt gives the following output (note I’ve obfuscated the adapter address):

hci0: Type: BR/EDR Bus: USB
BD Address: xx:xx:xx:xx:xx:xx ACL MTU: 310:10 SCO MTU: 64:8
RX bytes:361767 acl:31 sco:0 events:37755 errors:0
TX bytes:301889 acl:18 sco:0 commands:18860 errors:0
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Name: 'Asterisk PBX’
Class: 0x4a0104
Service Classes: Networking, Capturing, Telephony
Device Class: Computer, Desktop workstation
HCI Version: 2.0 (0x3) Revision: 0xc5c
LMP Version: 2.0 (0x3) Subversion: 0xc5c
Manufacturer: Cambridge Silicon Radio (10)

If you run a similar command on your system, what do you get?

hci0: Type: USB
BD Address: xx:xx:xx:xx:xx:xx ACL MTU: 192:8 SCO MTU: 64:8
RX bytes:599979 acl:4402 sco:0 events:19804 errors:0
TX bytes:108094 acl:2937 sco:0 commands:5916 errors:0
Features: 0xff 0xff 0x0f 0x00 0x00 0x00 0x00 0x00
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Name: 'My PBX’
Class: 0x4a0104
Service Classes: Networking, Capturing, Telephony
Device Class: Computer, Desktop workstation
HCI Ver: 1.1 (0x1) HCI Rev: 0x20d LMP Ver: 1.1 (0x1) LMP Subver: 0x20d
Manufacturer: Cambridge Silicon Radio (10)

I noticed that the type, features, HCI version and LMP version are different. My class was set to 0x000100, I changed it to 0x4a0104 but that made no difference to the pairing.

Thanks again for your time helping with this.


Will get another BT dongle and try again…

Yep that would be the problem :wink:

For info the part number on the packaging on mine is BT2-USB-020R and I bought it from 24h-allshop on eBay.

By the way, I know you’ve googled up the basics of the chan_moble.conf file, but if you want to get the ‘proper’ template files, simply download the Asterisk source code from:

Once untar’d its possible to find the template file in the location I mentioned. Its a good idea to download the version of asterisk that matches what is installed on your system. It may come in handy if you need to recompile asterisk.

simcity, thanks for the link - I could not find any other MSI BToes dongles in UK (no idea why we don’t have them), even amazon had sold out and didn’t know when they would restock.

Those guys are pretty swift at getting the item shipped to the UK, post only took a few days to arrive. The actual postage charge is a bit on the steep side, but then again the dongle itself is pretty cheap, so I bought a couple of dongles “just in case”, and to maximise the value of the postage.

It terms of general availability, I think those dongles are getting a bit long in the tooth now, pardon the bad bluetooth pun, hence why they are generally not available. Although bizarrely they seem to have the most compatible BT software stack.

I seem to recall I had the most pairing problems with the newer v2.1 variety and also 100m versions (I was trying to get ‘whole house’ connectivity).

Hopefully my new bluetooth adaptors from Germany will come soon.

hciconfig -a

hci0: Type: USB
BD Address: xx:xx:xx:xx:xx:xx ACL MTU: 310:10 SCO MTU: 64:8
RX bytes:1475 acl:0 sco:0 events:71 errors:0
TX bytes:351 acl:0 sco:0 commands:20 errors:0
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xf9 0x00 0x80
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Name: 'My PBX’
Class: 0x4a0104
Service Classes: Networking, Capturing, Telephony
Device Class: Computer, Desktop workstation
HCI Ver: 2.0 (0x3) HCI Rev: 0xc5c LMP Ver: 2.0 (0x3) LMP Subver: 0xc5c
Manufacturer: Cambridge Silicon Radio (10)

HCITOOL SCAN finds the phone OK, but i can’t get it to pair. Will try again (i know this can be a bit cumbersome sometimes).

Any joy now?

Running over this again, the major difference between my setup and yours is that I’m not running a standard distro, I’ve built my own setup. Therefore I was a bit ‘naughty’ and used the GUI-based bluetooth configuration utility (bluetooth-gnome) which runs under GNOME to do my initial phone/server pairing and change server name, pairing keys etc.

Because of the differing nature of the setups the bluetooth stack on my machine MAY be somewhat different to what you have. For instance I think you’ve modified your hcid.conf file to change the server bluetooth name, pairing key etc. If you refer to bullet 4 of my “It’s Working” post above - on my setup the settings in hcid.conf are actually stored in a specific directory for each bluetooth adapter found on the systems i.e. /var/lib/bluetooth/{BT address} There actually is no hcid.conf file on my system.

Small but possibly significant differences to get this working…