[Unit]
Description=Kamailio (OpenSER) - the Open Source SIP Server, LB
After=redis-server.service
After=network-online.target
After=remote-fs.target
After=time-sync.target
Requires=network-online.target
Requires=time-sync.target
Requires=redis-server.service
Wants=remote-fs.target

[Service]
Type=notify
User=kamailio
Group=kamailio
PIDFile=/run/kamailio/kamailio.lb.pid
RuntimeDirectory=kamailio
RuntimeDirectoryMode=0750
RuntimeDirectoryPreserve=yes
Environment='CFGFILE=/etc/kamailio/lb/kamailio.cfg'
# Values of SHM_MEMORY=64 and PKG_MEMORY=16 taken from old sysvinit file
# Amount of shared memory to allocate for the running Kamailio server (in MiB)
Environment='SHM_MEMORY=64'
# Amount of private memory for each Kamailio process (in MiB)
Environment='PKG_MEMORY=16'
# -DD means to not daemonise
ExecStart=/usr/sbin/kamailio -P /run/kamailio/kamailio.lb.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY -DD
Restart=on-abort
LimitMEMLOCK=infinity
LimitNOFILE=16384

[Install]
WantedBy=multi-user.target
