ports/net/asterisk16/files/asterisk.in
Guido Falsi 9b8e085afc - Add asterisk 16.0.0 to ports
- Update g72x module to 1.4.3, which add support for asterisk 16
- Add asterisk16 flavor and conflicts to asterisk modules ports
  which support it
- Add conflicts to other asterisk versions ports
- Add deprecation notice to asterisk15 which will reach EOL on
  2019-10-03
- Fix wording on SOUNDS option description
- Remove old MOVED line for asterisk16 which was for the long removed
  asterisk 1.6 version

Approved by:	portmgr (flavors already approved in the past)
2018-10-31 23:42:52 +00:00

81 lines
1.7 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: asterisk
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable asterisk:
#
# asterisk_enable (bool): Set it to "YES" to enable asterisk
# Default is "NO"
# asterisk_user (string): User asterisk runs as
# Default is %%ASTERISK_USER%%
# asterisk_args (string): Extra argumeents to pass to asterisk at startup
# Default is "-n"
# asterisk_pidfile (string): Location of the asterisk pid file
# Default is /var/run/asterisk/asterisk.pid
# asterisk_stopsleep (int): Number of seconds to sleep before sending stop command
# Default is 0, which disables it
#
. /etc/rc.subr
name=asterisk
rcvar=asterisk_enable
desc="Asterisk PBX server"
load_rc_config $name
: ${asterisk_enable:=NO}
: ${asterisk_user:=%%ASTERISK_USER%%}
: ${asterisk_args=-n}
: ${asterisk_pidfile:=/var/run/asterisk/asterisk.pid}
: ${asterisk_stopsleep:=0}
extra_commands=reload
start_precmd=asterisk_precmd
stop_cmd=asterisk_stop
reload_cmd=asterisk_reload
command="%%PREFIX%%/sbin/asterisk"
command_args="${asterisk_args} -F -U ${asterisk_user}"
pidfile=${asterisk_pidfile}
asterisk_precmd()
{
local rundir=${asterisk_pidfile%/*}
if [ ! -d $rundir ] ; then
install -d -m 0755 -o asterisk -g asterisk $rundir
fi
}
asterisk_stop()
{
if [ -z "$rc_pid" ]; then
[ -n "$rc_fast" ] && return 0
_run_rc_notrunning
return 1
fi
echo 'Stopping asterisk.'
if [ ${asterisk_stopsleep} -gt 0 ]; then
sleep ${asterisk_stopsleep}
fi
$command -nqrx 'core stop now'
wait_for_pids $rc_pid
}
asterisk_reload()
{
if [ -z "$rc_pid" ]; then
_run_rc_notrunning
return 1
fi
echo 'Reloading asterisk.'
$command -nqrx 'reload'
}
run_rc_command "$1"