Connecting a Huawei E173 3G USB modem to MikoPBX via chan_dongle
The Huawei E173 is a USB 3G modem from Huawei that is compatible with the chan_dongle module for Asterisk. By using this modem with chan_dongle, you can configure Asterisk to make voice calls and send SMS messages over the GSM network, effectively turning the modem into a full-fledged GSM gateway.
Dongle modems can be unstable. They require reliable, stable power and a strong GSM signal.
First, let’s see which USB devices are connected to the PC:
We’re interested in the device "12d1:1001 Huawei Technologies...".
12d1 – the vendor ID.
1001 – the product ID.
For the modem to function properly, you need to switch it to "1001" (modem-only mode).
Next, search for device info using the vendor ID "12d1":
Then check for info by the USB device number "usb 1-1":
We see the modem’s serial devices: ttyUSB0, ttyUSB1, ttyUSB2.
You’ll see something like:
You can now enter AT commands to manage and configure the modem.
AT^CARDLOCK? – Checks SIM lock status and the remaining attempts to enter an unlock code. (The modem’s response: CARDLOCK: A,B,0
. If A=2, modem is unlocked; A=1, locked — SimLock; A=3, you either used all 10 attempts or have a customized firmware. B is the remaining number of attempts, typically 10.)
AT^CARDLOCK="NCK Code" – Unlock the modem to work with all mobile operators (if you have the code).
AT^CVOICE=? – Checks the modem’s voice support state (0 means voice is enabled).
AT^CVOICE=0 – Enables voice functions on the modem.
AT^U2DIAG=0 – Switch the modem into modem-only mode.
Confirm the modem supports voice functions.
The modem must be in "modem-only" mode (ID 1001).
If possible (and if you have a code), unlock the modem for use with any operator.
In the MikoPBX web interface, go to System → Customize System Files.
Open /etc/asterisk/modules.conf
.
Set the mode to "Append to the end of the file".
Add:
Open /etc/asterisk/dongle.conf
for editing.
Choose "Replace Completely".
Paste the following configuration:
Re-open /etc/asterisk/modules.conf
.
Again choose "Append to the end of the file".
Add contexts for SMS and USSD handling:
After configuring dongle.conf, you must restart your PBX.
dongle0 is an arbitrary name of the line. It will be used in the Dial command for outgoing calls.
audio and data are the TTY device paths discovered in the previous step. You may need to swap them if there’s no audio.
Each dongle requires a DID number for correct inbound call handling.
Enter the Asterisk console:
List the dongle devices:
If the Number
column is empty, run:
Replace dongle0 with your line’s identifier, and "79255283744" with the SIM’s phone number.
Restart your PBX afterwards.
In the web interface, go to Call Routing → Incoming Routing.
Create a new rule. In the DID field, specify the SIM’s phone number you set earlier:
In Call Routing → Providers, create a new SIP account with:
Name – “Dongle0” (or any name)
Host or IP – 127.0.0.1
Account Type – “Authentication by IP address, no password”
Copy the Provider ID from the browser address bar (e.g., SIP-TRUNK-C4153448).
In Call Routing → Outbound Routing, create a new rule for sending calls via the modem:
Go to System → System file customization and open /etc/asterisk/extensions.conf
. Choose “Add to end of file” and add: