Hello folks.
I know or should I say I think or rather I guess that many people struggle with getting chan_mobile to work - reliable. I have been using chan_mobile with PIAF, in a business setting for about 2 years now WITHOUT any issues. I do recall that I've been struggling a lot at that time when I was working hard to get everything working and running smoothly. And because it was such a pitty to just get everything paired up and working, I've made notes, and I've saved them (this time).
I've decided to set up a new "PBX" for a home business environment, and I am so glad that I've saved the notes I've made - way back.
So this is MY setup - please note that it might be wrong - I am no professional, nor am I a PIAF super-user. This is just MY contribution, to the PIAF family - in hopes that I might just help someone.
MY SETUP
Before you start, make sure you have a solid PIAF system running. My most recent installation is PIAF 2.0.6.5.
Secondly, make sure that you have chan_mobile in your /usr/lib/asterisk/modules/ directory. If you dont know how to check this - then simply do this. When you're logged in via SSH, simply type
This will give you a list of all modules.
Then, a couple of tips, or should I call it things-to-do in order to ensure that everything will be working as expected? Remember I might be wrong! But this is what is working for me.
Edit the file /etc/asterisk/chan_mobile.conf
You will notice that there are sample setup / configurations already. In short - the [adapter] config is your bluetooth adapter, and the [6310i] or sections below the "adapter" config - are your phones and headsets.
So the layout for the adapter should look similar to this
Explanation:
[adapter] // leave this as it is
id=hci1 // this is IMPORTANT and must be unique - this is the reference name for your bluetooth adapter
address=AA:AA:AA:AA:AA:AA // this is the MAC address of your adapter
The layout for the PHONE should look similar to this
[6310i] // name of your phone or whatever you want to type
address=AA:AA:AA:AA:AA:AA // MAC address of your phone's bluetooth adapter
port=13 // bluetooth port
context=incoming-mobile // unique contect name -> this is IMPORTANT for incoming calls
adapter=hci1 // adapter refernce name - i.e. tells WHICH adapter to use
Now - you will probably not have the required information (such as the port number etc) as yet - however I do want you to look at the file first, before proceeding with the following commands. So close the file now, and get the required information.
I'll assume your bluetooth service is now running
issue the shell command
This will list all your bluetooth adapters. If you dont see anything similar to the following, then you have an issue with your ADAPTER. The chan_mobile settings is NOT related if you DONT see your adapter here.
You should see something like this. I'll list one adapter only.
Then in order to get the MAC address of the phone,
Take note of the MAC address
Issue the command
Once there, you HAVE to ensure that your chan_mobile.so module is running. Issue the following command to ensure that it is running
Once there and if you didnt receive any errors when laoding this module, issue the following command
Allow a couple of seconds for the adapter to search. Also its probably obvious that your phone's bluetooth should be on and discoverable at this stage, right? Good.
Once you see results, you will notice a port number next to the device listing. Remember thsi port number.
Stop the chan_mobile.so module
Press CTRL+C keys.
Issue the command
And take note of the MAC address of the relevant PHONE
Edit your chan_mobile.conf file in your favorite editor or
Enter the correct information.
REMEMBER:
REMEMBER: According to what I understand - you can only use ONE phone per ONE adapter. So dont use the unique reference ID of the adapter for more than one phone, okay?
Save the file and exit. Dont load the chan_mobile.so module as yet.
Now paring.
Do the following.
Then issue the command - but VERY VERY important
STOP AND READ THIS:
This is the pairing part. You are busy with it now. I've experience many issues here.
With the Samsungs - it only asked if the pair key matched, and I said YES, and it paired. Witht he motorola, - geeee I cant even remember. But similar heavy issues. If you didnt experience issues, or dont experience issues, then I'm glad for you.
Load the chan_mobile.so module
If you have paired successfully, you can validate this by:
You should see something similar to this
With the Nokia's , it asked for a pair key. It doesnt give one. The pair key is 4567
I ope you're phone paired sccessfully. Remember to go into your phone's paired devices and AUTHENTICATE the newly paired device, otherwise it will ask you to authenticte the connection everytime your server wants to pair with your phone.
IF YOUR PHONE DID NOT PAIR OR IF YOU RECEIVED ERRORS - then I cant tell you what to do. HOWEVER, what I can suggest is, in order to keep your attempts fresh and clean and not flooded with probable or possible code snippets or attempts, delete your adapters profile by doing this:
Unload / stop the chan_mobile.so module as explained before and go to your basic command line
then
to list all the files / directories
go into the directory of the proffered ADAPTER and delete all files inside. Once done, delete the directory itself. Once don, plug out the relevant bluetooth adapter, put it back, and start the pairing process again.
As an example:
This way you can be sure that the files / settings / profiles / linkkeys are deleted and you can restart the pairing process
Okay - I'll assume you have successfully paired.
You can test it by issuing the command amportal restart - when asterisk then restarts, your phone will automatically disconnect and then reconnect
IMPORTANT NOTE: If your phone connects and disconnects all of the time - then your PORT set in chan_mobile.conf is probably wrong.
-> I can not post more than 10000 characters - see the rest of the tutorial in the comments:
I know or should I say I think or rather I guess that many people struggle with getting chan_mobile to work - reliable. I have been using chan_mobile with PIAF, in a business setting for about 2 years now WITHOUT any issues. I do recall that I've been struggling a lot at that time when I was working hard to get everything working and running smoothly. And because it was such a pitty to just get everything paired up and working, I've made notes, and I've saved them (this time).
I've decided to set up a new "PBX" for a home business environment, and I am so glad that I've saved the notes I've made - way back.
So this is MY setup - please note that it might be wrong - I am no professional, nor am I a PIAF super-user. This is just MY contribution, to the PIAF family - in hopes that I might just help someone.
MY SETUP
- BLUETOOTH DONGLES (I use 4)
Bluetooth dongle - I use IOGEAR USB 2.1 Bluetooth Micro Adapter (GBU421)
NOTE: I've also purchased the IOGEAR Bluetooth 4.0 USB Micro Adapter (GBU521) - I have never got it working. I dod not spend lots of time trying. It doesn't work for me. I have tried cheaper dongles - IT DOESNT WORK either. The ones which seemed to work simply is not reliable - PHONES
I've tried cheap Motorola handsets - the ones which worked, had bad voice quality. I've also tried cheap Motorola phones and I've also experienced bad voice quality - compared to:
Samsung GT-S5300 and any Nokia phone. The nokia phones work fast and everytime. Very very reliable. I can say the same for the Samsung ones too (I guess I can say this for all android phones? The Samsung ones were the only ones with Android which I have tried and used). But really, I've tried a Nokia C5-00, Nokia 6210, Nokia 6310i and a couple of other Nokia's - and they simply just work. - PC / Computer Hardware
I guess this wont really make a difference, but I'm running Pentium 4, 160GB hard drive, 1.5GB RAM
Before you start, make sure you have a solid PIAF system running. My most recent installation is PIAF 2.0.6.5.
Secondly, make sure that you have chan_mobile in your /usr/lib/asterisk/modules/ directory. If you dont know how to check this - then simply do this. When you're logged in via SSH, simply type
Code:
cd /usr/lib/asterisk/modules/
ls
Then, a couple of tips, or should I call it things-to-do in order to ensure that everything will be working as expected? Remember I might be wrong! But this is what is working for me.
- Many, MANY posts instruct the reader to edit / modify the /etc/bluetooth/hcid.conf file - I have never been able to find this file! So just forget about it.
- Bluetooth - make sure you can start bluetooth and stop bluetooth by typing
Code:
service bluetooth start
Code:service bluetooth stop
- In order to ensure that the bluetooth service starts automatically on boot, issue the command
Code:
nano /etc/rc.local
Code:/etc/init.d/bluetooth start
Edit the file /etc/asterisk/chan_mobile.conf
You will notice that there are sample setup / configurations already. In short - the [adapter] config is your bluetooth adapter, and the [6310i] or sections below the "adapter" config - are your phones and headsets.
So the layout for the adapter should look similar to this
Code:
[adapter]
id=hci1
address=AA:AA:AA:AA:AA:AA
Explanation:
[adapter] // leave this as it is
id=hci1 // this is IMPORTANT and must be unique - this is the reference name for your bluetooth adapter
address=AA:AA:AA:AA:AA:AA // this is the MAC address of your adapter
The layout for the PHONE should look similar to this
Code:
[6310i]
address=AA:AA:AA:AA:AA:AA
port=13
context=incoming-mobile
adapter=hci1
[6310i] // name of your phone or whatever you want to type
address=AA:AA:AA:AA:AA:AA // MAC address of your phone's bluetooth adapter
port=13 // bluetooth port
context=incoming-mobile // unique contect name -> this is IMPORTANT for incoming calls
adapter=hci1 // adapter refernce name - i.e. tells WHICH adapter to use
Now - you will probably not have the required information (such as the port number etc) as yet - however I do want you to look at the file first, before proceeding with the following commands. So close the file now, and get the required information.
I'll assume your bluetooth service is now running
issue the shell command
Code:
hcitool dev
This will list all your bluetooth adapters. If you dont see anything similar to the following, then you have an issue with your ADAPTER. The chan_mobile settings is NOT related if you DONT see your adapter here.
You should see something like this. I'll list one adapter only.
Code:
Devices:
hci0 AA:AA:AA:AA:AA:AA
Then in order to get the MAC address of the phone,
Code:
hcitool scan
Take note of the MAC address
Issue the command
Code:
asterisk -rvvvvvvvv
Code:
module load chan_mobile.so
Code:
mobile search
Once you see results, you will notice a port number next to the device listing. Remember thsi port number.
Stop the chan_mobile.so module
Code:
module unload chan_mobile.so
Issue the command
Code:
hcitool scan
Edit your chan_mobile.conf file in your favorite editor or
Code:
nano /etc/asterisk/chan_mobile.conf
REMEMBER:
Code:
[adapter]
id=hci1 --> replace hci1 with your OWN UNIQUE name or reference for this adapter
address=AA:AA:AA:AA:AA:AA --> MAC address of your ADAPTER
Code:
[6310i]
address=AA:AA:AA:AA:AA:AA --> MAC address of your phone
port=13 --> This is the port number you've got when you did the mobile search command
context=incoming-mobile ->> this is IMPORTANT for incoming calls - see the explanation later
adapter=hci1 --> this must match your unique adapter reference
Save the file and exit. Dont load the chan_mobile.so module as yet.
Now paring.
Do the following.
Code:
cd /root
wget http://www.stocksy.co.uk/files/asterisk/simple-agent.py
chmod +x simple-agent.py
- replace "hci0" with YOUR bluetooth adapter (you get this ID from the command "hctitool dev")
- replace AA:AA:AA:AA:AA:AA with the MAC address of YOUR phone
Code:
/root/simple-agent.py hci0 AA:AA:AA:AA:AA:AA
This is the pairing part. You are busy with it now. I've experience many issues here.
With the Samsungs - it only asked if the pair key matched, and I said YES, and it paired. Witht he motorola, - geeee I cant even remember. But similar heavy issues. If you didnt experience issues, or dont experience issues, then I'm glad for you.
Load the chan_mobile.so module
Code:
asterisk -rvvvvvvvvvvvv
module load chan_mobile.so
Code:
mobile show devices
Code:
ID Address Group Adapter Connected State SMS
c5 XX:XX:XX:XX:XX:XX 0 hci0 [B]Yes[/B] Free No
I ope you're phone paired sccessfully. Remember to go into your phone's paired devices and AUTHENTICATE the newly paired device, otherwise it will ask you to authenticte the connection everytime your server wants to pair with your phone.
IF YOUR PHONE DID NOT PAIR OR IF YOU RECEIVED ERRORS - then I cant tell you what to do. HOWEVER, what I can suggest is, in order to keep your attempts fresh and clean and not flooded with probable or possible code snippets or attempts, delete your adapters profile by doing this:
Unload / stop the chan_mobile.so module as explained before and go to your basic command line
Code:
cd /var/lib/bluetooth/
Code:
ls
go into the directory of the proffered ADAPTER and delete all files inside. Once done, delete the directory itself. Once don, plug out the relevant bluetooth adapter, put it back, and start the pairing process again.
As an example:
Code:
# cd /var/lib/bluetooth/
# cd XX:XX:XX:XX:XX:XX
# rm classes config did eir features lastseen lastused linkkeys manufacturers names profiles sdp
# cd ../
# rmdir XX:XX:XX:XX:XX:XX
This way you can be sure that the files / settings / profiles / linkkeys are deleted and you can restart the pairing process
Okay - I'll assume you have successfully paired.
You can test it by issuing the command amportal restart - when asterisk then restarts, your phone will automatically disconnect and then reconnect
IMPORTANT NOTE: If your phone connects and disconnects all of the time - then your PORT set in chan_mobile.conf is probably wrong.
-> I can not post more than 10000 characters - see the rest of the tutorial in the comments: