Asterisk 11 USB GSM Trunk and Gateway Using Chan_Dongle

Overview: 

Chan_Dongle is driver to use when using USB Dongle such as Huawei 3G Dongle to use for GSM Trunk and GSM SMS Gateway.

Now Let’s start to installing the Asterisk 11 Chan_Dongle driver to your Asterisk 11 or 13 

Step 1: install the required packages needed

  • libbluetooth-dev libncurses5 libncurses5-dev
  • uuid-dev
  • libxml2-dev
  • git-core libtools
  • automake make
  • usb-modeswitch
  • vim vim-common
  • ntp
  • asterisk-dev

Step 1: Go to your favorite directory to download the driver to be use and after Extract the downloaded zip file.

[email protected]:~# cd /home/user/download
[email protected]:~# wget http://www.mytechrepublic.com/wp-content/uploads/2016/03/asterisk-chan-dongle-asterisk11.zip
[email protected]:~# unzip asterisk-chan-dongle-asterisk11.zip
[email protected]:~# cd asterisk-chan-dongle-asterisk11

Step 2: Create Auto-generating aclocal.m4. Automake includes a number of Autoconf macros that can be used in your package (see Macros); some of them are actually required by Automake in certain situations. These macros must be defined in your aclocal.m4 ; otherwise they will not be seen by autoconf

[email protected]:~# aclocal
[email protected]:~# autoconf
[email protected]:~# automake -a

Step 3: After successfully done the above steps we can now start to compile the package using ./configure in below steps

[email protected]:~# ./configure
[email protected]:~# make
[email protected]:~# make install

Step 4: Now compilation is done copy the dongle.conf that was created in your ‘asterisk-chan-dongle-asterisk11/etc’ folder to /etc/asterisk

[email protected]:~# cp etc/dongle.conf /etc/asterisk
[email protected]:~# chmod -R 0777 /etc/asterisk

Step 5: Load the chan_dongle module into your asterisk.

[email protected]:~# asterisk -rvvv
asterisk*CLI> module load chan_dongle.so

Step 6: Edit the dongle.conf file and change the settings of your audio and data tty according to your USB

[dongle0]
 exten=0912345678;your mobile number here
 audio=/dev/ttyUSB1 ; tty port for audio connection; no default value
 data=/dev/ttyUSB2 ; tty port for AT commands; no default value
                    ; or you can omit both audio and data together
                    ; and use imei=123456789012345 and/or imsi=123456789012345
                    ; imei and imsi must contain exactly 15 digits !
                    ; imei/imsi discovery is available on Linux only
 imei=353558042801234
 imsi=515050921461234

Step 7: Edit the /etc/udev/rules.d/92-dongle.rules file and append below text in your file.

[[email protected]]# vim /etc/udev/rules.d/92-dongle.rules

KERNEL==”ttyUSB[012345]”, OWNER=”root”, GROUP=”root”, MODE=”660″

Step 8: Edit your file in /etc/asterisk/extensions.conf to add context to call the chan_dongle

[general]
static=yes
writeprotect=no
clearglobalvars=no

[globals]
; Global variables here

[incoming]
exten => 09123456789,1,Log(NOTICE, Incoming call from ${CALLERID(all)})
exten => 09123456789,n,Dial(SIP/4001)
exten => 09123456789,n,Hangup()

[outgoing]
exten =>
 _X.,1,Log(NOTICE, Dialing out from ${CALLERID(all)} to ${EXTEN} through Dongle0 Provider)
exten => _X.,n,Dial(dongle/dongle0/${EXTEN},60)
exten => _X.,n,Playtones(congestion)
exten => _X.,n,Hangup()

exten => 4001,1,Dial(SIP/4001)
exten => 4001,n,Hangup()
exten => 4002,1,Dial(SIP/4002)
exten => 4002,n,Hangup()

Step 9: Edit /etc/asterisk/sip.conf file and add the extension numbers that will be use in your hardphone or softphone

[general]
 disallow=all
 allow=ulaw
 allow=alaw
 allow=gsm
 qualify=yes
 canreinvite=no
 deny=0.0.0.0/0.0.0.0; to deny all traffic and only allow the valid subnet of your VoIP in permit
 permit=192.31.255.0/255.255.255.0; make sure you only allow your network and no other 

[4001]
 type=friend
 callerid="ext4001" 
 context=outgoing ;This is the context in extensions.conf
 host=dynamic
 secret=secretpassword

[4002]
 type=friend
 callerid="ext4002" 
 context=outgoing ;This is the context in extensions.conf
 host=dynamic
 secret=secretpassword

Step 10: Now reload the asterisk dialplan and sip configuration this is to apply the changes we made during the configuration.

[email protected]:~# asterisk -rvvv
asterisk*CLI> dialplan reload
asterisk*CLI> sip reload

Now you can make test call in your mobile

2 Comments on "Asterisk 11 USB GSM Trunk and Gateway Using Chan_Dongle"

  1. Thank for this tutorial. It is very helpful for me.
    But i still have an issue when running automake -a: The error message is shown bellow
    automake: no `Makefile.am’ found for any configure output

Leave a comment

Your email address will not be published.