Monday 23 December 2019

Asterisk on Mikrotik

image

I wondered about the idea to raise a voip on mikrotik. Who remembers, in older versions of the routeros there was a module for voip, then it was cut out, which is a pity. It is no longer possible to raise an asterisk on the routeros, however there is an opportunity to raise a virtual router with openwrt in the metarouter mode, from here we will proceed.

Long searches led me to the openwrt.wk.cz website (available only via ipv6), from where the openwrt image for mt-mips was downloaded. All experiments conducted on the 2011UAS-2HnD. Since not everyone has ipv6, I made a mirror for installing packages from it ( ms1.nserver.us/openwrt.wk.cz .), Where the necessary packages lie. By the way, during the search, it was not possible to find a full-fledged article on this topic, not only in Russian, but also in any other.

So, download the image for mips ( openwrt-mr-mips-rootfs.tar.gz ) or for ppc ( openwrt-mr-ppc-rootfs.tar.gz ). Fill the image in our mikrotik, in Files, go to MetaROUTER and do the import of the image. I allocated 48 meters of memory and 24 meters of hdd, yes ... yes ... do not be surprised ... an asterisk will work on such hardware, tested, created trunks and made calls without problems.



 We add the interface to the virtual router, the easiest way is to create a dynamic one and add it to your local bridge. It looks like this to me:



 in the preinstalled image, the network interface is configured to receive network settings via dhcp, and if you have everything in order with the localhost, the virtual router will get the network address, if not, edit the / etc / config / network file and restart the network. Next, go to the console:

 

 change the password to root, and see what address is received. All subsequent actions are best done by connecting via ssh.

Having connected via ssh, first edit /etc/opkg.conf, bringing it to the following form for mips:

 

 Further:

opkg update
opkg install asterisk18 asterisk18-codec-alaw asterisk18-chan-iax2 asterisk-gui
/etc/init.d/asterisk enable


edit /etc/asterisk/manager.conf, change the admin password to the panel and start the asterisk

/etc/init.d/asterisk start


that's all, now you can go to metarouter_address : 8088 / and set up an asterisk through the GUI. Present codecs alaw, ulaw, gsm. If you need to add codecs, look at the list of existing packages and install the necessary one via opkg. Ready packages under 1.8 asterisk a decent amount, up to chan_dahdi. For home use quite tolerably can work.



 Everything was done as an experiment, although in principle, it could work for the house, and you can not install the GUI for an asterisk.

PS: I understand perfectly well that this is a perversion, but I wanted to share such an experiment.

Source : https://weekly-geekly.github.io/articles/180889/index.html