]>
Commit | Line | Data |
---|---|---|
9bfa4a36 MT |
1 | #!/bin/sh |
2 | ######################################################################## | |
3 | # Begin $rc_base/init.d/asterisk | |
4 | # | |
5 | # Description : Asterisk Script | |
6 | # | |
7 | # Authors : Michael Tremer (mitch@ipfire.org) | |
8 | # | |
9 | # Version : 01.00 | |
10 | # | |
11 | # Notes : | |
12 | # | |
13 | ######################################################################## | |
14 | ||
15 | . /etc/sysconfig/rc | |
16 | . ${rc_functions} | |
17 | ||
18 | case "${1}" in | |
19 | start) | |
20 | boot_mesg "Starting Asterisk PBX..." | |
fda7597c | 21 | loadproc /usr/sbin/asterisk -p |
9bfa4a36 MT |
22 | ;; |
23 | ||
24 | stop) | |
25 | boot_mesg "Stopping Asterisk PBX..." | |
468d3963 | 26 | asterisk -rx "core stop gracefully" >/dev/null 2>&1 |
9bfa4a36 MT |
27 | evaluate_retval |
28 | ;; | |
29 | ||
30 | reload) | |
31 | boot_mesg "Reloading Asterisk PBX..." | |
32 | asterisk -rx "reload" >/dev/null 2>&1 | |
33 | evaluate_retval | |
34 | ;; | |
35 | ||
36 | restart) | |
37 | ${0} stop | |
38 | sleep 1 | |
39 | ${0} start | |
40 | ;; | |
41 | ||
42 | status) | |
42dc0090 CS |
43 | statusproc /usr/sbin/asterisk > /tmp/ast 2>&1 |
44 | STAT=$(cat /tmp/ast) | |
305b9914 | 45 | rm -f /tmp/ast |
42dc0090 CS |
46 | echo $STAT |
47 | EX_Z=$(echo $STAT | grep "not" | wc -l) | |
48 | exit $EX_Z | |
49 | ;; | |
50 | ||
51 | remod) | |
52 | case "${2}" in | |
53 | sip)asterisk -rx "sip reload" >/dev/null 2>&1 ;; | |
54 | iax)asterisk -rx "iax2 reload" >/dev/null 2>&1 ;; | |
55 | ext)asterisk -rx "dialplan reload" >/dev/null 2>&1 ;; | |
56 | *) echo "Usage: ${0} remod {sip|iax|ext}"; exit 1 ;; | |
57 | esac | |
58 | ;; | |
59 | ||
60 | test) touch /tmp/test$$ | |
9bfa4a36 MT |
61 | ;; |
62 | ||
63 | *) | |
42dc0090 | 64 | echo "Usage: ${0} {start|stop|reload|restart|status|remod}" |
9bfa4a36 MT |
65 | exit 1 |
66 | ;; | |
67 | esac | |
68 | ||
69 | # End $rc_base/init.d/asterisk |