GSM VoIP Gateway with Chan_dongle

A highly affordable GSM VoIP gateway can be obtained using Huawei E155X or compatible USB modems and chan_dongle, providing both inbound and outbound calls on GSM/3G networks.

Hardware requirements

Chan_dongle is able to work with many different USB modems from Huawei, such as K3715, E169 / K3520, E155X, E175X, K3765 and others. Read the full compatibility list here.
Before connecting the modem to your RPi, be sure to use a power supply rated at least 1A, better 1.2A or more. If your power supply does not provide enough current to power both the RPi and the modem, you can get problems booting the RPi, or calls to/from the GSM network fail with error “dongle disconnected”.
Alternatively a powered USB hub can be used as well. If you want to use 2 modems, an additional WiFi connection or other devices that require considerable amount of current, a powered USB hub is absolutely required.
In case you are using one of the older 256MB models with F1 and F2 still in place, you might want to consider bridging over F1 and F2, read more details here. This is however not required on the newer 512MB models, or when using a powered USB hub.

Not all Huawei USB modems work out of the box, on some of them voice calling capability has to be enabled first, some need to be upgraded with the latest firmware. Details on this can be found on the original chan_dongle wiki.
Before inserting the SIM into your modem please deactivate the PIN on your card. This can be done with any phone. Insert the SIM into your phone, deactivate PIN and you’re done. You can also use the Mobile Partner software – which comes with the modem itself – on a Windows computer to do this.

Setup and configuration

Once your modem has PIN deactivated, latest firmware and voice enabled, run this command:


This installer script installs, and creates an initial configuration. The script is provided with upgrade #11 (and improved further with upgrade #12). Once the installer has finished, connect your modem to the RPi. If it was connected already before, unplug it now and plug it in again. Some older modems still require usb_modeswitch to enable data/audio mode, for those a complete reboot of the RPi is recommended at this point.

Then log into FreePBX, in Connectivity – Trunks click Add Custom Trunk. Provide a trunk name, set Outbound CallerID to the number of your SIM, and enter in the field Custom Dial String:


Add an outbound route to use this trunk, as well as an incoming route. On the incoming route set DID Number to your SIM number, precisely matching the number you entered when running the install-dongle script.

More details on how to setup inbound and outbound routes can be found in the forum.

Sending and receiving SMS

The install-dongle script provides a few basic options to send and receive SMS. Received messages can be forwarded by email. If no email address is specified, messages are stored in /var/log/asterisk/sms.txt instead.
Additionally, received messages can optionally be forwarded to a mobile phone number on top of sending them by email. This is done through the first dongle0, your mobile operator’s charges apply for sending SMS.
In order to send out custom messages, a password protected web page can be activated during the install-dongle run. This page is located at http://raspbx/sms or http://raspbx.local/sms (for Mac).
A web page for sending USSDs is optionally available. Install it with:

apt-get install ussd-webpage

The page can be found at http://raspbx/ussd or http://raspbx.local/ussd (for Mac).


If it doesn’t work at this point, at first check if the interfaces of your modem match the configuration:

ls -l /dev/tty*

2 devices, ttyUSB1 and ttyUSB2 should show up. If the numbers are different, something like ttyUSB0 and ttyUSB1, edit /etc/asterisk/dongle.conf and change the values below [dongle0] accordingly.
Many modems require the usb_modeswitch program to switch over from CD-drive mode (for installing Windows drivers) to modem mode. The /dev/ttyUSB devices will not appear before the switch-over was done. Make sure to have all the latest upgrades on recent Debian Jessie based images to fix some initial bugs with usb_modeswitch. If your modem is still not switching it might be necessary to add a custom rule for usb_modeswitch.

Some users have reported voice calling with a specific mobile operator was not working, while using a sim card from a different provider with the same modem and RPi worked perfectly fine.

Troubleshooting power problems
In case the modem devices ttyUSB1 and ttyUSB2 are disappearing as soon as a call is set up (or also at other times), and later they appear again, it is most likely the modem is not sufficiently powered and thus disconnects again and again. Try these options:

  • Remove any USB extension cord from the modem and connect it directly.
  • In case a powered USB hub is used, try a different one or even try without it. With some of those hubs the modems just don’t work properly, although the current rating of the hub’s power supply is high enough.
  • If the modem is directly connected to the RPi (without a hub), the power supply has to power them both. Try different power supplies, as some have problems to keep their output voltage stable under higher load.
  • As a last resort, you can also try to use a different modem.

For more information, read the complete documentation here:

Modems reported working/not working

On top of the compatibility list on the original chan_dongle wiki, users of RasPBX have reported several modems to work fine with the RPi:

  • E153
  • E1550
  • E1552
  • E156G
  • E160
  • EG162
  • E166
  • E169
  • E171
  • E173 (some types of E173 seem to not work, only E173 with Qualcomm chipsets do work)
  • E1750
  • E180
  • E303
  • K3520 (not to confuse with K3520-z)
  • K3715
  • K3765a

The following modems had issues and could not me made working so far. Please let us know if they work for you nonetheless:

  • E150
  • E1752
  • E303C
  • E352
  • K3520-z

236 thoughts on “GSM VoIP Gateway with Chan_dongle

  1. I was able to solve it with the below steps, in case anyone is interested:
    1) Create a new ring group “600” with two members:

    your primary SIP extension (let’s say 800)
    your cellular GSM that you carry with you when traveling (not the SIM from your HUAWEI!)

    set the ring group type to “ringall”. This way, if you are on your SIP phone you will accept the SIP call there, if not, it will ring your GSM cell over the GSM trunk. If you prefer to only get calls on your personal GSM, you can skip the ring group, and just create a new extension with type “Other” and enter the personal GSM number that you want it to dial.

    After you setup your SIP trunks and inbound routes for your DIDs, (the calls you will receive via SIP), set as destination the ring group you created above (or the extension, if you only want SIP2 GSM forwarding).

    One really cool thing to do is to find a SIP provider with multiple points of presence globally, so SIP routing within their network is fast. for example my SIP provider has presence in Asia and US through their own network.

    I setup three RPi- GSM gateways and they all do the same thing, SIP-2-GSM and vice versa.

    GSM1: US
    GSM2: Asia
    GSM3: EU

    When I am in US, I set my Asian and European GSM gateways to accept local GSM calls, and forward them through a SIP trunk to one of my DIDs. Then my US gateway accepts the call on another trunk (by the same SIP provider), and forwards it to my US GSM.

    When I am in China, I set my US and EU GSM gateways to accept local GSM calls, and forward them via SIP to my China GSM gateway (which then forwards over GSM to my prepaid cell). I have also enabled DISA on this gateway, so I can call from my Chinese cell and get a dial tone, to dial out to the world through my SIP provider.

    Overall it’s a great system, couldn’t be happier.. with the up front cost of $50 in each country for RPi+E153, and then one prepaid local SIM card in each, and around $20 in SIP credit, I have a bunch of DIDs that I can route globally.

    One thing to note is that a hardware firewall in each location and static IP is a good thing to have, especially if your provider supports IP based authentication for SIP trunks.

    I haven’t figured out yet how to make the dongle pass the original caller’s CLI instead of its own SIM card number when it forwards calls to me. If anyone has ideas Iโ€™d appreciate it!

    • It is possible if you are using a passthrough outbound trunk,but you can not change your caller id when you are using a gsm dongle as outbound truck,the reason is simple, cell network provider don’t allowed caller id passthrough,otherwise you can show any number you want to the callee.

  2. Hello thanks for the great howto

    I’d like the GSM dongle to forward all calls to another phone number, but I cant figure out how to do it.

    I have two inbound SIP trunks (vitelity) and I want both of them to be routed through the GSM dongle to another GSM number. Is this possible?

    I have setup the inbound trunks from vitelity only, and I can see the calls hitting the pbx, but then I don’t know how to forward them to my destination. Thanks!

  3. Failure to install chen-dongle๏ผš
    root@raspbx:~# install-dongle
    Installing GSM VoIP gateway with chan_dongle.
    Please read the documentation at

    Please enter the phone number of your SIM card
    (defaults to +1234567890 if left blank): +8618500421846
    Send incoming SMS to email address
    (leave empty to disable SMS forwarding):
    Forward incoming SMS to mobile phone number (via dongle0)
    (leave empty to disable):
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    The following extra packages will be installed:
    libjim0debian2 usb-modeswitch-data
    Suggested packages:
    comgt wvdial
    The following NEW packages will be installed:
    asterisk11-chandongle libjim0debian2 usb-modeswitch usb-modeswitch-data
    0 upgraded, 4 newly installed, 0 to remove and 3 not upgraded.
    Need to get 441 kB of archives.
    After this operation, 1,208 kB of additional disk space will be used.
    WARNING: The following packages cannot be authenticated!
    libjim0debian2 usb-modeswitch-data usb-modeswitch
    E: There are problems and -y was used without –force-yes
    Error installing chan_dongle and usb-modeswitch

  4. Hi, first of all thank you so much for your work and this amazing tutorial.
    I managed to get everything working but for some strange reason all the outgoing calls routed throught the dongle are always getting hung up after a couple of minutes. No matter if I initiate the call from an extension or if it is an incoming call (from my DID), it seems like something is going on and I’ve tried absolutely everything to fix it or to find the reason, but so far no luck :(.
    Please any hint you can give me to fix this problem will be greatly appreciate it
    Thanks heaps!!

  5. Hi!
    try to install E1552,voice enabled
    I got following error:
    root@raspbx:~# install-dongle
    Installing GSM VoIP gateway with chan_dongle.
    Please read the documentation at

    Please enter the phone number of your SIM card
    (defaults to +1234567890 if left blank):
    Send incoming SMS to email address
    (leave empty to disable SMS forwarding):
    Forward incoming SMS to mobile phone number (via dongle0)
    (leave empty to disable):
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    usb-modeswitch is already the newest version.
    The following NEW packages will be installed:
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 82.9 kB of archives.
    After this operation, 222 kB of additional disk space will be used.
    Err wheezy/main asterisk11-chandongle all 1.0 -1
    404 Not Found
    Failed to fetch gle/asterisk11-chandongle_1.0-1_all.deb 404 Not Found
    E: Unable to fetch some archives, maybe run apt-get update or try with –fix-mis sing?
    Error installing chan_dongle and usb-modeswitch

    any suggestion!

  6. Huawei E166 is working too. I tested: send SMS (from /sms site), forward SMS to mail, forward SMS to other phone.

    Incoming calls. I assume outgoing works, but waaaay cheaper to use landline and didn’t want to mess up my outbound routing.

    Raspberry pi (256M model) , 2x SPA 3102 (sip trunk), Huawei E166 with Claro (Costa Rica)…

    The only crappy thing is that if you use a “subject” and “message” field from the phone (a’la iPhone) you only get the message field. Both via mail, both via SMS. Strange.

    Thanks, the page made this happen in my 15 minutes coding break ๐Ÿ™‚ .
    Was bugging me to pay for a full sub for just a backup net. Now I can use the phone if the landline dies. Maybe now I can have my asterisk in my car :)….

  7. Hi,
    I’m new to asterisk. I tried installing the latest raspbx version following the procedures mentioned in this blog. I’m getting an error while booting…

    not starting asterisk with incorrect system time…

    also in FreePBX i see ERROR for Asterisk service. The Raspberry Pi is connetced to network with DHCP enabled.

    Could someone help me figure out what’s wrong am i doing?

    Help is appreciated.

    Thanks & Regards,

    • Your router is apparently blocking connections from your RPi to outside NTP servers. You need to permit ouside connections such that the time can be set through NTP. Alternatively you can also manually set the time. Asterisk will then start. Also have a look at the documentation.

  8. Does anyone know if this setup can be modified to control SIM banks like the wavecom q2303s out of china? If so any guidance on mods needed would be much appreciated

    • I have applied this patch to chan_dongle, you can download the patched module here.
      The situation seems to have improved, but somehow it is not sufficient yet. I have tried to send SMS with an email address as sender instead of a number. The SMS was received until the @ sign and then cut off. At least the SMS is no longer rejected completely as it was before, and it should work if you don’t have @ signs anywhere in the text.
      Please try out the module and report your experiences.

  9. Hi,

    I have issues with receiving SMS of numbers which have letters in it. I got the following message in debug mode: Error parsing incoming message.

    Anyone know how to fix this?

    • This is unfortunately a bug in chan_dongle. Please report it on the original chan_dongle forum.

  10. when I tried to install chan_dongle, there is a prompt : “root@raspbx:/usr/src/asterisk-chan-dongle-asterisk11# automake -a
    automake: no `’ found for any configure output”

    how can I make it through? Below is the full log, thanks for help

    root@raspbx:/usr/src/asterisk-chan-dongle-asterisk11# automake -a
    automake: no `’ found for any configure output
    root@raspbx:/usr/src/asterisk-chan-dongle-asterisk11# ./configure
    checking build system type… armv6l-unknown-linux-gnueabihf
    checking host system type… armv6l-unknown-linux-gnueabihf
    checking target system type… armv6l-unknown-linux-gnueabihf
    checking for a BSD-compatible install… /usr/bin/install -c
    checking whether build environment is sane… yes
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    root@raspbx:/usr/src/asterisk-chan-dongle-asterisk11# make all
    config.status: creating Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    gcc -shared -Xlinker -x -o app.o at_command.o at_parse.o at_queue.o at_read.o at_response.o chan_dongle.o channel.o char_conv.o cli.o helpers.o manager.o memmem.o ringbuffer.o cpvt.o dc_config.o pdu.o mixbuffer.o pdiscovery.o
    root@raspbx:/usr/src/asterisk-chan-dongle-asterisk11# make install
    config.status: creating Makefile
    config.status: creating config.h
    config.status: config.h is unchanged
    config.status: executing depfiles commands
    /usr/bin/install -c -m 755 /usr/lib/asterisk/modules
    root@raspbx:/usr/src/asterisk-chan-dongle-asterisk11# cp etc/dongle.conf /etc/asterisk/
    root@raspbx:/usr/src/asterisk-chan-dongle-asterisk11# cp /usr/src/asterisk-chan-dongle-asterisk11/etc/extensions.conf /etc/asterisk/extensions-dongle.conf
    root@raspbx:/usr/src/asterisk-chan-dongle-asterisk11# asterisk -rx “core restart now”
    root@raspbx:/usr/src/asterisk-chan-dongle-asterisk11# asterisk -rx “dongle show devices”
    ID Group State RSSI Mode Submode Provider Name Model Firmware IMEI IMSI Number
    dongle0 0 Not connec 0 0 0 NONE Unknown

        • HELP
          I am trying to implement install-dongle and following message show up:
          Please enter the phone number of your SIM card
          (defaults to +1234567890 if left blank):
          Send incoming SMS to email address
          (leave empty to disable SMS forwarding):
          Forward incoming SMS to mobile phone number (via dongle0)
          (leave empty to disable):
          Reading package lists… Done
          Building dependency tree
          Reading state information… Done
          The following extra packages will be installed:
          libjim0debian2 usb-modeswitch-data
          Suggested packages:
          comgt wvdial
          The following NEW packages will be installed:
          asterisk11-chandongle libjim0debian2 usb-modeswitch usb-modeswitch-data
          0 upgraded, 4 newly installed, 0 to remove and 12 not upgraded.
          Need to get 285 kB of archives.
          After this operation, 831 kB of additional disk space will be used.
          WARNING: The following packages cannot be authenticated!
          E: There are problems and -y was used without –force-yes
          Error installing chan_dongle and usb-modeswitch

  11. Hello Gernot,
    thanks for the warm comments on our blog from april. I read the timeline you compiled and am glad that science and development on the matter goes on within the community !!

    One thing though – please note that the link you provide at the beginning of this thread from april 3 is broken:

    Please change the link to the actual one:

    Thanks, and keep up the awesome work !


  12. Hello,

    with your help i was able to configure it and it’s up and running. thanks
    so calls comes into SIP # and it get forward to DISA module and it goes out thru
    what i would like to do is to call the and calls gets forward out to google voice number. is that possible? thanks in advance

  13. E180.
    To make dongle E180 working change dongle.conf (solution widely known)
    remove lines:
    and add:
    imei=123456789012345 (your modem imei)

    • Thank you for this information! It should also work by just entering the correct ttyUSB devices for audio and data.

  14. hi all!

    I have setup RasPBX with K3765 dongle and it is working fine but I noticed when dongle receive a SMS that includes @ sign it gets truncated at the @ sign when I received it on my email.

    Iโ€™m forwarding SMS to my email configured during installation with the provided script. When dongle receives a SMS verbose output also shows SMS truncated at the @ sign.

    I can see BASE64_DECODE function used in extensions_custom.conf to solve \n symbol (multiline) issue is there similar solution for this?

    Solving this is important to me because I have setup some twitter feeds to receive as SMS and I don’t receive them since messages always starts with @ sign.

    Any help appreciated. And thanks for this fantastic project.

    • This seems to be an issue of chan_dongle. You could use ${SMS} instead of ${BASE64_DECODE(${SMS_BASE64})} in /etc/asterisk/extensions_custom.conf but this does not remove the problem of truncated sms texts after the @. Therefore I’m quite sure this needs to be debugged in the chan_dongle sources.

  15. I need your help validate the following setup please,
    I need to get a sip account with DID configured on the raspbx which also has a trunk to dial out thru GSM in different country

  16. Hello,
    i have my custom trunk using AT&T 4G SIM which is for data only (myfi)
    when i try to dial out i am getting error that calls are not allowed on that line. any help please

  17. Thanks for the excellent documentation!

    I got my Huawei E173 working but I’m having issues sending DTMF tones. It just says “Error sending DTMF” without giving any additional info even with debugging enabled and the highest verbosity level set. Any idea if there’s some particular setting that I need to toggle to get my dongle to produce DTMF tones?

  18. Hi I recently got my BeagleBoneBlack and installed Raspbx on it. It works perfectly. I am using Huawei E303S modem. I found one issue that ussd command is not working with E303S. After searching on chan_dongle project page I saw an other fellow have similar issue which is due to encoding type supported by E303S is 7bit but default is UCS2.
    who conversation can be seen here!topic/chan_dongle/AV5TGSXc6sg
    after adding his model to at_response.c solved the issue.
    I do know how to compile chan_donlge on x86 hardware but I don’t know about arm. Can anyone help me to compile or guid me how to compile chan_dongle on beaglebone with the modified at_response file as shown below
    static int at_response_cgmm (struct pvt* pvt, const char* str)
    unsigned i;
    /* NOTE: in order of appears, replace with sorter and binary search */
    static const char * const seven_bit_modems[] = {
    “E303S” /*<model, str, sizeof (pvt->model));

    for(i = 0; i model, seven_bit_modems[i]))
    pvt->cusd_use_7bit_encoding = 1;
    pvt->cusd_use_ucs2_decoding = 0;
    return 0;


    • Thanks. I have already compiled and send you the compiled file in email. I have also created a ussd web interface similar like sms.If you like you can include it in the distribution so others can also get benefit from it. ๐Ÿ™‚

    • I have just updated chan_dongle in the repository to version 1.1 Revision 34 and included your modification (E303S in 7bit modems).

      • Thanks for your update. I have created a web page to handle ussd. so one can easy send ussd command and see the network response. similar to sms page. if you like you can also add it. just send you in email.

  19. Any idea if chan_dongle has better call quality than chan_mobile? I tried the latter previously and it was barely acceptable….

    • Call quality of chan_dongle is pretty good, in no way inferior to a call with a regular mobile. Chan_mobile works over Bluetooth, which can suffer a lot from WiFi interference.

  20. Hi all!
    Great project and great forum. Here is my story ๐Ÿ™‚ I hope you will want to try that config too!

    I’m using raspbx as some kind of virtual dual-sim for my phone (without the battery drain! and with the smartphone of my choice..).
    I have one sim in my phone (sim A), and one in Huawei E1750 dongle plugged into the raspbx with a powered USB (sim B).

    My goal is to use only my single SIM smartphone and yet be able to send and receive calls and sms from both sim A and B.

    Line A (personal sim) : nothing special, SIM A is in the smartphone and works fine to send/receive calls and sms.

    Line B (company sim) :
    Incoming calls to B are automatically forwarded to A thanks to my GSM provider It’s a network parameter easy to toggle. No raspbx fun needed here.
    Outgoing calls (which I want to look as if truly originated by line B when my correspondant receives a call from me) : RASPBX comes in here. I connect from my smartphone (sim A data, or wifi) with a SIP client (currently linphone). Raspbx then uses the chan dongle to call using the SIM B. It works okay, but I still have to pick the best codec and sometimes the dongle is not freed after a call. It stays in the “dialing state”, even after I hangup.

    SMS : received sms on sim B are automatically forwarded by the raspbx to my line A thanks to the neat script provided with install-dongle. It works fine. Nothing to add!
    Sending a sms… is more tricky. I could use the php portal. but it’s not very convenient, since I want my sms flow stored in my smartphone with all my sms.
    Second option : send an sms from my line A(smartphone) to my line B(raspbx) with a special format like “+0123456789 Hello” and have raspbx check that when it receives an SMS from me (line A), it should look into the sms message and retrieve the number at the beginning so that it reads the two variables :
    1/+0123456789 will be the destination number (person I really want to send the message to, and that will eventually receive it as sent from sim B)
    2/”Hello” which is the message that person will receive
    So far I think this should do :
    0123456789 can be extracted with ${BASE64_DECODE(${SMS_BASE64}):1:10}
    Message itself can be extracted by ${BASE64_DECODE(${SMS_BASE64}):12}
    The final sms (from sim B to my correspondent) can then be sent by
    exten => sms,n,DongleSendSMS(dongle0, ${BASE64_DECODE(${SMS_BASE64}):1:10}, ${BASE64_DECODE(${SMS_BASE64}):12})

    Problem is : I can’t get raspbx to correctly interpret my conditionnal script.

    When sms is received by raspbx and callerid(num) is me (SIM A), then I want to exten => sms,n,DongleSendSMS(dongle0, ${BASE64_DECODE(${SMS_BASE64}):1:10}, ${BASE64_DECODE(${SMS_BASE64}):12})

    On all other cases, I just want the normal script to forward the sms to my line A.

    exten => sms,1,GotoIf($[“${CALLERID(num)}” = “MyLineANumberInInternationalFormat”]?me:notme)
    exten => sms,n(me),DongleSendSMS(dongle0, ${BASE64_DECODE(${SMS_BASE64}):1:10}, ${BASE64_DECODE(${SMS_BASE64}):12})
    exten => sms,n,Hangup()
    exten => sms,n(notme),DongleSendSMS(dongle0, MyLineANumberInInternationalFormat, ${BASE64_DECODE(${SMS_BASE64})} from ${CALLERID(num)})
    exten => sms,n,Hangup()

    But that doesn’t work.

    if you have any clue about :
    1- why the dongle stays in “dialing” state even after I hang up
    2- what’s wrong with my conditionnal exten

    Please help!

    • Ok. Reply to self.

      Conditionnal script below works.

      exten => sms,1,Verbose(Incoming SMS from ${CALLERID(num)} ${BASE64_DECODE(${SMS_BASE64})})
      exten => sms,n,GotoIf($[“${CALLERID(num)}” = “+123456789”]?me:notme)
      exten => sms,n(me),DongleSendSMS(dongle0,${BASE64_DECODE(${SMS_BASE64}):1:11},${BASE64_DECODE(${SMS_BASE64}):12})
      exten => sms,n,DongleSendSMS(dongle0,+123456789,Sent OK -> ${BASE64_DECODE(${SMS_BASE64}):12:40}.. to ${BASE64_DECODE(${SMS_BASE64}):0:12})
      exten => sms,n,System(echo “To:\nSubject: Send SMS OK\n\nSent to ${BASE64_DECODE(${SMS_BASE64}):0:11} :\n\n ${BASE64_DECODE(${SMS_BASE64}):12} ” | sendmail $
      exten => sms,n,Goto(end)
      exten => sms,n(notme),DongleSendSMS(dongle0,+123456789,SMS du ${CALLERID(num)} received ${STRFTIME(${EPOCH},,%d/%m ร  %Hh%M)} ๐Ÿ™‚
      exten => sms,n,DongleSendSMS(dongle0,+123456789,${BASE64_DECODE(${SMS_BASE64})})
      exten => sms,n,System(echo “To:\nSubject: SMS from ${CALLERID(num)}\n\n${STRFTIME(${EPOCH},,%d/%m/%Y %H:%M)} – ${CALLERID(num)} :\n\n${BASE64_DECODE(${SMS_BASE64})}”$
      exten => sms,n(end),Hangup()
      exten => _.,1,Set(CALLERID(name)=${CALLERID(num)})
      exten => _.,n,Goto(from-trunk,${EXTEN},1)

      So… any idea about the other question? the dongle that doesn’t hangup but stays in “dialing state”

      If there is no real solution, I can always try to send a command that will do a “dongle reset dongle0” but it’s not optimal.

      • Hi Nico,
        I got the same “dialing” state issue. It was fixed by flashing the firmware of my dongle to another version. What is the model of your 3G modem? Mine is K3765. Only the oldest firmware version download from the web is working.


  21. Good day,

    Basically, I would like to setup a basic ivr for gsm number for a company, that plays a welcome message before directing the call to another gsm phone.

    Is it possible to receive a call and send the call on the same 3g dongle?


    • It’s not possible with one dongle, but you can use up to 3, or you can send the call to some extension.

  22. on the chan_dongle wiki. i follow the “One way voice on Huawei E150”
    when running the command
    apt-get install linux-headers-3.6.11+
    i got a package not available
    how to continue (i have limited linux knowledge )

  23. I have set my dongle dialing in an out with a Vodafone sim card. All was fine but I have now transferred the number to a Three sim card. I have put the new simcard in the dongle and can make an outbound call ok but when dialing the number (inbound route set to play hold music forever) it says the number you called is not in service in an american voice so i know it is getting to the pbx. Any suggestions?

    Do I need to change any of the config to the new simcard number at all?

    The mobile number was ported so is the same but on a different nerwork provider.


    • This looks like a problem with your inbound route. Run

      asterisk -rvvvvv

      on the console and make an inbound call. You can read the DID number of your call in the log, it has to precisely match the DID of your inbound route.

      • So far so good. I have changed the did number to exactly what is written however this is the old number that was on the sim card – not the transferred one??

        The number should be the new one surely as the extension did. The number i call is the new one but it seems to think it is the old one.

        • I have sorted this now. The sim card needed the number changing via a mobile phone. Put in the in the iPhone and changed the number in settings and all is now good!

          • You don’t have to put it in mobile phone. You can change the number trough asterisk CLI:

            dongle cmd dongle0 AT+CPBS=\”ON\”
            dongle cmd dongle0 AT+CPBW=1,\”+79139131234\”,145

  24. Hi!
    I have EG162 works fine. Two problems that I solved:
    1. One of my sim cards doesn’t supported – took another one
    2. VOICE was disabled – changed firmware.
    You can add my device to compatibility list.

  25. Hello everyone, I would like to use the E1550 as well as internet connection. is it possible? GSM calls work correctly, both incoming and outgoing.
    Thank you all.

    • This has not been tried before. Eventually it is possible. Would be great if you could post your results in case you try it.

        • the problem is that usualy usb dongles have only single ttyUSB for AT commands while both asterisk and ppp connection manager need to use this single port for AT commands. So it could work if chan_dongle would serve as ppp client ๐Ÿ™‚

  26. any idea how to get Huawei E352 running, have some problems with Preferred SMS Storage, as I also have described in

    didn’t have any success using Huawei E352 together with chan_dongle. in Asterisk I always get the following errors.

    — [dongle0] Trying to connect on /dev/ttyUSB2…
    — [dongle0] Dongle has connected, initializing…
    — [dongle0] Dongle has disconnected
    — [dongle0] Trying to connect on /dev/ttyUSB2…
    — [dongle0] Dongle has connected, initializing…
    — [dongle0] Dongle has disconnected

    this is Asterisk 11.3.0 in FreePBX on Linux 3.6.11+ on a Raspberry Pi. just using the distribution of

    done stracing on AT commands with strace -f -v -tt -p 2>&1 | egrep “(write\(27|readv\(27)”
    [pid 4868] 15:15:29.407192 write(27, “4814 27”, 7) = 7
    [pid 4956] 15:15:29.437565 write(27, “AT\r”, 3) = 3
    [pid 4956] 15:15:29.444475 readv(27, [{“\r\nOK\r\nR\n\”002B003400330036003700″…, 2048}], 1) = 6
    [pid 4956] 15:15:29.446766 write(27, “ATZ\r”, 4) = 4
    [pid 4956] 15:15:29.458470 readv(27, [{“\r\nOK\r\nR\n\”002B003400330036003700″…, 2048}], 1) = 6
    [pid 4956] 15:15:29.460746 write(27, “ATE0\r”, 5) = 5
    [pid 4956] 15:15:29.472521 readv(27, [{“\r\nOK\r\nR\n\”002B003400330036003700″…, 2048}], 1) = 6
    [pid 4956] 15:15:29.474901 write(27, “AT+CGMI\r”, 8) = 8
    [pid 4956] 15:15:29.486632 readv(27, [{“\r\nhuawei\r\n\r\nOK\r\n3400330036003700″…, 2048}], 1) = 16
    [pid 4956] 15:15:29.488964 write(27, “AT+CGMM\r”, 8) = 8
    [pid 4956] 15:15:29.500963 readv(27, [{“\r\nE352\r\n\r\nOK\r\n\n3400330036003700″…, 2048}], 1) = 14
    [pid 4956] 15:15:29.503290 write(27, “AT+CGMR\r”, 8) = 8
    [pid 4956] 15:15:29.516589 readv(27, [{“\r\n21.\r\n\r\nOK\r\n6003700″…, 2048}], 1) = 25
    [pid 4956] 15:15:29.518900 write(27, “AT+CMEE=0\r”, 10) = 10
    [pid 4956] 15:15:29.530595 readv(27, [{“\r\nOK\r\n06.04.00.55\n\r\nOK\n6003700″…, 2048}], 1) = 6
    [pid 4956] 15:15:29.532884 write(27, “AT+CGSN\r”, 8) = 8
    [pid 4956] 15:15:29.547946 readv(27, [{“\r\n35423404xxxxxxx\r\n\r\nOK\r\n6003700″…, 2048}], 1) = 25
    [pid 4956] 15:15:29.550362 write(27, “AT+CIMI\r”, 8) = 8
    [pid 4956] 15:15:29.562402 readv(27, [{“\r\n23203xxxxxxxxxx\r\n\r\nOK\r\n6003700″…, 2048}], 1) = 25
    [pid 4956] 15:15:29.564832 write(27, “AT+CPIN?\r”, 9) = 9
    [pid 4956] 15:15:29.577446 readv(27, [{“\r\n+CPIN: READY\r\n\r\nOK\r\nK\n6003700″…, 2048}], 1) = 22
    [pid 4956] 15:15:29.579786 write(27, “AT+COPS=0,0\r”, 12) = 12
    [pid 4956] 15:15:29.591866 readv(27, [{“\r\nOK\r\nN: READY\n\r\nOK\nK\n6003700″…, 2048}], 1) = 6
    [pid 4956] 15:15:29.594235 write(27, “AT+CREG=2\r”, 10) = 10
    [pid 4956] 15:15:29.606199 readv(27, [{“\r\nOK\r\nN: READY\n\r\nOK\nK\n6003700″…, 2048}], 1) = 6
    [pid 4956] 15:15:29.608491 write(27, “AT+CREG?\r”, 9) = 9
    [pid 4956] 15:15:29.620948 readv(27, [{“\r\n+CREG: 2,1,\”E310\”,\”6CA7\”\r\n\r\nOK”…, 2048}], 1) = 34
    [pid 4956] 15:15:29.623297 write(27, “AT+CNUM\r”, 8) = 8
    [pid 4956] 15:15:29.635403 readv(27, [{“\r\n+CNUM: \”0045006900670065006E00″…, 2048}], 1) = 103
    [pid 4956] 15:15:29.637824 write(27, “AT^CVOICE?\r”, 11) = 11
    [pid 4956] 15:15:29.649390 readv(27, [{“\r\n^CVOICE: 0, 8000, 16, 20\r\n\r\nOK”…, 2048}], 1) = 34
    [pid 4956] 15:15:29.651743 write(27, “AT+CSCA?\r”, 9) = 9
    [pid 4956] 15:15:29.663652 readv(27, [{“\r\n+CSCA: \”002B003400330036003700″…, 2048}], 1) = 59
    [pid 4956] 15:15:29.666087 write(27, “AT+CSSN=1,1\r”, 12) = 12
    [pid 4956] 15:15:29.677850 readv(27, [{“\r\nOK\r\nA: \”002B003400330036003700″…, 2048}], 1) = 6
    [pid 4956] 15:15:29.679975 write(27, “AT+CMGF=0\r”, 10) = 10
    [pid 4956] 15:15:29.691805 readv(27, [{“\r\nOK\r\nA: \”002B003400330036003700″…, 2048}], 1) = 6
    [pid 4956] 15:15:29.694166 write(27, “AT+CSCS=\”UCS2\”\r”, 15) = 15
    [pid 4956] 15:15:29.705841 readv(27, [{“\r\nOK\r\nA: \”002B003400330036003700″…, 2048}], 1) = 6
    [pid 4956] 15:15:29.708116 write(27, “AT+CPMS=\”ME\”,\”ME\”,\”ME\”\r”, 23) = 23
    [pid 4956] 15:15:29.719998 readv(27, [{“\r\nERROR\r\n\”002B003400330036003700″…, 2048}], 1) = 9

    clearly AT+CPMS=”ME”,”ME”,”ME” causes an ERROR and afterwards dongle is disconnected.

    but Huawei E352 only supports Preferred Message Storage on SIM.

    Manufacturer: huawei
    Model: E352
    IMEI: 35423404xxxxxxx
    +GCAP: +CGSM,+DS,+ES
    +CPMS: (“SM”),(“SM”),(“SM”)

    any idea how to change handling of SMS in generel in chan_dongle? any chance to disable this AT command? any idea to not fail on ERROR?

    • You’ve already done the right thing: posting an issue on the original chan_dongle project page. If you are right and AT+CPMS=โ€MEโ€,โ€MEโ€,โ€MEโ€ does cause a disconnect, the chan_dongle developers will have to look at this.
      Other things you can try on top: Make sure you are not having a power problem, see troubleshooting power issues above, as the symptoms are similar (modem connecting/disconnecting all the time).
      Also make sure to have your firmware upgraded to the latest version.

  27. I’m new to linux and trying to install asterisk on raspberry. Don’t know if this is the place to ask. I’m just very frustrated after 2 days of trying. In my last try I’ve installed the image that already contains Asterisk 11.3.0 and FreePBX
    but when I run on the console
    pi@raspberry ~ $ raspbx-upgrade
    I get
    pi@raspberry ~ $ -bash: raspbx-upgrade: command not found
    same when I try with : install-dongle
    Any one can help me?

    • It seems you are running to original Raspberry image, not RasPBX. You have to download and flash the image first according to the instructions on the documentation page.

  28. sorry for flooding, but id like to know if theres a way to change the predefined dongle0 sms forwarding option, say i want dongle3 to forward the sms, how do i go about it?


    • Edit the file /etc/asterisk/extensions_custom.conf and find the line

      exten => sms,n,DongleSendSMS(dongle0,...

      Replace dongle0 with dongle3.

      • thanks for the quick reply, do you happen to know how to do that for the sms page generated by install-dongle to make it send an sms from another dongle other than dongle0?


  29. Huawei e180 doesnt work for incoming/outgoing audio, I am able however to send and receive SMS.
    thats the error i get when receiving a call( Unhandled PID value, only SMS supported )

    please update the list thanks,

    • Bump! Can anyone help me with setting up my e180 dongle? It is able to send and receive sms, but won’t recieve/send voice callsโ€ฆ any help would be appreciated.

  30. I bought a new modem, cause the old one is defect. I have now an E303. It is registered in the network, but the tel. number is still unknown, and asterisk is also doing something, but i just got several failure, and the mailbox answers if i call my mobile number. Please see here: . I would be really happy for every help. Thanks!

    • It is also interesting, that in the FreePBX System Status/Network if the modem plugged in, there is not just the eth0, but also a wwan0. maybe it can help.

    • Can you hear “The number you have dialled is not in service” when calling the modem? Because this is played from the Asterisk according to your logs. It just says there is no inbound route configured and therefore the call cannot be processed. If you can hear the above text your modem is supposed to work fine. Just configure an inbound route.

      • Hi Garnot! Thanks, that is right, i was surprised, that my hungarian speaking provider talks to me in english ๐Ÿ™‚ I will try tomorrow to set the routes!

  31. I have some problems installing an E1752. Unlocked, and voice is activated. The sim card is not registered, the mailbox goes on if i call it. I use an active USB HUB. I tried different sim card from different providers. With the command dongle show devices i got following infos: ID Group State RSSI Mode Submode Provider Name Model Firmware IMEI IMSI Number
    dongle0 0 GSM not re 18 0 0 T-Mobile H E1752 35314503074XXXX 21630200842XXXX Unknown
    Any suggestions?

    • Run asterisk with

      asterisk -rvvvvv

      and watch the messages appearing for some time. Is the modem registering/unregistering all the time or does it stay unregistered? Maybe you can see more messages that give some hints to the problem.

      • Here is some info from the freepbx logfile – . At first if i connect the modem, @ 22:07:24, it can not connect to the modem, but a few second later it is connected and shows, that it is ready. I removed the dongle at 22:11:40, pluged in a few seconds later, and it is “ready” but the mailbox is coming, if i call the number. No idea, what can be the problem.

        • This looks very much like a problem with the USB hub. I have the same problem here with a powered USB hub: The modem is registering first but then unregisters again. If I use the same modem without the hub directly connected to my 512MB RPi it works perfectly fine. I assume this has something to do with insufficient power from the hub. The symptoms are exactly the same when the power supply is not strong enough. As soon as the modem turns on its transmitter voltage drops too much and it unregisters.
          Although current rating on the power supply of my hub is high enough, it still doesn’t work. It seems there is not sufficient current for the modem available.
          You could try to use a different hub, or connect the modem directly. In the last case you need to make sure your power supply has enough current for both the RPi and the modem (>1.2A with stable voltage).

  32. I confirm that Huawei E160 works fine for calls and sms.
    Thanks a lot for that documentation !

  33. I finally was able to implement this. Incoming and outgoing calls using a Huawei e153 usb modem works well. The caveat… I just realized that my isp has implement some sort of double-nat or transparent proxy on their server side which prevented my end from being visible to the net. I get a “live ip” but could not forward ports because when I check my ip over it’s not the same as what is was given to me. As a result, my asterisk could not connect to any voip provider… it says I am registered but when I try to call from the outside to one of the sip trunks I could not get through. I wonder how sipgsm from was able to traverse the double-nat/transparent gateway of my isp. Any ideas?

    • The best solution to this is using a VPN. There are many VPN providers available, an example can be found here. Running all SIP and RTP traffic through the VPN tunnel should eliminate all double-nat problems.
      Eventually there is also another solution: Use qualify=yes and nat=yes in your trunk’s SIP settings. Experiment a bit with the qualifyfreq parameter until you get a qualify period that keeps your first router’s nat open. Qualify=yes sends small packets at the qualifyfreq interval so the SIP port as seen from the outside stays open. Using this might already help, but I’m not sure if it is stable enough or there are other side effects like one-way audio or no audio at all.

      • Thanks Gernot. I may have to try VPN. Pardon my terminologies as I am not so versed with ip terms. I guess my setup can be called “triple-nat”…. looking from my networks side, NAT is already implemented. At the ISP side another translation or proxying is being done The ISP provides us public ip addresses but checking, a different ip is being shown. As such even if I set portforwarding in my router it is not possible to access the services on my home network. Anyway, I might be changing ISP soon. Thanks again.

        • Gave up on Skype… my raspbx shows registered with ippi but because of the NAT issue, calls could not get through.. ippi says that the user is offline. Even with STUN/TURN enabled, no luck. With Google Voice however, it’s a different story… calls both incoming and outgoing pass through without a hitch. I would have wanted a VPN but I could not get a provider with a trial period that would allow me to do some experimentation. The “free” ones are usually anonymous and I could not get in touch with their owners to allow rtp ports to pass through. Now my problem is with the USB dongle. It shows GSM Not Ready after a while and I need either to reboot or reinsert the modem. Dunno if it has something to do with my settings… will need to check. Anyone experienced this? I am using Huawei e153u3, btw,

  34. hi! i want install dongle on a Hackberry. i was install asterisk from repo when i compile dongle i have problem with hardware part asterisk cant see modem.

  35. Voice problem with GSM gateway Trunk
    I am using huawei E303C GSM modem, it can dial out and in without any problem. when line established, SIP side can hear GSM side person speaker clearly. But GSM cannot hear (hearing breaking voice, like playing damaged CD audio) any voice from SIP. Internal SIP to SIP runs perfectly. I configured IVR for GSM incoming has same issue. But IVR working perfectly for SIP. What could be the issue? Should I change codecs for inbound/outbound? if so kindly let me the location. I’m using FreePBX with Asterisk 11.3.0 on RaspberryPI with kernel [Linux raspbx 3.6.11+ #408 PREEMPT Wed Apr 10 20:33:39 BST 2013 armv6l GNU/Linux].

    I have created GSM gateway trunk as follows,
    – Add Custom Trunk
    Custom Dial String: dongle/dongle0/$OUTNUM$

    Installed chan_dongle module for GSM/3G calling capability.

    I tested the modem on windows machine by making call. Works well.

    • Did you try to upgrade the firmware of your dongle? Other users had similar problems and after upgrading the firmware it worked well.

      • Hello,
        I have the same dongle (E303C) and similar problem. From GSM I can call SIP, it rang but neither side could hear. Calling SIP to GSM, the call does not get completed.

        I tried updating the firmware but I could not find update on DC files. Is there something more I could try…

    • Hi. I have same problem with E1550. SIP side can hear GSM side person speaker clearly. But GSM cannot hear (hearing breaking voice, like under water).
      About server:
      Linux raspbx 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l GNU/Linux
      Firmware E1550 11.609.18.00.00

  36. I can dial out throught Chan_Dongle. However, sound volume is very very low. How can I increase the volume? Thanks

        • I am using K3715, it can dial out and in without problem. when line established, VOIP side can hear GSM side person speaker clearly. But GSM cannot hear any voice from VOIP. internal VOIP to VOIP is run perfectly

        • VOIP person press key, GSM side can hear DTMF taking to mic with out sound. Of course mic is OK when VOIP to VOIP

        • Finally, fixed problem by upgrade K3715 firmware to and connect dongle to a powered USB hub. 2 ways voice now and clear but need to modify dongle.conf audio gain to improve quality of voice

  37. Need to add AMR-NB codec in GSM VoIP Gateway with Chan_dongle in Rasberry. So I can make call from SIP using AMR-NB codec.

  38. trying to run a e1550, rasp pi b,
    1A psu, usb gsm plugged striaght into rasp pi
    but linux does not create the /dev/ttyUSBx devices

    so nothing work
    Will try a USB hub , anything else i could be doing wrong

    • Some issues have been reported with the E1550 before, see this forum thread. If it still doesn’t work with a powered USB hub, you could try to install USB modeswitch:

      apt-get install usb-modeswitch

      Eventually the old E1550 still needs USB modeswitch to run properly.

  39. Hello everyone,

    I did 3 e1550 modems work well with Asterisk + dongle.
    But if you use 4 e1550 usb modems. The system hangs and does not work anymore.

    Is there any limitation e1550 usb modems?

      • Thanks for your response!

        Use usb hub with 3A
        The problem is not cpu processing (17% is always looking to htop)
        But I seem to be a problem with communication / AT commands when using above 3 modems.
        The system is reading and ethernet is slow, but the processing is ok.
        When I put multiple devices on usb external hd, pen-drivers, 3 modems … everything is ok!

        But if you put 4 or 5 modems … everything stops working again!
        Is there any command to improve communication with modems?

        I thank you.

        • I am not aware of a real problem that prevents having 4 modems in general. To me this looks more like a problem with the USB hub. Read the chan_dongle wiki here:

          It says that some USB hubs were reported to malfunction possibly because of interference from the modem’s RF output. Especially if connection to the first modem suddenly stops once you plug in the 4th it is a good sign something like this happens.
          You could try with a different hub or maybe with 2 hubs and only having 2 modems connected to each.

        • when i try with 5USB Dongle it doesn’t work it disconnect one and connect the other on the idea is perfetct working wth 3USB Huawei E153

          • Have some problem!!!
            I did 3 e1550 modems work well with Asterisk + dongle.
            But if you use 4 e1550 usb modems. The system hangs and does not work anymore.
            I have a powered HUB. Great work only 3 modems!!!

      • The installer script creates a 30-permissions.rules file, this out-rules your 99-huawei-link.rules, therefore the symlinks are not being created. You could name this file 29-huawei-link.rules then it should be executed (but the 30-permissions.rules would be skipped, leaving the ttyUSB device permissions incorrect).
        The imei/imsi method would be the preferred one and it is supposed to work. If you can’t make this work please ask at the original chan_dongle forum for help. I assume this is a chan_dongle specific issue.

        • I just got hold of additional usb modems. First thing, I think that imei/imsi discovery does not work with Huawei e153u3… at least with the locked custom firmware from the provider. Huawei e1552 works with imei/imsi discovery method.

    • Hi, I’m trying to use 2 modems, can you help me. I’m just able to use only one. There’s a procedure somewhere to add the second one ? Thanks

    • Please try to set


      in /etc/dongle.conf (previous setting was callingpres=allowed_passed_screen)
      It should be also possible to change this directly in the network by putting the SIM into a regular phone.

  40. i have a question, im trying to get this chan_dongle module working from scrath but i can’t do it, i’ve to compile it from git, i saw you provide the module already compiled, did you change something in the source code ? if yes, is there any change to get the source to compile it in my system?

    • No, I just compiled the version compatible with Asterisk 11. No changes were required.

  41. Had it up and running in 3 minutes using a Huawei K3520 from Vodafone Germany (no unlock/ new firmware etc necessary, just plug and play). Just make sure you disable PIN on sim card.

    • Thanks for letting us know about your application, this is awesome! ๐Ÿ™‚ Good work!