Using a Huawei E173 USB Modem for Calls (chan_dongle)

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.

Preparing the USB Modem

  1. First, let’s see which USB devices are connected to the PC:

lsusb
Bus 001 Device 002: ID 12d1:1001 Huawei Technologies Co., Ltd. E169/E620/E800 HSDPA Modem
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

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).

  1. Next, search for device info using the vendor ID "12d1":

dmesg | grep 12d1
[    2.828272] usb 1-1: New USB device found, idVendor=12d1, idProduct=1001, bcdDevice= 0.00
  1. Then check for info by the USB device number "usb 1-1":

We see the modem’s serial devices: ttyUSB0, ttyUSB1, ttyUSB2.

If these devices appear, half the work is done. If they’re missing, the modem may be in a mode other than 1001. The product ID can vary with different firmware versions.

On some devices, modem-only mode may appear as "140c".

Checking the Modem Settings

You’ll see something like:

You can now enter AT commands to manage and configure the modem.

Example Commands

  • 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.

What to Verify?

  1. Confirm the modem supports voice functions.

  2. The modem must be in "modem-only" mode (ID 1001).

  3. If possible (and if you have a code), unlock the modem for use with any operator.

chan_dongle for Asterisk

  1. In the MikoPBX web interface, go to System → Customize System Files.

  2. Open /etc/asterisk/modules.conf.

  3. Set the mode to "Append to the end of the file".

  4. Add:

  1. Open /etc/asterisk/dongle.conf for editing.

  2. Choose "Replace Completely".

  3. Paste the following configuration:

  1. Re-open /etc/asterisk/modules.conf.

  2. Again choose "Append to the end of the file".

  3. Add contexts for SMS and USSD handling:

  1. After configuring dongle.conf, you must restart your PBX.

Helpful resources:

Configuring DID

Each dongle requires a DID number for correct inbound call handling.

  1. Enter the Asterisk console:

  1. List the dongle devices:

  1. If the Number column is empty, run:

Restart your PBX afterwards.

Configuring an Inbound Route

  1. In the web interface, go to Call Routing → Incoming Routing.

"Incoming routing" section
  1. Create a new rule. In the DID field, specify the SIM’s phone number you set earlier:

DID Number field

Configuring Outbound Routes

  1. In Call Routing → Providers, create a new SIP account with:

    • Name – “Dongle0” (or any name)

    • Host or IP127.0.0.1

    • Account Type – “Authentication by IP address, no password”

Provider Parameters
  1. Copy the Provider ID from the browser address bar (e.g., SIP-TRUNK-C4153448).

Provider ID
  1. In Call Routing → Outbound Routing, create a new rule for sending calls via the modem:

Outbound route
  1. Go to System → System file customization and open /etc/asterisk/extensions.conf. Choose “Add to end of file” and add:

Replace SIP-TRUNK-C4153448 and dongle0 with your IDs.

Code for the file "extensions.conf"

Last updated

Was this helpful?