Skip to content

Commit 008bc17

Browse files
author
Ryan Colobong
committed
Add kamailio proxy and presence instance in sipxconfig
- Manage sipx plugins to kamailio - Settings for kamailio proxy and presence - Update cfengine script for kamailio proxy and presence
1 parent c085c2f commit 008bc17

38 files changed

+1676
-874
lines changed

config/sipXlib2.m4

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ AC_SUBST(SIPX_DBDIR, [${localstatedir}/sipxdata/sipdb])
3030
AC_SUBST(SIPX_LOGDIR, [${localstatedir}/log/sipxpbx])
3131
AC_SUBST(SIPX_RUNDIR, [${localstatedir}/run/sipxpbx])
3232
AC_SUBST(SIPX_VARLIB, [${localstatedir}/lib/sipxpbx])
33+
AC_SUBST(SIPX_LOCKDIR, [${localstatedir}/lock/subsys/sipxpbx])
3334
AC_SUBST(SIPX_SERVICEDIR, [${sysconfdir}/init.d])
3435
# sipx RPMs should be hardcoded to use sipxchange user for their sipx user, not the buildbot user
3536
AC_SUBST(SIPX_RPM_CONFIGURE_OPTIONS, [SIPXPBXUSER=sipx])

config/sipxconfig-integration-testing.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ sipxconfig_web_test_PKGS = \
2929
hivemind-lib \
3030
jasper-compiler \
3131
javassist \
32-
jdom \
32+
jdom \
3333
javax.servlet-api \
3434
javax.servlet.jsp-api \
3535
jta \

sipXconfig/bin/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include $(top_srcdir)/common.am
44

55
EXTRA_DIST = \
66
$(bin_SCRIPTS:=.in) \
7-
$(initd_SCRIPTS:=.in) \
7+
$(initd_SCRIPTS:=.in) \
88
$(libexec_SCRIPTS:=.in) \
99
mongo-test-data
1010

sipXconfig/bin/kamailio-presence.in

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#!/bin/bash
2+
#
3+
# Startup script for Kamailio presence
4+
#
5+
# chkconfig: 345 85 15
6+
# description: Kamailio is a fast SIP Server.
7+
#
8+
# processname: kamailio
9+
# pidfile: @SIPX_RUNDIR@/$PROG.pid
10+
# config: @SIPX_CONFDIR@/$PROG.cfg
11+
12+
# Source function library.
13+
. /etc/rc.d/init.d/functions
14+
15+
KAM=/usr/sbin/kamailio
16+
PROG=kamailio-presence
17+
KAM=/usr/sbin/kamailio
18+
KAMCFG=@SIPX_CONFDIR@/$PROG.cfg
19+
PID_FILE=@SIPX_RUNDIR@/$PROG.pid
20+
LOCK_FILE=@SIPX_LOCKDIR@/$PROG
21+
DEFAULTS=@SIPX_CONFDIR@/kamailio.default
22+
RETVAL=0
23+
RUN_KAMAILIO=no
24+
25+
26+
# Do not start kamailio if fork=no is set in the config file
27+
# otherwise the boot process will just stop
28+
check_fork ()
29+
{
30+
if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $KAMCFG; then
31+
echo "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead"
32+
exit 1
33+
fi
34+
}
35+
36+
check_kamailio_config ()
37+
{
38+
# Check if kamailio configuration is valid before starting the server
39+
out=$($KAM -f $KAMCFG -M $PKG_MEMORY -c 2>&1 > /dev/null)
40+
retcode=$?
41+
if [ "$retcode" != '0' ]; then
42+
echo "Not starting $DESC: invalid configuration file!"
43+
echo -e "\n$out\n"
44+
exit 1
45+
fi
46+
}
47+
48+
49+
start() {
50+
check_kamailio_config
51+
if [ "$1" != "debug" ]; then
52+
check_fork
53+
fi
54+
echo -n $"Starting $PROG: "
55+
daemon $KAM $OPTIONS >/dev/null 2>/dev/null
56+
RETVAL=$?
57+
echo
58+
[ $RETVAL = 0 ] && touch $LOCK_FILE && success
59+
return $RETVAL
60+
}
61+
62+
stop() {
63+
echo -n $"Stopping $PROG: "
64+
killproc -p $PID_FILE $KAM
65+
RETVAL=$?
66+
echo
67+
[ $RETVAL = 0 ] && rm -f $LOCK_FILE $PID_FILE
68+
}
69+
70+
# Load startup options if available
71+
if [ -f $DEFAULTS ]; then
72+
. $DEFAULTS || true
73+
fi
74+
75+
if [ "$RUN_KAMAILIO" != "yes" ]; then
76+
echo "Kamailio not yet configured. Edit /etc/default/kamailio first."
77+
exit 0
78+
fi
79+
80+
81+
SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`))
82+
PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`))
83+
[ -z "$USER" ] && USER=kamailio
84+
[ -z "$GROUP" ] && GROUP=kamailio
85+
[ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64
86+
[ $PKG_MEMORY -le 0 ] && PKG_MEMORY=8
87+
88+
if test "$DUMP_CORE" = "yes" ; then
89+
# set proper ulimit
90+
ulimit -c unlimited
91+
92+
# directory for the core dump files
93+
# COREDIR=/home/corefiles
94+
# [ -d $COREDIR ] || mkdir $COREDIR
95+
# chmod 777 $COREDIR
96+
# echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern
97+
fi
98+
99+
OPTIONS="-f $KAMCFG -P $PID_FILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP $EXTRA_OPTIONS"
100+
101+
# See how we were called.
102+
case "$1" in
103+
start|debug)
104+
start
105+
;;
106+
stop)
107+
stop
108+
;;
109+
status)
110+
status -p "$PID_FILE" -l "$LOCK_FILE" $KAM
111+
RETVAL=$?
112+
;;
113+
restart)
114+
stop
115+
start
116+
;;
117+
condrestart)
118+
if [ -f $PID_FILE ] ; then
119+
stop
120+
start
121+
fi
122+
;;
123+
*)
124+
echo $"Usage: $PROG {start|stop|restart|condrestart|status|debug|help}"
125+
exit 1
126+
esac
127+
128+
exit $RETVAL

sipXconfig/bin/kamailio-proxy.in

+128
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#!/bin/bash
2+
#
3+
# Startup script for Kamailio proxy
4+
#
5+
# chkconfig: 345 85 15
6+
# description: Kamailio is a fast SIP Server.
7+
#
8+
# processname: kamailio
9+
# pidfile: @SIPX_RUNDIR@/$PROG.pid
10+
# config: @SIPX_CONFDIR@/$PROG.cfg
11+
12+
# Source function library.
13+
. /etc/rc.d/init.d/functions
14+
15+
KAM=/usr/sbin/kamailio
16+
PROG=kamailio-proxy
17+
KAM=/usr/sbin/kamailio
18+
KAMCFG=@SIPX_CONFDIR@/$PROG.cfg
19+
PID_FILE=@SIPX_RUNDIR@/$PROG.pid
20+
LOCK_FILE=@SIPX_LOCKDIR@/$PROG
21+
DEFAULTS=@SIPX_CONFDIR@/kamailio.default
22+
RETVAL=0
23+
RUN_KAMAILIO=no
24+
25+
26+
# Do not start kamailio if fork=no is set in the config file
27+
# otherwise the boot process will just stop
28+
check_fork ()
29+
{
30+
if grep -q "^[[:space:]]*fork[[:space:]]*=[[:space:]]*no.*" $KAMCFG; then
31+
echo "Not starting $DESC: fork=no specified in config file; run /etc/init.d/kamailio debug instead"
32+
exit 1
33+
fi
34+
}
35+
36+
check_kamailio_config ()
37+
{
38+
# Check if kamailio configuration is valid before starting the server
39+
out=$($KAM -f $KAMCFG -M $PKG_MEMORY -c 2>&1 > /dev/null)
40+
retcode=$?
41+
if [ "$retcode" != '0' ]; then
42+
echo "Not starting $DESC: invalid configuration file!"
43+
echo -e "\n$out\n"
44+
exit 1
45+
fi
46+
}
47+
48+
49+
start() {
50+
check_kamailio_config
51+
if [ "$1" != "debug" ]; then
52+
check_fork
53+
fi
54+
echo -n $"Starting $PROG: "
55+
daemon $KAM $OPTIONS >/dev/null 2>/dev/null
56+
RETVAL=$?
57+
echo
58+
[ $RETVAL = 0 ] && touch $LOCK_FILE && success
59+
return $RETVAL
60+
}
61+
62+
stop() {
63+
echo -n $"Stopping $PROG: "
64+
killproc -p $PID_FILE $KAM
65+
RETVAL=$?
66+
echo
67+
[ $RETVAL = 0 ] && rm -f $LOCK_FILE $PID_FILE
68+
}
69+
70+
# Load startup options if available
71+
if [ -f $DEFAULTS ]; then
72+
. $DEFAULTS || true
73+
fi
74+
75+
if [ "$RUN_KAMAILIO" != "yes" ]; then
76+
echo "Kamailio not yet configured. Edit /etc/default/kamailio first."
77+
exit 0
78+
fi
79+
80+
81+
SHM_MEMORY=$((`echo $SHM_MEMORY | sed -e 's/[^0-9]//g'`))
82+
PKG_MEMORY=$((`echo $PKG_MEMORY | sed -e 's/[^0-9]//g'`))
83+
[ -z "$USER" ] && USER=kamailio
84+
[ -z "$GROUP" ] && GROUP=kamailio
85+
[ $SHM_MEMORY -le 0 ] && SHM_MEMORY=64
86+
[ $PKG_MEMORY -le 0 ] && PKG_MEMORY=8
87+
88+
if test "$DUMP_CORE" = "yes" ; then
89+
# set proper ulimit
90+
ulimit -c unlimited
91+
92+
# directory for the core dump files
93+
# COREDIR=/home/corefiles
94+
# [ -d $COREDIR ] || mkdir $COREDIR
95+
# chmod 777 $COREDIR
96+
# echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern
97+
fi
98+
99+
OPTIONS="-f $KAMCFG -P $PID_FILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP $EXTRA_OPTIONS"
100+
101+
# See how we were called.
102+
case "$1" in
103+
start|debug)
104+
start
105+
;;
106+
stop)
107+
stop
108+
;;
109+
status)
110+
status -p "$PID_FILE" -l "$LOCK_FILE" $KAM
111+
RETVAL=$?
112+
;;
113+
restart)
114+
stop
115+
start
116+
;;
117+
condrestart)
118+
if [ -f $PID_FILE ] ; then
119+
stop
120+
start
121+
fi
122+
;;
123+
*)
124+
echo $"Usage: $PROG {start|stop|restart|condrestart|status|debug|help}"
125+
exit 1
126+
esac
127+
128+
exit $RETVAL

0 commit comments

Comments
 (0)