Debian Codegraph @

utils/kamctl/kamctl.ctlbase

raw
1 #
2 # control tool for maintaining Kamailio
3 #
4 # This file is part of Kamailio, a free SIP server.
5 #
6 # SPDX-License-Identifier: GPL-2.0-or-later
7 #
8 # Kamailio is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version
12 #
13 # Kamailio is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #
22 #===================================================================
23
24 [ "${IMPCTLBASE}" = "yes" ] && return
25
26 export IMPCTLBASE="yes"
27
28 ##### ----------------------------------------------- #####
29 ### common variables and functions for CTL engines
30 #
31
32 # period in which stats are reprinted
33 if [ -z "$WATCH_PERIOD" ] ; then
34 WATCH_PERIOD=2
35 fi
36
37 #
38 ##### ------------------------------------------------ #####
39 ### usage functions
40 #
41 usage_cisco_restart() {
42 echo
43 mecho " -- command 'cisco_restart' - restart CISCO phone (NOTIFY)"
44 echo
45 cat <<EOF
46 cisco_restart <uri> ................ restart phone configured for <uri>
47 EOF
48 }
49 USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_cisco_restart"
50
51 usage_online() {
52 echo
53 mecho " -- command 'online' - dump online users from memory"
54 echo
55 cat <<EOF
56 online ............................. display online users
57 EOF
58 }
59 USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_online"
60
61 usage_kamailio_monitor() {
62 echo
63 mecho " -- command 'monitor' - show internal status"
64 echo
65 cat <<EOF
66 monitor ............................ show server's internal status
67 EOF
68 }
69 USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_kamailio_monitor"
70
71 usage_ping() {
72 echo
73 mecho " -- command 'ping' - ping a SIP URI (OPTIONS)"
74 echo
75 cat <<EOF
76 ping <uri> ......................... ping <uri> with SIP OPTIONS
77 EOF
78 }
79 USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_ping"
80
81 usage_usrloc() {
82 echo
83 mecho " -- command 'ul|alias' - manage user location or aliases"
84 echo
85 cat <<EOF
86 ul show [<username>]................... show in-RAM online users
87 ul show --brief........................ show in-RAM online users in short format
88 ul rm <username> [<contact URI>]....... delete user's usrloc entries
89 ul add <username> <uri> ............... introduce a permanent usrloc entry
90 ul add <username> <uri> <expires> ..... introduce a temporary usrloc entry
91 ul add <user> <uri> <expires> <path> .. introduce a temporary usrloc entry
92 ul dbclean [<secs>].................... remove older expired records from db table
93 EOF
94 }
95 USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_usrloc"
96
97 usage_ctlcommon() {
98 echo
99 mecho " -- command 'ps' - print details about running processes"
100 echo
101 cat <<EOF
102 ps ................................. details about running processes
103 EOF
104 echo
105 mecho " -- command 'psa' - print all attributes about running processes"
106 echo
107 cat <<EOF
108 psa ................................ all attributes about running processes
109 EOF
110 echo
111 mecho " -- command 'uptime' - print uptime details"
112 echo
113 cat <<EOF
114 uptime ............................. print start time end elapsed seconds
115 EOF
116 echo
117 mecho " -- command 'stats' - print internal statistics"
118 echo
119 cat <<EOF
120 stats [group]....................... dump all or a group of internall statistics
121 EOF
122 }
123 USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_ctlcommon"