CategoriesTechTutorials

Mikrotik Voltage Alarm/Beeper

I recently needed to make my routerboard generate an audible alarm based on voltage thresholds on the 12v battery wired directly to the RB2011.
This script was a modification of something i found when perusing the Mikrotik forums.
Change lowvoltage and highvoltage to suite your requirements.

#set lowvoltalarm to desired alarm voltage in tenths of a volt. 125 = 12.5v
:global lowvoltalarm 116
:global highvoltalarm 129
:global highvolt
:global lowvolt
:global starttime
:global hivolttime
:global lovolttime
:global vh
:local thisbox [/system identity get name]
:global voltage [/system health get voltage]
:local thistime [/system clock get time]
:local thisdate [/system clock get date]
:local thishour [:pick $thistime 0 2]
:local emessage ($thisbox . " voltage is: " . [:pick $voltage 0 2] . "." . [:pick $voltage 2 3])
:if ([:len $lowvolt] < 1) do={:set lowvolt 999; :set highvolt 0}
# set your email address in the next line
:if ($voltage <= $lowvoltalarm) do={
:for i from=1 to=20 step=1 do={
:beep as-value frequency=4000;
:delay 1
};
:put "Low voltage"
}
if ($voltage > $lowvoltalarm) do={
:put "Normal" 
}
CategoriesTechTutorials

Docker | Asterisk 16

While working on another project, (Callcenter suite) – i built a relatively lightweight Asterisk 16 image which was being used as the base image for a series of ARI tests.

I decided to release this to the open-source community, to try and motivate more people to start looking at using docker as a viable solution for voip builds. (Just please – don’t do NAT, bridge/route your networks!)

https://github.com/wraythezw/docker-ubuntu-asterisk16

This image is also available on docker-hub, just do the below command to pull the image down to your local library.

docker pull keithrosezw/ubuntu18-asterisk16

Once you start this container, it automatically fires off asterisk with in console mode with 5 levels of verbosity specified. Note that for production you should NOT leave this in console mode. Override the startup script and start asterisk as a background process else the console thread will consume 100% of one CPU core. (This was visible when scaling the service using docker-compose)

I’m now using this image as the base image in a scalable call-center solution that I will be releasing to the public sometime in 2020.