[How To] install and configure a full Voip server (Asterisk 13 & 16) on OpenWrt

Hi there,

Could be that the dependencies aren't available:


What router you got?

Dependencies you point are all in place.
Collected errors:

  • opkg_install_cmd: Cannot install package asterisk13-app-mp3.
  • opkg_install_cmd: Cannot install package asterisk13-chan-alsa.
  • opkg_install_cmd: Cannot install package asterisk13-chan-console.
  • opkg_install_cmd: Cannot install package asterisk13-chan-dongle.
  • opkg_install_cmd: Cannot install package asterisk13-chan-mobile

These 5 packages are sadly missing from the rmipsel_mips32 feed.
As for the router, a clone of Asus WL-500gP v2 ( brcm47xx/legacy) with 4/32 memory - D-link DIR-320 revA1.

Hi there,

Well, the problem is that the 18.06 package build bots use the SDK from ar7 (link) to build mipsel_mips32 packages. And this SDK for some reason unbeknownst to me doesn't have USB_SUPPORT nor AUDIO_SUPPORT. So the packages you mentioned above all vanish and aren't built.

So what can you do? You could build the packages yourself, with another SDK. The one that matches your router best should be in here. I downloaded it and indeed chan-dongle and chan-alsa etc are available in menuconfig. USB_SUPPORT and AUDIO_SUPPORT are both defined in this SDK.

2nd option is to go for OpenWrt 19.07. In there the mentioned packages are built by the build bots. Because on 19.07 the bots use brcm47xx/generic SDK to build mipsel_mips32 packages :laughing:

OpenWrt-19 comes with asterisk16. So I did a backward flip, found a LEDE version of the package and got it installed without errors. Voila:

OpenWrt*CLI> dongle show devices
ID Group State RSSI Mode Submode Provider Name Model Firmware IMEI IMSI Number
dongle0 1 Free 19 0 0 Beeline E1550 11.608.14.15.311 353... 25... +7905XXXXXXX

Work in progress...

Maybe that is worth a new topic then.

receiving a SMS message (Asterisk chan_dongle) and execute any command found (if any) in the SMS body message

1 Like

Chan Spy : listen in on a call, or whisper into a conversation.

If you have not installed it previously, you need to install app_chanspy module:

opkg update
opkg install asterisk13-app-chanspy

note: you need at least "beep.gsm" audio file in the asterisk sounds directory (see above).

Then simply add the following lines at the end of the file "/etc/asterisk/extensions.conf":

Chanspy Scanning
exten => 555,1,Chanspy(all,b)

note: put them under [from-internal] section

save and restart Asterisk.

Now by dialing 555 from another extension you can listen in on a call.

While spying, the following actions may be performed:

Dialing # cycles the volume level.
Dialing * will stop spying and look for another channel to spy on.
Dialing a series of digits followed by # builds a channel name to append to
(e.g. run ChanSpy(Agent) and dial 1234# while spying to jump to channel Agent/1234)

A number (161) to call to listen to the current time:

opkg update
opkg install asterisk13-app-sayunixtime
opkg install asterisk13-sounds
opkg install zoneinfo-core
opkg install zoneinfo-europe
; exact time now - call 161
exten => 161,1,Set(CHANNEL(language)=en)
exten => 161,n,SayUnixTime(,CET,AkMbdY)
exten => 161,n,Wait(2)
exten => 161,n,Hangup()

note: put them under [from-internal] section
you may want to change zoneinfo-europe and CET (Central European Time) to your timezone

Sometime you need to use audio files .sln you have created for another linux build, this is a simple way to convert .sln files to .gsm:

opkg update
opkg install sox


sox my_custom_message.sln my_custom_message.gsm

then put your custom files in the following directory:
/usr/share/asterisk/sounds/custom (asterisk 13).
/usr/lib/asterisk/sounds/custom (asterisk 11)

The dialplan (/etc/asterisk/extensions.conf) would be:

exten => 600,1,Answer()
exten => 600,n,Set(CHANNEL(language)=en)
exten => 600,n,Ringing
exten => 600,n,Wait(1)
exten => 600,n,Playback(./custom/please_wait)
exten => 600,n,Dial(SIP/200,30)
exten => 600,n,Wait(1)
exten => 600,n,Playback(./custom/leave_a_message)
exten => 600,n,VoiceMail(240@voicemail)
exten => 600,n,Hangup()

extra: convert wav files to sln:

sox message.wav -t raw -r 8000 -s -2 -c 1 message.sln

1 Like

if SMS memory in dongle is full

to enter asterisk CLI:

asterisk -vvvvr

Clear SMS sim memory:

OpenWrt*CLI> dongle cmd dongle0 AT+CPMS=\"SM\",\"SM\",\"SM\" 
OpenWrt*CLI> dongle cmd dongle0 AT+CMGD=1,4

Clear SMS dongle memory:

OpenWrt*CLI> dongle cmd dongle0 AT+CPMS=\"ME\",\"ME\",\"ME\" 
OpenWrt*CLI> dongle cmd dongle0 AT+CMGD=1,4
1 Like

Chan_dongle website:


Block calls based on area code

in this example all area codes are rejected except 011 and 0141 (commented out)

exten => 0123456789,1,GotoIf($[${REGEX("^010" ${CALLERID(NUM)})}=1]?spam)
;exten => 0123456789,n,GotoIf($[${REGEX("^011" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^012" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^013" ${CALLERID(NUM)})}=1]?spam)
;exten => 0123456789,n,GotoIf($[${REGEX("^014" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^015" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^016" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^017" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^018" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^019" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^02" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^03" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^04" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^05" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^06" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^07" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^08" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^09" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,GotoIf($[${REGEX("^00" ${CALLERID(NUM)})}=1]?spam)
exten => 0123456789,n,Answer()
exten => 0123456789,n,Set(CHANNEL(language)=en)
exten => 0123456789,n,Ringing
exten => 0123456789,n,Wait(1)
exten => 0123456789,n,Dial(SIP/200,30,r)
exten => 0123456789,n,Hangup()
; spam
exten => 0123456789,n(spam),Wait(0)
exten => 0123456789,n,Set(CHANNEL(language)=en)
exten => 0123456789,n,Answer()
exten => 0123456789,n,Wait(2)
exten => 0123456789,n,Playback(ss-noservice)
exten => 0123456789,n,Wait(2)
exten => 0123456789,n,Hangup()

Transfer a call coming from SIP number to another number via Dongle GSM

;exten => 0123456789,n,Dial(dongle/dongle0/+39024242424,60)

Automatic calls on schedule

configuration files:

nano /root/testcall.call
note: if you haven't installed nano (opkg install nano) use vi

Channel: dongle/dongle0/+39022446688 #outbound channel to be used
#Channel: SIP/0123456789@+39022446688 #alternative SIP outbound channel
MaxRetries: 0 # 0 = no retries if number is busy or unavailable, 1 = 1 retry, etc
RetryTime: 60 # wait time between retries if > 0
WaitTime: 60 # ring time
Extension: 980 # extension to launch

nano /etc/asterisk/extensions.conf

[from-pstn] ;comment out if dongle channel is not used
; [default] ;uncomment if SIP channel is used

; 980 audio message
exten => 980,1,Answer
exten => 980,n,Playback(/custom/somemessage)
exten => 980,n,Wait(2)
exten => 980,n,Hangup()

create script:

nano /root/testcall.sh

/bin/cp /root/testcall.call /tmp/testcall.call
/bin/sleep 1
/bin/mv /tmp/testcall.call /var/spool/asterisk/outgoing/

note: the call starts as soon the .call file is placed in /var/spool/asterisk/outgoing/

give permission:

chmod 755 /root/testcall.sh

to start automatic call lanch:

/bin/sh /root/testcall.sh

you may want to put the script on crontab:

crontab -e

5 7 * * * /bin/sh /root/testcall.sh # automatic call every day at 07:05 AM

script to chek if SIP account is registered, if not reload SIP on asterisk

checkifok=`/usr/sbin/asterisk -rx "sip show peer 0123456789" | grep Status | grep -wc OK`
if [[ $checkifok == 0 ]]; then
/bin/sleep 3
/usr/sbin/asterisk -rx "sip reload"
/bin/echo "Trunk OK" > /dev/null 2>&1

1 Like

Create and use a free SIP account at https://www.ippi.com/
(and get a free INUM +883 number - https://en.wikipedia.org/wiki/INum_Initiative)

nano /etc/asterisk/sip.conf

add the following lines under appropriate sections:

register => youruser:yourpassword@ippi.fr

[ippi_incoming] ;  incoming calls from ippi

[ippi_outgoing] ; outgoing calls from ippi

nano /etc/asterisk/extensions.conf

exten => s,1,Answer()
exten => s,n,Dial(SIP/200,30,r)
exten => s,n,Hangup()

exten => _X.,1,Dial(SIP/ippi_outgoing/${EXTEN})
; free calls between ippi accounts

Restart Asterisk after any change

/etc/init.d/asterisk restart

1 Like

If you need some help you can contact me on my INUM: +883 5100 0807 8385 free call from many voip providers (ex. www.ippi.fr, see above)

SORRY, INUM is dead :pensive:

Tool-free calls

make free calls to tool-free numbers (USA and Poland) without any SIP account or registration

nano /etc/asterisk/extensions.conf


; USA tool-free calls
exten => _800NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com)
exten => _855NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com)
exten => _866NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com)
exten => _877NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com)
exten => _888NXXXXXX,1,Dial(SIP/${EXTEN}@tollfree.alcazarnetworks.com)

; Poland tool-free calls
exten => _48800XXXXXX,1,Dial(SIP/${EXTEN}@tollfree.easycall.pl)


for evaulating echo latency

; 982 audio test (echo)
exten => 982,1,Answer
exten => 982,n,Wait(1)
exten => 982,n,Playback(demo-echotest)
exten => 982,n,Echo
exten => 982,n,Playback(demo-echodone)
exten => 982,n,Wait(2)
exten => 982,n,Hangup()

Openwrt 19 and Asterisk 16 (openwrt build) are too young to use them safely in production, I prefer using stable and full tested versions, particularly for critical application like telephony, I don't want to take the risk to have my OpenWRT Voip server hacked and then lose money :wink:

For a critical mission I used Barrier Breaker and Asterisk 11, it works very well and I've never had any problem at all.

My main Voip server with dozen of trunks, extensions and lines uses Asterisk 1.6.24 (Ubuntu 10.04) since 2010 :smiley:

My next step is to try to create a SBC (Session Border Controller) on Openwrt with FreeSWITCH and maybe later on an Asterisk Realtime server (database version) on OpenWRT.

I'm moving to OpenWRT for small/medium voip server because it is very reliabile, robust, stable and has a low power consumption.

Asterisk requires about 30 MHz of CPU power per active voice channel and about 8 Mbytes per concurrent SIP call (no transcoding).
The router I prefer using is TP-Link TL-WDR4900 (PowerPC cpu @ 800 Mhz, 128 MB ram + 64 Mbytes swap with ZRAM), it can easily handle up to 20 concurrent SIP calls.