This site will go offline starting with 01-JUL-2017 when web hosting contract expires, I don't have free time and interest anymore to maintain it. If someone wants to copy all tutorials and post them somewhere else like RMerlin Wiki, please do. Contact me for other packages or modules, like debian, minidlna, uvc...

Asterisk VoIP Server running on AsusWRT Routers

This tutorial is only for arm routers like RT-AC56U, RT-AC68U, RT-AC87U, RT-AC3200, RT-AC5300...
Asterisk will turn your AsusWRT router into a communications server :)

1 - Flash Rmerlin firmware from here

2a - Install Optware-NG from here

Install necessary packages

ipkg install nano findutils

or

2b - Install Entware-NG from here

Install necessary packages

opkg install nano findutils

3 - Setup Debian Jessie from here

4 - Enter chrooted debian with:

debian enter

5 - Update Debian

apt update && apt upgrade -y

6 - Install Asterisk

apt install asterisk

- Create some user accounts, green color are phone numbers and red color are user names

cat >> /etc/asterisk/extensions.conf << 'EOF'
[tutorial]
exten => 100,1,Dial(SIP/user1)
exten => 101,1,Dial(SIP/user2)
exten => 102,1,Dial(SIP/user3)
EOF

Press ENTER

- Add same user accounts to sip configuration file, in yellow color are the user passwords

cat >> /etc/asterisk/sip.conf << 'EOF'

[user1]
type = friend
defaultuser = user1
secret = pass1
host = dynamic
context = tutorial
nat = force_rport,comedia

[user2]
type = friend
defaultuser = user2
secret = pass2
host = dynamic
context = tutorial
nat = force_rport,comedia

[user3]
type = friend
defaultuser = user3
secret = pass3
host = dynamic
context = tutorial
nat = force_rport,comedia
EOF

Press ENTER
- Exit Debian

exit

10 - Add Asterisk to chrooted services list

echo "" >>/opt/etc/chroot-services.list
echo "asterisk" >>/opt/etc/chroot-services.list
chmod 755 /opt/etc/chroot-services.list

Press ENTER
11 
- Add firewall rules (remove #!/bin/sh if you already have firewall-start script)

cat >> /jffs/scripts/firewall-start << 'EOF'
#!/bin/sh
# SIP on UDP port 5060. Other SIP servers may need TCP port 5060 as well
iptables -A INPUT -p udp -m udp --dport 5060 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 5060 -j ACCEPT
# IAX2- the IAX protocol
iptables -A INPUT -p udp -m udp --dport 4569 -j ACCEPT
# IAX - most have switched to IAX v2, or ought to
iptables -A INPUT -p udp -m udp --dport 5036 -j ACCEPT
# RTP - the media stream
# (related to the port range in /etc/asterisk/rtp.conf)
iptables -A INPUT -p udp -m udp --dport 10000:20000 -j ACCEPT
# MGCP - if you use media gateway control protocol in your configuration
iptables -A INPUT -p udp -m udp --dport 2727 -j ACCEPT
EOF

Press ENTER
12 
- Open ports

sh /jffs/scripts/firewall-start

13 - Start Asterisk from outside debian

debian restart

Now login to your voip devices with accounts created at point 8 and start calling :) a good free android client is CSipSimple



HOW TO INSTALL ASTERISK-GUI

14 - Enter chrooted debian with:

debian enter

15 - Instal necessary packages

apt install git build-essential

16 - Download, compile and install Asterisk-Gui

cd /var/tmp
git clone https://github.com/antirek/asterisk-gui.git
cd asterisk-gui
./configure
make
make install
rm -r /usr/share/asterisk/static-http
ln -s /var/lib/asterisk/static-http/ /usr/share/asterisk/
cp -r /etc/asterisk /etc/asterisk.backup

17 - Enable Gui access

sed -i 's|;enabled=yes|enabled=yes|g' "/etc/asterisk/http.conf"
sed -i 's|;prefix=asterisk|prefix=asterisk|g' "/etc/asterisk/http.conf"
sed -i 's|;enablestatic=yes|enablestatic=yes|g' "/etc/asterisk/http.conf"
sed -i 's|bindaddr=.*|bindaddr=0.0.0.0|g' "/etc/asterisk/http.conf"
sed -i 's/enabled = yes/enabled = yes\nwebenabled = yes/g' "/etc/asterisk/manager.conf"
sed -i 's|#include "manager.d|include "manager.d|g' "/etc/asterisk/manager.conf"

18 - Check Asterisk configuration to see if it will support the GUI

make checkconfig

Should get something like

root@RT-AC68U:/var/tmp/asterisk-gui# make checkconfig
--- Checking Asterisk configuration to see if it will support the GUI ---
* Checking for http.conf: OK
* Checking for manager.conf: OK
* Checking if HTTP is enabled: OK
* Checking if HTTP static support is enabled: OK
* Checking if manager is enabled: OK
* Checking if manager over HTTP is enabled: OK
--- Everything looks good ---
* GUI should be available at http://RT-AC68U:8088/asterisk/static/config/index.html * Note: If you have bindaddr=127.0.0.1 in /etc/asterisk/http.conf
you will only be able to visit it from the local machine. Example: http://localhost:8088/asterisk/static/config/index.html * The login and password should be an entry from /etc/asterisk/manager.conf
which has 'config' permission in read and write. For example: [admin]
secret = mysecret18705
read = system,call,log,verbose,command,agent,config
write = system,call,log,verbose,command,agent,config --- Good luck! ---
root@RT-AC68U:/var/tmp/asterisk-gui#

19 - Create user name and password for Asterisk GUI

cat >> /etc/asterisk/manager.conf << 'EOF'
[admin]
secret = admin_password
read = system,call,log,verbose,command,agent,config
write = system,call,log,verbose,command,agent,config
EOF

Press ENTER

20 - Restart Asterisk

/etc/init.d/asterisk restart

20 - Go to GUI page 192.168.1.1:8088/asterisk/static/config/index.html and input username and password from point 19
asterisk-gui

To be continued with the rest of setup if requested by user...

Enjoy...

  • Wilbert Zapata

    I've found an asterisk distro that already supports armel. Have a look on SARK http://www.sailpbx.com/mediawiki/index.php/SARK_V5.0.0_Debian_install. I've tried v4 and v5 on wheezy and jessie but after rebooting I'm no longer able to get into the web interface anymore. Could you please have a look?

    • Sorry, no free time for this right now.
      To start after router reboot, you have to add service name from debian /etc/init.d/... to optware/entware /opt/etc/chroot-services.list (read point 10)
      If you succeed to install this and run ok, make a tutorial and I will publish it :)

  • Wilbert Zapata

    Hi. I've followed all steps and everything went just perfect including Digium GUI which is quite old. Have you tested any other GUI (FreePBX, Elastix, etc.) that would work on this environment?

    Thanks in advance!

    • Wilbert Zapata

      BTW, it seems that FusionPBX team is already working on ARM. Have a look http://www.fusionpbxforums.com/forums/fusionpbx-on-arm.12/

      • Usually arm means armhf but our routers have armel cpu, let see...

      • Wilbert Zapata

        I've just confirmed that Fusion/Freeswitch is only working on armhf. Looking for another alternative for armel. Keep u posted.

  • Andrey

    Hi, i have a problem:

    root@RT-N16-5BE8:/# localedef ru_RU.UTF-8 -i ru_RU -f UTF-8
    character map file `UTF-8′ not found: No such file or directory
    cannot read character map directory `/usr/share/i18n/charmaps’: No such file or directory
    root@RT-N16-5BE8:/# apt-get install locales
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    locales : Depends: glibc-2.13-1
    E: Unable to correct problems, you have held broken packages.

    And http://192.168.1.1:8088/asterisk/static/config/index.html not loaded :-(

    Help me pls!

    • You have a router which is mipsel arch and kernel v2.6.22 is to old, sorry

      This tutorial is only for arm routers like RT-AC56U, RT-AC68U, RT-AC87U, RT-AC3200, RT-AC5300...

  • TeHashX

    Try step by step like I did in video

    • Csaba Benesch

      I can not watch your video because it is private. I have installed all step-by step again. Android app can connect now, but if I want to call someone then the app say 404. How can I dial somebody?

  • Csaba Benesch

    what port should I use in the android app? and what settings?

    • TeHashX

      Create a new Basic Account, it's default port 5060

      • Csaba Benesch

        not working..... the port 5060 is not open..... it is strange because I have added all the ports to firewall-start script. The android app say "Forbidden"....
        The host is dynamic or should I enter the router IP or dydns address in sip.conf? and the tutorial video is "private" :)

      • TeHashX

        Sorry, video is now public
        404 error is when no such account is created in extensions.conf

      • Csaba Benesch

        so the other user should have CSipSimple too?

      • TeHashX

        Yes or any other sip client

      • Csaba Benesch

        ok thank you, now working all great only one issue what I have..... startup script is created in the init.d folder but after the rooter reboot the debian and the chrooted services does not start

      • TeHashX

        S99debian script is in opt/etc/init.d and should start automatically after router reboot, also if asterisk ✳ is in /opt/etc/chrooted-services.list should start too

      • Csaba Benesch

        yes, but not started....

      • TeHashX

        Entware or optware?
        Post output from:
        cat /jffs/scripts/post-mount

      • Csaba Benesch

        optware-ng on hggomes 380.59 firmware

        ahhhh /opt/etc/chrooted-services.list was empty, I dont know why, because I have added the line what you have written in the tutorial, I have added it again, router rebooted and now works fine. Sorry....

      • TeHashX

        Great, did you manage to connect two devices from wan?

      • Csaba Benesch

        what do you mean?

      • TeHashX

        Can you call a device connected from wan and other one still from wan? not from the same lan

      • Csaba Benesch

        not tested....why its not working?

      • TeHashX

        I managed to connect 2 sip phones from wan then I reinstalled from scratch and can't connect from 4G network.
        Can't remember which port/settings I used before.
        Can you try please?

      • Csaba Benesch

        sure, I will try it.

      • TeHashX

        Can't register to server or can't hear anything?

      • Csaba Benesch

        registration work, I cant hear the other user.....on WiFi there is no issue.

      • TeHashX

        Enable Stun under Settings / Network in CsipSimple app

      • Csaba Benesch

        worked, thanks

      • TeHashX

        It's working but you get error? Restart Csip app

      • Csaba Benesch

        still not working

      • TeHashX

        What is still not working? To connect from wan or you can connect but can't hear anything?
        I updated firmware to v380.60_beta1 and can't connect anymore from wan.

      • Csaba Benesch

        I get still the following issue https://goo.gl/photos/26JYKMtavvvPw4Mz5

      • TeHashX

        Enable 3G and better under settings / network

      • Csaba Benesch

        now I get the following error :( https://goo.gl/photos/26JYKMtavvvPw4Mz5

      • Csaba Benesch

        on 4g not working, tested with 4 devices

      • Csaba Benesch

        ok, now working but if I dial a number then the app says 404

SUBSCRIBE

To be notified by email when a new tutorial is posted :)

Thanks for Subscribing! I'll keeping you up-to-date with latest tutorials!

Something went wrong, try again...