There was a need to configure Asterisk for making calls via a 3G modem. After a bit of searching, I found a module called chan_dongle.
We have Asterisk 11 on Ubuntu. The modem is a Huawei E173 (Djuice).
First, we need to enable voice functionality and unlock the modem from the operator's SIM cards. I did this using the DC-Unlocker program. I liked this program so much that I decided to buy credits for unlocking.
Well, let's get started.
Download chan_dongle here or here.
Extract it and enter the directory:
tar xzvf chan_dongle-1.1.r14.tgzcd chan_dongle-1.1.r14/
Compile and install:
aclocal && autoconf && automake -a./configure
make
make install
On Asterisk 11, you may encounter the following error:
In file included from app.c:21:0: /usr/include/asterisk/version.h:1:2: error: #error «Do not include ‘asterisk/version.h’; use ‘asterisk/ast_version.h’ instead.» app.c: In function ‘app_register’: app.c:162:3: warning: passing argument 2 of ‘ast_register_application2’ from incompatible pointer type [enabled by default] In file included from app.c:20:0: /usr/include/asterisk/module.h:458:5: note: expected ‘int (*)(struct ast_channel *, const char *)’ but argument is of type ‘int (*)(struct ast_channel *, void *)’ make: *** [app.o] Error 1
Solution:
1. Download the source code with the patch
2. Install autoconf and automake
3. Extract the source, go to its directory, and execute the commands one by one: aclocal, autoconf, automake -a
4. Install chan_dongle as usual: ./configure, make, make install
5. Copy the default config from etc/dongle.conf to the Asterisk config directory.
The installation is now complete. Let's move on to configuration.
First, let's check if the system has detected our modem by running:
ls /dev/ | grep USB
If you see something like this:
ttyUSB0 ttyUSB1 ttyUSB2
Then everything is fine, and we can proceed.
Navigate to the Asterisk directory and open dongle.conf:
cd /etc/asterisk/vim dongle.conf
It should look something like this:
[dongle0] audio=/dev/ttyUSB1 data=/dev/ttyUSB2 context=income
Example configuration for incoming calls in extensions.conf:
[income] exten => +380XXXXXXXXX,1,Dial(SIP/100) exten => +380XXXXXXXXX,n,hangup
Example configuration for outgoing calls in extensions.conf:
[out] exten => _X.,1,Dial(dongle/i:XXXXXXXXXXXXX/${EXTEN}) exten => _X.,n,hangup
Where XXXXXXXXXXXXX is the IMEI of the modem you want to use for the call.
Note: Never use the extension _X. as it is very insecure!
That's it. The modem and Asterisk are ready for calls.
