NEWS FLASH Incredible PBX for CuBox-i

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
Chan_mobile, been there, done that and gave up. Don't think I would try again as I don't have ninja Linux skillz.
 

zhando

Guru
Joined
Aug 7, 2014
Messages
22
Reaction score
11
Bad News: There is no driver for the internal adapter that we can find.

At least one exists and it appears to be working on my Cubox-i 4. I see both wlan0 and hci0 just fine. Nope no dongles to be seen anywhere. Unfortunately this box is running Arch Linux.

I've tried to replicate the Arch Linux firmware install on the 3.10.53 kernel and it just won't take. I think I'm going to go ahead and finally make that arch linux 3.10.30 kernel work with Ubuntu Trusty like I've threatened to do too many times already.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
At least one exists and it appears to be working on my Cubox-i 4. I see both wlan0 and hci0 just fine. Nope no dongles to be seen anywhere. Unfortunately this box is running Arch Linux.

I've tried to replicate the Arch Linux firmware install on the 3.10.53 kernel and it just won't take. I think I'm going to go ahead and finally make that arch linux 3.10.30 kernel work with Ubuntu Trusty like I've threatened to do too many times already.


The problem with older kernels is IPtables and Fail2Ban stop working. If it comes down to a $1 dongle or IPtables, that's an easy one for me. :patriot:
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Hi Ward,

Any feedback on Chan_Mobile - it works on BBB, would like to know if it works on the box before I get my hands on it....


Well, we just got chan_mobile working on the CuBox. It's better than 2 cans a string, but not by too much.

Helpful Resources: Asterisk wiki Old VoipPhreak article

Here are my rough notes: THIS IS A WORK IN PROGRESS!!

WARNING: If you're going to use Bluetooth for phone calls rather than proximity detection, some of the 99¢ USB 2 adapters just don't work. We have dozens of the tiny stubby ones and all of them fail or crash your server. Here's the one that does work for us.

1. recompile Asterisk after loading the Bluetooth packages outlined on page 1
Code:
amportal kill
cd /usr/src/asterisk*
./configure --with-bluetooth
make menuconfig # activate chan_mobile THEN save & exit
make && make install
cd ..
cd Asterisk*
make clean
make
make install
amportal start
2. Make /etc/bluetooth/hcid.conf look something like this:
Code:
# HCId options
options {
autoinit yes;
security auto;
pairing multi;
passkey "0000";
}
device {
name "cubox-0";
class 0x3e0100;
iscan enable; pscan enable;
discovto 0;
lm accept;
lp rswitch,hold,sniff,park;
}
options {
autoinit yes;
security auto;
pairing multi;
#pin_helper /etc/bluetooth/pin;
}
3. Restart Bluetooth: /etc/init.d/bluetooth restart

4. from Linux CLI, figure out the MAC address of your Bluetooth dongle: hcitool dev | tail -1 | cut -f 3
If it says Devices: then you don't have a working Bluetooth adapter!

5. Edit /etc/asterisk/chan_mobile.conf and plug in MAC address for your Bluetooth adapter. Example:
Code:
[adapter]
id=blue
address=00:27:67:8E:11:2F    ; the MAC address of your USB Bluetooth dongle in step #4
6. In Asterisk CLI, enable chan_mobile: module load chan_mobile.so (gotta have the MAC BT adapter address entered in chan_mobile.conf before the chan_mobile module will load!)
7. activate Bluetooth visibility mode on your phone (it's in left button Bluetooth pull-down on Android)
8. From Linux CLI figure out the MAC address of your Bluetooth phone AND the port: asterisk -rx "mobile search"
9. Edit /etc/asterisk/chan_mobile.conf and add entry for your phone. Example:
Code:
[GalaxyS4]
address=10:D5:42:16:15:CF    ; the address of the phone
port=3                ; the rfcomm port number (from mobile search in step #8)
context=from-trunk        ; dialplan context for incoming calls
adapter=blue            ; adapter to use
group=1                ; this phone is in channel group 1
sms=yes                ; support SMS, defaults to yes but had to force it for S4
nocallsetup=yes        ; set this only if your phone reports that it supports call progress notification, but does not do it. Motorola L6 for example.
10. Restart Asterisk: amportal restart
11. From Linux CLI, run: bluez-simple-agent
12. Turn Bluetooth OFF and back ON on your phone. Then scan for Bluetooth devices and pair to cubox-0. If you can't find it, decipher your phone's BT MAC address and: bluez-simple-agent hci0 BT-MAC-ADDRESS (which pushes cubox-0 selection to Bluetooth on your phone)
13. When prompted, enter 0000 for the PIN on your phone
14. At Linux CLI, bluez-simple-agent should now be prompting for PIN: 0000
15. bluez-simple-agent asks you to confirm passkey: yes (maybe not. just Ctrl-C to exit if phone shows paired)
16. Check to be sure you're linked to Asterisk. From Linux CLI: asterisk -rx "mobile show devices"
17. In FreePBX, add a Custom Trunk for Bluetooth calls to/from your phone with Custom Dial String: Mobile/g1/$OUTNUM$
18. In FreePBX, add an Outbound Route for Bluetooth calls through your cellphone using the Custom Trunk name as Destination for the route
19. To route incoming cellphone calls to Asterisk, in FreePBX, create a default inbound route with a call destination leaving the DID and CallerID fields blank. chan_mobile will not pass incoming DID on incoming call. To manage cell calls separately, create a custom context and modify entry to reflect this context in step #9 above.
20. Dial a 10-digit number from an extension on your PBX and watch it go out through your cellphone. Expect about a 10-second initial delay (only) before the audio sorts itself out.
21. Call your cellphone from an outside number, and your cellphone should ring + the default inbound route in FreePBX should route the call through Asterisk accordingly. Ditto on the initial delay after you answer the cellphone call using an Asterisk extension.
22. If SMS shows enabled in step #16 for your smartphone, then you can add something like this to extensions_custom.conf to send an SMS message. Details in Asterisk Wiki.
Code:
exten => 767,1,MobileSendSMS(GalaxyS4,8431234567,Hello World)

more to come...
 

zhando

Guru
Joined
Aug 7, 2014
Messages
22
Reaction score
11
The problem with older kernels is IPtables and Fail2Ban stop working.

I don't believe that's an issue with the latest build I've done. Still can't get bt to take though. Dang it!

I'll try one more approach with 3.10.30 and then it's off to the latest and greatest 3.14 which the SR threads are raving about.

Fun!
 

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
Based on my past experience......

Perhaps those that try chan_mobile with this device will come out successful but if you can't get it to work, the alternative is an Obi110 and the XLink BTTN (or Gigaset One) bluetooth gateway connected to the Obi's FXO OR an Obi202 with a bluetooth dongle. Either one will connect your phone to FreePBX and provide for outgoing and incoming, caller ID and automated proximity connection. The side benefit of an external solution is you don't need to worry about keeping your server close to your desk and you don't risk blowing up your server by tinkering with BT and chan_mobile trying to get it to work.

Like I said, if you have good Linux skills, you'll probably succeed. If you are like me, well you may want to consider an alternative.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Not to worry... Most of the chan_mobile setup will be built into the image once we get things stabilized.
 

zhando

Guru
Joined
Aug 7, 2014
Messages
22
Reaction score
11
I don't believe that's an issue with the latest build I've done.

Verified. Iptables works fine with a properly setup 3.10.30 kernel. Just tried shorewall and all the many modules load up fine.

And fail2ban as well.. Installed. Up and running..

If I could only get that bt firmware to work.. One last thing to try.
 

zhando

Guru
Joined
Aug 7, 2014
Messages
22
Reaction score
11
You're using the newer kernel.

No. I'm back on the first kernel I sent you. The only problem with it was things were in the wrong place and all the modules were gziped..
 

zhando

Guru
Joined
Aug 7, 2014
Messages
22
Reaction score
11
No dice! I can't even get a bt device scan to work on arch linux. There's just too many kernels and firmwares floating around out there..

I'll continue toying with 3.14 as that is the future but it'll probably be a while before things settle out with that kernel..

Carry on!
 

zhando

Guru
Joined
Aug 7, 2014
Messages
22
Reaction score
11
Well.. Never say never! The SR forum comes through... No need to use another kernel.. This works on 3.10.53..


Code:
cd /root
mkdir cubox-bt
cd cubox-bt
wget http://us.mirror.archlinuxarm.org/armv7h/alarm/firmware-brcm43xx-1.1-2-armv7h.pkg.tar.xz
tar xvf firmware-brcm43xx-1.1-2-armv7h.pkg.tar.xz
mkdir /etc/conf.d
cp etc/conf.d/bcm43xx /etc/conf.d
sed '1 s/sh/bash/;s/ --enable_lpm//' < usr/lib/systemd/scripts/brcm43xx-firmware-update > /usr/local/bin/brcm43xx-firmware-update
chmod +x /usr/local/bin/brcm43xx-firmware-update
cp usr/bin/brcm_patchram_plus /usr/bin
cp usr/lib/firmware/brcm/*.hcd /usr/lib/firmware/brcm/
cp usr/lib/firmware/brcm/*.hcd /lib/firmware/brcm/
# don't use the command below with shipping images of Incredible PBX. see below for fix.
sed '
/nothing./ a\
\
/usr/local/bin/brcm43xx-firmware-update\
wait\
/usr/sbin/hciattach -n /dev/brcm43xx any 3000000 &
' < /etc/rc.local > /etc/rc.local

check if everything is copacetic (wait? sleep?) and reboot. hcitool dev should work and hcitool scan should find stuff.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Bvy7G1XCUAEFRmt.jpg:large
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Well.. Never say never! The SR forum comes through... No need to use another kernel.. This works on 3.10.53..

check if everything is copacetic (wait? sleep?) and reboot. hcitool dev should work and hcitool scan should find stuff.


Da Man title may have been awarded prematurely. Fixed a couple of little things in your commands and the /etc/rc.local sed piece won't work with our setup. In lieu of using sed, here's what the /etc/rc.local file should look like for the Incredible PBX latest build with your previous pieces:
Code:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
 
/usr/local/sbin/iptables-restart
service ntp restart
/usr/local/bin/brcm43xx-firmware-update
/bin/sleep 5
/usr/sbin/hciattach -n /dev/brcm43xx any 3000000 &
/usr/local/sbin/amportal restart
exit 0

While that get's everything installed and working, there's still a major problem. Audio doesn't work in either direction on any BT calls using the internal adapter. If you only want proximity detection, this would be fine.
 

ukstevef

Guru
Joined
Sep 20, 2009
Messages
134
Reaction score
0
While that get's everything installed and working, there's still a major problem. Audio doesn't work in either direction on any BT calls using the internal adapter.
Might be completely wrong here, but have tried running the alsa mixer to see if any of the channels are on mute/low volume ?
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
ukstevef: Good idea, but no cigar. No user adjustable controls in alsamixer for both sound sources.
 
Joined
Apr 22, 2009
Messages
230
Reaction score
0
I'm tempted to buy one as I have a need for my parents vacation house. However what is the status on cheap, small, power savy, reliable, ATA (fxs and/or fxo) device to add to a small setup like this one? I haven't been keeping up on recent ATA products.
 

Members online

No members online now.

Forum statistics

Threads
25,778
Messages
167,504
Members
19,198
Latest member
serhii
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top