LogoLogo
www.mikopbx.comTelegram communityForum
English
English
  • MikoPBX Manual
    • Quick start
    • Getting to know MikoPBX
    • System requirements
  • Installation
    • Standalone Computer
    • Virtual Machine
      • VMware ESXi
      • VMware Fusion
      • VirtualBOX
      • VMware Workstation Pro
      • Hyper-V
      • Proxmox
    • Cloud
      • AWS
        • AWS deployment guide
        • AWS Marketplace
      • Microsoft Azure
      • Google Cloud
        • Google Cloud deployment guide
        • Google Cloud Marketplace
      • Hetzner cloud (In dev)
      • Digital Ocean
      • Alibaba Cloud
      • Vultr
    • Docker container
      • Docker installation and creating a user and directories
      • Running MikoPBX in a container
      • Running MikoPBX using docker compose
  • User manual
    • Telephony
      • Extensions
      • Call queues
      • IVR Menu
      • Conferences
      • Sound files
      • Call detail records (CDR)
    • Call Routing
      • Telephony providers
      • Incoming routing
      • Outbound routing
      • Night and Holiday Switch
    • Modules
      • Registration in the modules marketplace
      • Module management
      • Application dialplans
    • Maintenance
      • PBX update
        • Updating from the web interface
        • Updating from the MikoPBX console
        • Updating the docker
      • System log entries
      • Reboot
    • Network and Firewall
      • Network interface
      • Firewall
      • Anti brute force
    • System
      • General settings
      • Time Settings
      • Mail settings
        • Setting up E-mail notifications for the Gmail mail service
      • Asterisk Manager Interface(AMI)
      • System files customisation
  • FAQ
    • Setup
      • Installation on MDADM RAID1
      • Fine-tuning the firewall
      • Migrating MikoPBX to Another Server
        • Transfer Using Backup
        • Transfer using scheduled backup (SFTP)
        • Transfer using rsync
      • Reset to factory settings
      • Monitoring Providers on MikoPBX
    • Management
      • Change the login name
      • The extra disk space has run out, the disk size has increased
      • Storing Recordings in a Shared Windows Folder
      • Resetting WEB Interface Credentials
      • Backup Internet and Provider Re-Registration
    • Troubleshooting
      • Connecting to the PBX using SSH
        • Connecting to PBX using SSH client (Putty)
        • Connecting via SSH (Windows)
        • Connecting via SSH (Linux/MacOS)
      • Connecting to a PBX using WinSCP
      • Getting logs using the tcpdump application
      • Capturing Logs from PBX using Wireshark
      • Traffic Analysis Using Sngrep
      • Adjusting the volume
      • Troubleshooting sound problems
      • Jitter Configuration
    • Incoming Routing
      • Choosing a provider when redirecting to a mobile
      • Notification of Employment, Call Waiting
      • Black and white lists
      • Allow additional dialing of the internal number in the queue
      • Output of information about the did number
      • Setting individual non-working hours for a provider account
      • An example of the implementation of a typical route of incoming calls
      • Routing by DID Number
      • Normalization of incoming phone number
      • Basic IVR example
    • Outbound routing
      • Add P-Preferred-Identity and Remote-Party-ID header
      • Conference with a regular external subscriber
      • Outgoing with internal number dialing
      • Remove all special characters from the dialed number
      • Prohibiting calls via a backup route
      • Calls to emergency numbers
      • Number Templates
        • Uniform distribution of outgoing
        • Sample template: calls to another country
        • How to prohibit the replacement of "+" with 00
        • Changing the number prefix from "+345" to "347"
        • Changing the number prefix from "345, 347" to "+345"
        • Removing the area code from the number
        • Adding the prefix "1" to the number
      • Making Calls Through a Specific Provider
    • Scenarios and cases
      • Generate extensions by REST API
      • Missed Call Telegram Notifications
      • Call the company from your mobile and dial an extension to call a third-party company
      • Sending an incoming fax to email
      • Customer's assessment of the quality of service
      • Simulation of external calls
      • Disabling "off-hours" for VIP numbers
      • Registering multiple accounts from one provider
      • Setting up individual non-working hours for several providers on one host
      • Disable forwarding to mobile for internal calls
      • Unique background music for the queue
      • Pause for Queue agent
      • Dynamic Queue Agents
      • Setting up the "Paging" function
      • Limit the number of authorizations per SIP account
      • Call Monitoring (ChanSpy)
      • Conversion of Call History FreePBX -> MikoPBX
      • SSL Certificate for MikoPBX Web Interface from OPNSense
      • Hiding the Caller’s Number from Employees
    • Interconnections
      • Merging two MikoPBX
      • Integration of MikoPBX and Grandstream UCM6202
      • MikoPBX and FreePBX (PJSIP)
      • MikoPBX and FreePBX (IAX)
    • VoIP providers
      • Mango
      • Zadarma
    • Softphones
      • Bria Solo
      • Sessiontalk
      • MicroSIP
      • Groundwire
      • Zoiper
      • Jitsi
      • PhonerLite
      • Linphone (MacOS)
      • Telephone(MacOS)
      • Configuring webRTC client SIMPL5
      • Softphone.pro
      • 3CX Softphone
      • PortSIP
    • IP telefones
      • Snom D120
      • Yealink T19
    • VoIP gateways
      • GoIP4
      • Grandstream HT503
      • Using a Huawei E173 USB Modem for Calls (chan_dongle)
  • Modules
    • MIKO modules
      • for 1C:Enterprise
        • Панель телефонии 4.0 для 1С
        • Панель телефонии 1.0 для 1С
        • Модуль умной маршрутизации
      • Users groups
      • CRM Bitrix24 integration
      • Autoprovision
      • Let's Encrypt
      • Access control management
      • Module auto dialer
      • Backup
      • Synchronization with LDAP/AD
      • Callback module
      • Extended call history
  • other
    • Changelog
      • MikoPBX 2024.1
      • MikoPBX 2023.2
      • MikoPBX 2023.1.223
Powered by GitBook
On this page
  • Preparing the USB Modem
  • Checking the Modem Settings
  • Example Commands
  • What to Verify?
  • chan_dongle for Asterisk
  • Configuring DID
  • Configuring an Inbound Route
  • Configuring Outbound Routes

Was this helpful?

Edit on GitHub
Export as PDF
  1. FAQ
  2. VoIP gateways

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.

Dongle modems can be unstable. They require reliable, stable power and a strong GSM signal.

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":

dmesg | grep 'usb 1-1'

[    2.262750] usb 1-1: new high-speed USB device number 2 using ehci-pci
[    2.828272] usb 1-1: New USB device found, idVendor=12d1, idProduct=1001, bcdDevice= 0.00
[    2.828479] usb 1-1: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[    2.828641] usb 1-1: Product: HUAWEI Mobile
[    2.828754] usb 1-1: Manufacturer: HUAWEI Technology
[    2.856994] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[    2.861194] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[    2.864265] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2

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

minicom -D /dev/ttyUSB0

You’ll see something like:

Welcome to minicom 2.8

OPTIONS: I18n
Compiled on Apr 26 2021, 18:06:16.
Port /dev/ttyUSB0, 12:30:42

Press CTRL-A Z for help on special keys

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:

load => chan_dongle.so
  1. Open /etc/asterisk/dongle.conf for editing.

  2. Choose "Replace Completely".

  3. Paste the following configuration:

[general]
interval=15

[defaults]
context=public-direct-dial
group=0
rxgain=0
txgain=0
autodeletesms=yes
resetdongle=yes
u2diag=-1
usecallingpres=yes
callingpres=allowed_passed_screen
disablesms=no

language=en
smsaspdu=yes
mindtmfgap=45
mindtmfduration=80
mindtmfinterval=200

callwaiting=auto
disable=no
initstate=start
dtmf=relax

[dongle0]
audio=/dev/ttyUSB1
data=/dev/ttyUSB2
  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:

[dongle-incoming-ussd]
exten => ussd,1,Noop(Incoming USSD: ${BASE64DECODE(${USSDBASE64})})
exten => ussd,n,Hangup()

[dongle-incoming-sms]
exten => sms,1,Noop(Incoming SMS from ${CALLERID(num)} ${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,Hangup()
  1. After configuring dongle.conf, you must restart your PBX.

Helpful resources:

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

Configuring DID

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

  1. Enter the Asterisk console:

asterisk -r
  1. List the dongle devices:

mikopbx*CLI> dongle show devices
ID      Group State RSSI Model Firmware         IMEI IMSI Number
dongle0 0     Free  12   E173  11.126.15.00.209 ***  ***  79255283744
  1. If the Number column is empty, run:

dongle cmd dongle0 AT+CPBS="ON"
dongle cmd dongle0 AT+CPBW=1,"79255283744",145

Replace dongle0 with your line’s identifier, and "79255283744" with the SIM’s phone number.

Restart your PBX afterwards.

Configuring an Inbound Route

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

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

Configuring Outbound Routes

  1. 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”

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

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

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

[SIP-TRUNK-C4153448-outgoing-custom]
exten => _[0-9*#+]!,1,Set(DIAL_COMMAND=Dongle/dongle0/${number})
 same => n,return

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

Last updated 2 months ago

Was this helpful?

See the for a description of configuration and options.

More details in .

dongle.conf file
chan_dongle documentation
"Incoming routing" section
DID Number field
Provider Parameters
Provider ID
Outbound route
Code for the file "extensions.conf"