SystemD and Asterisk
Asterisk
Put the following in /etc/systemd/system/asterisk.service and then run "systemctl daemon-reload && systemctl enable asterisk"
[Unit]
Description=Asterisk PBX And Telephony Daemon
Wants=network.target
After=network.target
[Service]
Type=simple
User=root
Group=root
#Environment=HOME=/var/lib/asterisk
#WorkingDirectory=/var/lib/asterisk
ExecStart=/usr/sbin/asterisk -f -C /etc/asterisk/asterisk.conf
ExecStop=/usr/sbin/asterisk -rx 'core stop now'
ExecReload=/usr/sbin/asterisk -rx 'core reload'
LimitNOFILE=65535
# safe_asterisk emulation
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
Paste below into a terminal to setup the files:
cat << EOF > /etc/systemd/system/asterisk.service[Unit]
Description=Asterisk PBX And Telephony Daemon
Wants=network.target
After=network.target
[Service]
Type=simple
User=root
Group=root
#Environment=HOME=/var/lib/asterisk
#WorkingDirectory=/var/lib/asterisk
ExecStart=/usr/sbin/asterisk -f -C /etc/asterisk/asterisk.conf
ExecStop=/usr/sbin/asterisk -rx 'core stop now'
ExecReload=/usr/sbin/asterisk -rx 'core reload'
LimitNOFILE=65535
# safe_asterisk emulation
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
Loading Dahdi
After some digging, for my purposes I found the best way to load the transcoding module is to use the systemd module loader to load the wctc4xxp transcoding module and UDEV to run dahdi_cfg once the module is loaded.
Prerequisite: Configure the /etc/dahdi/modules and /etc/dahdi/system.conf files as you normally would.
cat << EOF > /etc/dahdi/modules
# /etc/modules-load.d/dahdi is symlinked here so systemd will load it on startup
# /etc/udev/rules.d/dahdi-wctc4xxp.rules instructs udev to run dahdi_cfg after wctc4xxp module is loaded
# Digium TC400B: G729 / G723 Transcoding Engine
wctc4xxp
EOF
ln -s /etc/dahdi/modules /etc/modules-load.d/dahdi.conf
# update udev to run dahdi_cfg after loading the transcoding module
cat << EOF > /etc/udev/rules.d/dahdi-wctc4xxp.rules
KERNEL=="wctc4xxp" RUN+="/usr/sbin/dahdi_cfg"
EOF
The next time you reboot, systemd will load the module, udev will run dahdi_cfg, and then systemd will load asterisk. Granted this is only really needed if you haven't migrated away from MeetMe yet...
Single shot
Haven't had time to work on this. Here's the information I'm starting from.