diff options
Diffstat (limited to 'net/asterisk11/files/asterisk.in')
-rw-r--r-- | net/asterisk11/files/asterisk.in | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/net/asterisk11/files/asterisk.in b/net/asterisk11/files/asterisk.in index 85dce3d6c84f..b8e24b5ee78b 100644 --- a/net/asterisk11/files/asterisk.in +++ b/net/asterisk11/files/asterisk.in @@ -9,35 +9,48 @@ # # Add the following lines to /etc/rc.conf to enable asterisk: # -# asterisk_enable="YES" +# 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 # . /etc/rc.subr name=asterisk rcvar=asterisk_enable +desc="Asterisk PBX server" -extra_commands="reload" +load_rc_config $name + +: ${asterisk_enable:=NO} +: ${asterisk_user:=%%ASTERISK_USER%%} +: ${asterisk_args=-n} +: ${asterisk_pidfile:=/var/run/asterisk/asterisk.pid} + +extra_commands=reload -stop_cmd="asterisk_stop" -reload_cmd="asterisk_reload" +stop_cmd=asterisk_stop +reload_cmd=asterisk_reload command="%%PREFIX%%/sbin/asterisk" -command_args="-n -F -U %%ASTERISK_USER%%" -pidfile=${asterisk_pidfile:-"/var/run/asterisk/asterisk.pid"} +command_args="${asterisk_args} -F -U ${asterisk_user}" +pidfile=${asterisk_pidfile} -asterisk_stop() { - echo 'Stopping asterisk' - $command -nqrx 'core stop now' +asterisk_stop() +{ + echo 'Stopping asterisk' + $command -nqrx 'core stop now' } -asterisk_reload() { - echo 'Reloading asterisk' - $command -nqrx 'reload' +asterisk_reload() +{ + echo 'Reloading asterisk' + $command -nqrx 'reload' } -load_rc_config $name - -asterisk_enable=${asterisk_enable:-"NO"} - run_rc_command "$1" |