10.asterisk
Install Asterisk LTS v20
- Install
cd /tmp && \
wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-20-current.tar.gz -O - | gzip -dc | tar -xvf - && \
cd asterisk-20*
./configure --with-jansson-bundled && \
make menuselect/menuselect && \
make menuselect-tree
./menuselect/menuselect \
--enable codec_opus \
--disable CORE-SOUNDS-EN-GSM \
--enable CORE-SOUNDS-EN-WAV \
--enable CORE-SOUNDS-RU-WAV \
--enable MOH-OPSOUND-WAV
make -j `nproc` && make install
groupadd asterisk
useradd -g asterisk -s /bin/true -d /var/lib/asterisk asterisk
- Configure Asterisk
rm -rf /etc/asterisk
ln -sf /opt/rbt/asterisk /etc/asterisk
Copy sample configuration. After modify it to your realms
cp /opt/rbt/asterisk/config.sample.lua /opt/rbt/asterisk/config.lua
cp /opt/rbt/asterisk/extconfig.sample.conf /opt/rbt/asterisk/extconfig.conf
cp /opt/rbt/asterisk/http.sample.conf /opt/rbt/asterisk/http.conf
cp /opt/rbt/asterisk/pjsip.sample.conf /opt/rbt/asterisk/pjsip.conf
- Configure systemd service
ln -sf /opt/rbt/install/systemd/asterisk.service /etc/systemd/system/asterisk.service
- Configure logrotate
ln -sf /opt/rbt/install/logrotate/asterisk /etc/logrotate.d/asterisk
- Start service
systemctl enable asterisk --now
Known issues
No video stream in SIP
If you have this issue, and you are confident that there are no problems with your encoding settings and SDP, try rebuilding Asterisk with the patch:
cd res
patch </opt/rbt/install/patches/res_pjsip_session.c.18.16.0.patch
The patch has been tested for compatibility with Asterisk versions:
- 18.16.0
- 20.11.1
Custom scripts
You can use custom Lua scripts, which should be placed in /etc/asterisk/custom. This can be useful if you want to
extend the standard behavior or replace parts of the dialplan. Custom script names should be listed in the custom
variable inside the /etc/asterisk/config.lua configuration file (see config.sample.lua).
[!WARNING] Don't use "extensions.lua" as the name of the custom script to avoid an error.
Don't forget to reload the pbx_lua module after modifying the scripts:
sudo asterisk -x "module reload pbx_lua"
Sokol 112 trouble
If you use Sokol intercoms, you will have a problem when calling apartment 112, as this device does not allow you to specify the SIP number of the apartment. In this case, a call to apartment 112 will result in a call to the SOS extension. To fix this, you need to add a custom script that overrides the standard behavior:
-- /etc/asterisk/custom/sokol_sos.lua
extensions["default"]["112"] = function(context, extension)
handleOtherCases(context, extension)
end
-- /etc/asterisk/config.lua
-- ...
-- ...
-- ...
custom = {
"sokol_sos"
}