chan_mobile
Set Up Bluetooth on Linux
以 Gempro Wireless VoIP Gateway 為例
Install packages
# For RedHat
yum install bluez bluez-tools
# For Debian/Ubuntu
apt-get install bluetooth bluez
Service bluetooth
# For RedHat
systemctl restart bluetooth
systemctl status bluetooth
Pair the BT devices
藍芽裝置的配對密碼,請先確認 Gempro Gateway 上的設定。
bluetoothctl
[bluetooth]#
Controller 00:1A:7D:DA:71:13
Name: freepbx.sangoma.local
Alias: freepbx.sangoma.local
Class: 0x000104
Powered: no
Discoverable: no
Pairable: no
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
Modalias: usb:v1D6Bp0246d052C
Discovering: no
[bluetooth]# power on
[bluetooth]# agent on
[bluetooth]# scan on
[bluetooth]# devices
Device 00:19:5D:3E:01:77 GP-712-1
Device 00:19:5D:24:C6:98 GP-712-2
[bluetooth]# pair 00:19:5D:3E:01:77
...
...
[agent] Enter PIN code: 0003
[CHG] Device 00:19:5D:3E:01:77 UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device 00:19:5D:3E:01:77 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device 00:19:5D:3E:01:77 ServicesResolved: yes
[CHG] Device 00:19:5D:3E:01:77 Paired: yes
Pairing successful
[bluetooth]#
[bluetooth]# paired-devices
Device 00:19:5D:3E:01:77 GP-712-1
Set Up Asterisk
[root@freepbx ~]# asterisk -rx "module show like chan_mobile"
Module Description Use Count Status Support Level
chan_mobile.so Bluetooth Mobile Device Channel Driver 0 Not Running extended
1 modules loaded
Create /etc/asterisk/chan_mobile.conf
:
[general]
interval=30 ; Number of seconds between trying to connect to devices.
; 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.
[adapter]
id=usbbt1
address=00:1A:7D:DA:71:13
;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]).
[GP712P1]
address=00:19:5D:3E:01:77 ; the address of the phone
port=1 ; the rfcomm port number (from mobile search)
context=incoming-mobile ; dialplan context for incoming calls
adapter=usbbt1 ; adapter to use
group=1 ; this phone is in channel group 1
;sms=no ; support SMS, defaults to yes
;nocallsetup=yes ; set this only if your phone reports that it supports call progress notification, but does not do it. Motorola L6 for example.
bluetoothctl (optional)
Available commands:
list
show [ctrl]
select <ctrl>
devices
paired-devices
system-alias
connect <address>
disconnect
remove <address>
power <on/off>
mode <mode>
agent <on/off/capability/timeout>
default-agent
scan <on/off>
pairable <on/off>
pair <address>
discoverable <on/off>
info <address>
menu <command>
quit
Other commands
# Listing all known devices
[bluetooth]# devices
# Powering the Bluetooth controller on or off
[bluetooth]# power on
# Pairing with a device
[bluetooth]# pair <mac_addredd>
# Remove a device
[bluetooth]# remove <mac_address>
# Connecting to a paired device
[bluetooth]# connect <mac_address>
# Disconnecting from a paired device
[bluetooth]# disconnect <mac_address>