SUGGESTIONS PIAF Challenge - Create A Pogoplug GSM Gateway

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
As I have been playing around with my E02 Pogoplug, a thought occurred to me.....why couldn't you use a Pogoplug and a GSM Voice modem to create a GSM Gateway like one of those Goip devices you see for $100 on eBay? You can pick up the PP V4 for as low as $13 and you can find used Huawei voice capable USB modems (like the E153) for as low as $15.00. So for $30 you have all the components you need. If someone could create a lightweight version of PIAF for Pogoplug that concentrated on providing a GSM trunk for say another PBX on the same network, you would have a really cheap device that would be real handy to have and for just $30.

I would try to do this myself but my Linux and Asterisk knowledge is just not good enough. But I bet someone out there could do it. Make that person be you and you will go down in the annals of PIAF history! :clap:

OP Note 12-5-14: Couple things now to say as nearly a month has passed by since I originally posted this.
1) Adding chan_dongle to Asterisk assumes you start out with a Pogoplug V4 or V4 Mobile running the Incredible PBX PP image and updated with all the latest NV, FreePBX and Ubuntu updates.
2) You need to purchase a Huawei dongle that is confirmed to have voice capability and that capability can be unlocked at a site like dc-unlocker if the capability isn't unlocked already. If you think going to the dc-unlocker site feels like going to the bar from Star Wars you are right but it's your only choice
3) You need to read the entire Pogoplug NV tutorial http://nerdvittles.com/?p=10560 AND the entire Pogoplug V4 IPBX thread here http://pbxinaflash.com/community/index.php?threads/incredible-pbx-for-pogoplug-4.15508/ on the forum so that you are at least exposed to them. Little tidbits of info you will glean from these pages may become very useful as you go through and learn from this process as I did.
4) The main resource available about chan_dongle here: http://wiki.e1550.mobi/doku.php has alot of information but it's older and some of it may no longer apply. If it seems confusing, it was to me, still is to me, but somehow I figured what I needed to out.

If you are new to this and think you will stumble your best bet is to start off with a fresh IPBX image, get the PBX udated and stable, add the dongle and get that going AND THEN invest your time setting up extensions, trunks and all the other NV goodies so that if something goes wrong in the middle of the process, well you won't have lost much of your work. And by all means backup often and incrementally both using the FreePBX function as well as the IncredibleBackup program storing the resultant files on another network connected machine as the output of the combo of both of these may help you avoid having to start over and help you overcome small misconfigurations you may make, well at least I did LOL.

Good luck.
 

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
So after I posted the above, I tried to compile chad dongle from source on my E02. The compiling failed because of missing files. I tried it using both the source file and the SVN checkout method. Any Linux guru's out there, can you figure out how to do it?
 

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
Holy crap, I think it worked. Dongle0 is loaded.....I need to set up a trunk and OB/IB routes. Will report back soon.....


Later: Ok, the module loads and I had to set permissions on ttyUSB0, ttyUSB1 and ttyUSB2.
Had to configure dongle.conf. I set up OB and IB routes - OB works no problem, IB calls don't work as * CLI shows them being sent to an invalid extension. Double checked CID. Not sure what the IB problem is, I'm comparing things to the chan_dongle setup on my BBB Raspbx.
wardmundy, any advice?
 

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
Got IB working....had to change dongle.conf line 'context=default' to 'context=from-trunk-dongle'. Then had to add '[from-trunk-dongle]' section to the bottom of extensions_custom.conf with the following two lines:
[from-trunk-dongle]
exten => _.,1,Set(CALLERID(name)=${CALLERID(num)})
exten => _.,n,Goto(from-trunk,${EXTEN},1
Everything works now.

hecatae you are the man!!!

Here's the E02 in action running Incredible PBX with wifi and NOW WITH CHAN_DONGLE HOORAH!!!!
 

Attachments

  • E02PBX.jpg
    E02PBX.jpg
    906 KB · Views: 52

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
Had some problems later last night. One of the two dongles I used (an E1752) was causing the E02 to freeze with a 'bus error'. I tried a powered USB hub with it and got the same result. This morning I'm using an E153 and hoping that proves more stable. I am still having an issue where the dongle loses permissions after reboot or power down. I'll have to research how to make those permissions automatic at boot time. To set permissions I'm issuing 6 commands for the modem 'chmod 666 /dev/ttyUSBx' (one time each for ttyUSB0, ttyUSB1 and ttyUSB2) and 'chmod a+x /dev/ttyUSBx'(one time each for ttyUSB0, ttyUSB1 and ttyUSB2) .

Some notes about compiling chad_dongle. I unzipped the modified file on my PC and copied the uncompressed folder via Putty to /usr/src/asterisk-11.12.0 on the E02. The 'aclocal && autoconf && automake -a' command showed an error but when I followed it up with './configure --disable-debug --disable-apps --disable-manager --with-asterisk=/usr/src/asterisk-11.12.0/include' the error seemed to get corrected. Notice I changed the reference directory from asterisk-11.11.0 to asterisk-11.12.0 to reflect the actual * version on the Pogoplug.

For the trunk for the dongle, I set up a custom trunk with the dial instruction of 'dongle/dongle0/$OUTNUM$'. Note the post above about the change I had to make to dongle.conf and extensions_custom.conf.

Command's for the Asterisk CLI related to chad_dongle that you will use to load, reload, initialize and show status:
'module load chan_dongle.so', 'dongle start dongle0', 'dongle show device state dongle0', 'core reload now', 'dongle reload now' and 'module reload chan_dongle.so'.

Don't forget you need to load wvdial and usb-modeswitch 'sudo apt-get install wvdial usb-modeswitch' .

We'll see how things go today with the E153 and I'll report back if I have any further problems.
 

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
Been running all day and no observed hiccups. Most of the day it's been running exclusively on wifi so it appears the combo of an Edimax EW-7811 and a Huawei E153 is stable. I've made several GSM test calls OB and IB but nothing longer than a few minutes. Will update if anything changes.
 

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
To set permanent permissions for ttyUSB0, ttyUSB1 and ttyUSB2, all you need to do is add asterisk to the 'dialout' group in Ubuntu. You do that via the following command: 'sudo adduser asterisk dialout'
 

zorka

Guru
Joined
Jul 16, 2009
Messages
41
Reaction score
4
To set permanent permissions for ttyUSB0, ttyUSB1 and ttyUSB2, all you need to do is add asterisk to the 'dialout' group in Ubuntu. You do that via the following command: 'sudo adduser asterisk dialout'


That didn't work for me. What did work was
Code:
Run sudoedit /etc/udev/rules.d/50-ttyusb.rules and stick this in there:
 
KERNEL=="ttyUSB[0-9]*",NAME="tts/USB%n",SYMLINK+="%k",GROUP="dailout",MODE="0666"
Save, exit and replug and you should be up and running. Setting the permission to 666 allows anybody to write to the device.

Taken from http://askubuntu.com/questions/112568/how-do-i-allow-a-non-default-user-to-use-serial-device-ttyusb0
 

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
That didn't work for me. What did work was


Your suggestion is better I must say. I'm curious, which version of the Pogoplug (V4, E02, Mobile, etc.) did you get this to work on? I did it on the E02 which has the 1.2GHz CPU but wondered if there was any difference performance or setup wise on say a Mobile or V4 which has the slower CPU.
 

zorka

Guru
Joined
Jul 16, 2009
Messages
41
Reaction score
4
I'm using it on a V4-A1-01 (pogoplug mobile) with a vodafone K3565 -rev2. I also use it to send incoming SMS to my e-mail and let the sender know that their message is being delivered by e-mail. So far I haven't a problem with incoming or outgoing calls (and SMS), but I must say it is only being used at home (not that many calls)

It did took me a while to get it sorted out, but in the end it seems to be running nice and stable :)
 

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
. I also use it to send incoming SMS to my e-mail and let the sender know that their message is being delivered by e-mail.

Can I ask what you did to add SMS functionality to IPBX? Did you add something to extensions_custom.conf or is there another program or code that you used?
 

zorka

Guru
Joined
Jul 16, 2009
Messages
41
Reaction score
4
I added the following to extensions_custom.conf
Code:
[from-trunk-dongle]
include => dongle-incoming-sms
include => dongle-incoming-ussd
exten => 12345678,1,Set(CALLERID(name)=${CALLERID(num)})
exten => 12345678,n,Goto(from-trunk,${EXTEN},1
 
[dongle-incoming-sms]
exten => sms,1,Noop(Incoming SMS from ${CALLERID(num)} ${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,System(echo '${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${CALLERID(num)}: ${BASE64_DECODE(${SMS_BASE64})}' >> /var/log/asterisk/sms.txt)
exten => sms,n,System(echo "To: [email protected]" > /var/log/asterisk/last_email.txt)
exten => sms,n,System(echo "Subject: [PBX]: New SMS from ${CALLERID(NUM)}" >> /var/log/asterisk/last_email.txt)
exten => sms,n,System(echo "" >> /var/log/asterisk/last_email.txt)
exten => sms,n,System(echo "On ${STRFTIME(${EPOCH},,%d-%m-%Y %H:%M:%S)} you received a TextMessage from ${CALLERID(num)}" >> /var/log/asterisk/last_email.txt)
exten => sms,n,System(echo "" >> /var/log/asterisk/last_email.txt)
exten => sms,n,System(echo "${BASE64_DECODE(${SMS_BASE64})}" >> /var/log/asterisk/last_email.txt)
exten => sms,n,System(sendmail -t -f [email protected] < /var/log/asterisk/last_email.txt)
exten => sms,n,DongleSendSMS(dongle0,${CALLERID(NUM)},"Your response.")
exten => sms,n(end),Hangup()
 
 
[dongle-incoming-ussd]
exten => ussd,1,Noop(Incoming USSD: ${BASE64_DECODE(${USSD_BASE64})})
exten => ussd,n,System(echo '${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${DONGLENAME}: ${BASE64_DECODE(${USSD_BASE64})}' >> /var/log/asterisk/ussd.txt)
exten => ussd,n(end),Hangup()

You do need to recompile chan_dongle with --enable-manager --enable-apps to be able to send from the dialplan.

Replace 12345678 with your number
 

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
The same, but different ;)



View attachment 1573

Either way gets it done. I borrowed one of those right angle USB adapters so the antenna would be oriented vertically. That adds another $4.00 to the price but with the PP's going for $8 on eBay, it's still under the $30 budget assuming you already have a spare 8GB SD card. I think that's pretty cool. When the Asterisk lightweight GUI version of PIAX is available, this thing will be the perfect cheap VOIP appliance.

Edit: Just saw this thread has been "tweeted" by @nerduno He he
Hey PIAF, do you think you could "bake in" chan_dongle to the Pogoplug V4 image?
 

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
Here is how to turn the V4 into a gateway only device for another PBX on the same network:
Assumptions:

-You have confirmed the dongle has voice capability by testing a voice call via the Huawei MobilePartner program on a Windows machine
-On the V4 PP, you have compiled and loaded chan_dongle and confirmed operational status via the Asterisk CLI
-On the V4 PP, you have the custom dongle trunk set up as well as the modifications you needed to make to dongle.conf and extensions_custom.conf (see above posts). In this case the only thing it’s doing for me is acting as a GSM gateway so I didn’t set up any extensions or other trunks.
-The main PBX you will be connecting the V4 PP to is on the same network and subnet and both devices have static IP addresses. Technically you could connect the PP V4 to a PBX through the internet but this would involve having DynamicDNS, Travelin Man and IPTABLES modifications which are beyond the scope of what I was trying to do.
-You are running Asterisk 11 and Freepbx 2.11 on both the V4 PP and the main PBX although this probably would work mixing older / newer versions.

First thing you need to set up:
1.An interconnection SIP trunk on the V4 PP (I call it TOMAINPBX). I only note the entries I made, anything not shown was not entered or left default and I deleted the stock entry in User Details:
Trunk Name: TOMAINPBX (entered in both locations)
Outbound Caller ID: 1235551212
Peer Details:
host= IP address of the main PBX
type=friend
username= TOPPGSMGW
secret=yourmadeuppassword (same PW on both devices)
context=from-trunk

2.An interconnection SIP trunk on the main PBX (I call it TOPPGSMGW). I only note the entries I made, anything not shown was not entered or left default and I deleted the stock entry in User Details:
Trunk Name: TOPPGSMGW (entered in both locations)
Outbound Caller ID: 1235551212
Peer Details:
host= IP address of the Pogoplug
type=friend
username=TOMAINPBX
secret=yourmadeuppassword (same PW on both devices)
context=from-trunk

Once the interconnecting trunks are established on both machines and confirmed operational via the Asterisk Full Status report:

3.On the V4 Pogoplug:
a.One incoming route to handle calls from the dongle to the main PBX interconnection trunk.
Description: FromDongletoOB
DID: DID of the cell SIM including the 1 at the front
Destination: Trunk >> TOMAINPBX
b.One incoming route to handle calls from the main PBX interconnection trunk and send it to the custom dongle trunk.
Description: FromMainPBXtoDongle
DID: 1235551212
Destination: Trunk >> Whatever the name of your custom dongle trunk is.
c.NO OUTBOUND route is required on the V4 Pogoplug to forward the GSM calls.

4.On the main PBX:
a.One incoming route to handle calls from the V4 PP interconnecting trunk.
Decription: FROMPPGSMGW
CID: 1235551212
Open CNAM: checked
CID Superfecta: checked
Set Destination: Extension, Ring Group, IVR or whatever else you have available.
b.One outgoing route to send the applicable dialed calls made from one of the main PBX extensions out through the dongle trunk. Setup the dialing patterns that are appropriate for a cell phone (don’t forget 911, *XX and other dials you might want to make) and trunk selection for matched routes is TOPPGSMGW

And that should be it…….

Edit: I am going to try this with at least two connected dongles (via a powered USB hub) and see if the V4 is able to support simultaneous calls from multiple dongles. I'll report back soon.
 

Jay Deal

Phhhhhhhhttttttt :)
Joined
Dec 26, 2013
Messages
267
Reaction score
85
Well I did finally get a chance to try two dongles on the V4 and it worked with a passive non-powered hub. The problem I ran into was that Asterisk on the main PBX became confused when I set up two interconnecting trunks between the V4 and the main PBX (in my case an Atom based thin client running IPBX on Ubuntu). What would happen, an error would occur because Aterisk would become confused as to which trunk the incoming stream was trying to communicate on so it would reject the stream even though the two trunks had different credentials. It has something to do with the two streams having the same host IP address. I'll retry with one trunk and see if that works as I may have not even needed two separate interconnecting trunks to begin with.
 

Members online

Forum statistics

Threads
25,811
Messages
167,759
Members
19,240
Latest member
nikko
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