[Unit]
Description=Kamailio SIP router server daemon
Wants=network-online.target
After=syslog.target network-online.target auditd.service

[Service]
EnvironmentFile=/etc/sysconfig/kamailio
ExecStartPre=/usr/bin/mkdir -m=2770 -p /run/kamailio
ExecStartPre=/usr/bin/chown kamailio:kamailio /run/kamailio
ExecStart=/usr/sbin/kamailio -f $CFG_FILE -P $PID_FILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP $EXTRA_OPTIONS
ExecReload=/bin/kill -HUP $MAINPID
KillMode=control-group
Restart=on-failure
RestartSec=42s
Type=forking

[Install]
WantedBy=multi-user.target