Monday, 16 December 2013

Install chan_mobile on ClearOS 5.2 SP2, Asterisk 1.8 and FreePBX 2.8

Source: http://samyantoun.50webs.com/asterisk/chan_mobile/

 
Install chan_mobile on ClearOS 5.2 SP2, Asterisk 1.8 and FreePBX 2.8

  • Legend (Variable and Scope)
    • PBX Pairing Password User
      PBX Name User
      Context User
      Bluetooth USB Device Name User
      MAC Address System
      ID System
      Mobile Phone MAC Address System
      Port System
      Number User
      ID User
  • ClearOS
    • Install Bluez
      • Yum
        • yum install -y bluez-utils bluez-libs bluez-libs-devel bluez-hcidump
      • Edit /etc/bluetooth/hcid.conf
        • Backup
          • cp -vf /etc/bluetooth/hcid.conf /usr/src/svn/hcid.conf.original
        • Clean (Optional)
          • sed -i '/^\t#/d;/^#/d;/^$/d' /etc/bluetooth/hcid.conf
        • Edit options Section
          • Change security user to security auto
            • sed -i 's/security user/security auto/' /etc/bluetooth/hcid.conf
          • Change passkey "BlueZ" to passkey "1234"
            • sed -i 's/passkey "BlueZ"/passkey "1234"/' /etc/bluetooth/hcid.conf
        • Edit device Section
          • Change name "%h-%d" to name "My PBX"
            • sed -i 's/name "%h-%d"/name "My PBX"/' /etc/bluetooth/hcid.conf
          • Change class 0x120104 to class 0x000100
            • sed -i 's/class 0x120104/class 0x000100/' /etc/bluetooth/hcid.conf
      • Service
        • service bluetooth start
    • Setup Bluetooth USB
      • Connect Bluetooth USB
      • Make Sure USB is connected
        • Test 1
          • Run Command
            • hciconfig -a
          • You should see something like this:
            • hci0: Type: USB
            • BD Address: 00:15:E9:66:BF:B6 ACL MTU: 192:8 SCO MTU: 64:8
            • UP RUNNING
            • RX bytes:949 acl:0 sco:0 events:23 errors:0
            • TX bytes:331 acl:0 sco:0 commands:22 errors:0
            • Features: 0xff 0xff 0x0f 0x00 0x00 0x00 0x00 0x00
            • Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
            • Link policy: RSWITCH HOLD SNIFF PARK
            • Link mode: SLAVE ACCEPT
            • Name: 'My PBX'
            • Class: 0x000100
            • Service Classes: Unspecified
            • Device Class: Computer, Uncategorized
            • HCI Ver: 1.1 (0x1) HCI Rev: 0x20d LMP Ver: 1.1 (0x1) LMP Subver: 0x20d
            • Manufacturer: Cambridge Silicon Radio (10)
        • Test 2
          • Run Command
            • hcitool dev
          • You should see something like this:
            • Devices:
            •     hci0   00:15:E9:66:BF:B6
    • Setup Mobile Phone
      • Make PBX discoverable:
        • dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.SetMode string:discoverable
      • Pair PBX
        • On the mobile phone, Search for devices (Nokia, Settings > Connectivity > Bluetooth > Paired devices > Add new device
        • You should find your PBX as My PBX. Pair with a pin of 1234
      • Make sure we can see your phone
        • Run Command
          • hcitool scan
        • You should see something like this:
          • Scanning ...
          •    FC:E5:57:EB:4A:87    MyMobile
  • Asterisk
    • Edit /etc/asterisk/mobile.conf
      • Create Config File
        • touch /etc/asterisk/mobile.conf
        • chown asterisk:asterisk /etc/asterisk/mobile.conf
        • chmod 664 /etc/asterisk/mobile.conf
      • Create [adapter] sections
        • echo "[adapter]
        • id=dlink01
        • address=00:15:E9:66:BF:B6" > /etc/asterisk/chan_mobile.conf
    • Search for your bluetooth devices from Asterisk. This command might take 8 - 10 seconds
      • Rum Commands
        • asterisk -r
        • module load chan_mobile.so
        • mobile search
      • You should see something like this:
        • Address            Name       Usable  Type   Port
        • FC:E5:57:EB:4A:87  My Mobile  Yes     Phone  13
    • Edit /etc/asterisk/mobile.conf
      • echo "[nokia_c1_01_01]
      • address=FC:E5:57:EB:4A:87
      • port=13
      • context=from-mobile-nokia-c1-01-01
      • adapter=dlink01
      • group= 1">> /etc/asterisk/mobile.conf
    • Show the status of configured devices, and whether or not the device is capable of sending / receiving SMS via bluetooth:
      • Run Command
        • mobile show devices
      • You should see something like this:
        • ID              Address            Group  Adapter  Connected  State  SMS
        • nokia_c1_01_01  FC:E5:57:EB:4A:87  1      dlink01  Yes        Free   No
  • FreePBX
    • Outgoing
      • Trunk
        • Create a custom trunk
        • Outbound Caller ID = 0123456789
        • Maximum channels = 1
        • Custom Dial String = Mobile/nokia_c1_01_01/$OUTNUM$
      • Outbound Route
        • As desired
    • Incoming
      • Edit /etc/asterisk/extensions_custom.conf
        • echo "
        • ;************* Mobile Nokia C1-01 01 ***************
        • [from-mobile-nokia-c1-01-01]
        • exten => s,1,Noop(Setting DID = 0123456789)
        • exten => s,n,Set(__FROM_DID=0123456789)
        • exten => s,n,Goto(from-trunk,0123456789,1)
        • exten => s,h,Hangup
        • ;*********** End Mobile Nokia C1-01 01 *************
        • " >> /etc/asterisk/extensions_custom.conf
      • Inbound Route
        • DID Number = 0123456789
  • Notes
    • Asterisk Mobile Commands
      • mobile cusd Send CUSD commands to the mobile
        mobile rfcomm Send commands to the rfcomm port for debugging
        mobile search Search for Bluetooth Cell / Mobile devices
        mobile show devices Show Bluetooth Cell / Mobile devices
    • To load or unload chan_mobile module
      • module load chan_mobile.so
      • module unload chan_mobile.so

No comments: