Asterisk on Raspberry Pi as GSM gateway


As usually, laconic post.

Yesterday I have installed chan_dongle at this Asterisk PBX distributive for Raspberry Pi.

Raspberry PI with Huawei 3G dongle

What is chan_dongle? It is driver for asterisk PBX, allowing to use some Huawei 3G USB dongles like voice board to transmit voice, SMS and USSD. Just think about your own self-made GSM gateway.

Instructions

mount - find your card (disk1 in my case)
diskutil unmountDisk /dev/disk1
sudo dd if=raspbian_wheezy_20120608.img of=/dev/rdisk1 bs=1m

Installation

Power on Raspberry Pi, find its ip address, ssh and:

  • Upgrade system
raspbx-upgrade
  • Install necessary software:
apt-get install usbutils unzip autoconf automake

# compile USB-modeswitch
cd /usr/src/

wget http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-1.2.5.tar.bz2
wget http://www.draisberghof.de/usb_modeswitch/usb-modeswitch-data-20121109.tar.bz2

tar -jxvf usb-modeswitch-1.2.5.tar.bz2
tar -jxvf usb-modeswitch-data-20121109.tar.bz2

cd usb-modeswitch-1.2.5
make all
make install

cd ../usb-modeswitch-data-20121109
make install

cd ..
  • Now plug (if plugged, eject and plug) Huawei USB stick and check lsusb output:
lsusb | grep Huawei

You should see:

Bus 001 Device 005: ID 12d1:140c Huawei Technologies Co., Ltd.
  • Now switch USB-stick to the modem mode. Values foe -v and -p flags I get from previous step and value for -M flag, I get from google search for my brand.
usb_modeswitch -v 0x12d1 -p 0x140c -H -s 5 -M 55534243000000000000000000000011060000000000000000000000000000
  • Download and install chan_dongle:
wget https://github.com/jstasiak/asterisk-chan-dongle/archive/asterisk11.zip

unzip asterisk11.zip

cd asterisk-chan-dongle-asterisk11/
aclocal
autoconf
automake -a
./configure
make all
make install
cp etc/dongle.conf /etc/asterisk/
cp /etc/extensions.conf /etc/asterisk/extensions-dongle.conf
  • Restart Asterisk PBX and check modem status:
asterisk -rx "core restart now"

# done, checking devices
asterisk -rx "dongle show devices"

You should see something like this:

# *CLI> dongle show devices
# ID           Group State      RSSI Mode Submode Provider Name  Model      Firmware          IMEI             IMSI             Number
# dongle0      0     Free       2    0    0       Yoigo          E1762      11.126.13.00.00   xxxx yyy  Unknown
# *CLI>

Done, next step is configuration of your GSM gateway, I will write another post about this. Still playing with device. Quality is good, better than I get with Portech GSM gateway and price per port is much better, plus can send and receive SMS and USSD.

Some useful links:

Good luck!

If you would like to play with my system, download latest image here: j.mp/tinypbx. Standard flashing instructions: gunzip .gz file, insert SD card, flash with Linux DD command… This resource for example, describes flashing procedure quite well.