Skip to content

Commit

Permalink
sync from commercial e8f86eb921b988c0f1dc42e29ce9343749d08611
Browse files Browse the repository at this point in the history
  • Loading branch information
iedemam committed Dec 4, 2014
1 parent fec84a2 commit 81df6d7
Show file tree
Hide file tree
Showing 25 changed files with 492 additions and 137 deletions.
38 changes: 24 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
._*
*.a
*.o
*.in
*.la
*.lo
*.cgi
.deps
.libs
build-arch-stamp
build-indep-stamp
comp128
configure-stamp
debian/debhelper.log
debian/files
debian/substvars
debian/tmp/
sipauthserve
Makefile
Makefile.in
depcomp
install-sh
missing
aclocal.m4
autom4te.cache/
build-arch-stamp
build-indep-stamp
config.guess
config.h
config.h.in
config.log
config.status
config.sub
configure
depcomp
install-sh
configure-stamp
debian/debhelper.log
debian/files
debian/substvars
debian/tmp/
debian/sipauthserve.debhelper.log
debian/sipauthserve.substvars
debian/sipauthserve/
config.h.in~
libtool
ltmain.sh
missing
stamp-h1
apps/comp128
apps/sipauthserve
apps/subscriberRegistry.example.sql
apps/sipauthserve.example.sql
sipauthserve.example.sql
package/tmp
2 changes: 1 addition & 1 deletion CommonLibs
2 changes: 1 addition & 1 deletion Globals/Globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
#include "config.h"
#include <Globals.h>

const char *gVersionString = "release " VERSION "+" REPO_REV " built " TIMESTAMP_ISO " ";
const char *gVersionString = "release " VERSION " built " TIMESTAMP_ISO " " REPO_REV " ";
6 changes: 1 addition & 5 deletions Globals/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,10 @@

include $(top_srcdir)/Makefile.common

AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES)
AM_CXXFLAGS = -Wall

noinst_LTLIBRARIES = libglobals.la

libglobals_la_SOURCES = Globals.cpp

noinst_PROGRAMS =

noinst_HEADERS = \
Globals.h
noinst_HEADERS = Globals.h
17 changes: 5 additions & 12 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,17 @@

include $(top_srcdir)/Makefile.common

DESTDIR :=

AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(WITH_INCLUDES)
AM_CXXFLAGS = -Wall -pthread -ldl
DESTDIR ?=
# must be kept in sync with AC_CONFIG_MACRO_DIR in configure.ac
ACLOCAL_AMFLAGS = -I config

noinst_LTLIBRARIES = libSR.la

libSR_la_SOURCES = \
SubscriberRegistry.cpp
SubscriberRegistry.cpp

noinst_HEADERS = \
SubscriberRegistry.h
SubscriberRegistry.h

# Order must be preserved
SUBDIRS = \
Expand All @@ -42,10 +41,4 @@ SUBDIRS = \
NodeManager \
apps

install: all
$(MAKE) -C ./apps install

dox: FORCE
doxygen doxconfig

FORCE:
12 changes: 6 additions & 6 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

CXXFLAGS := -DTIMESTAMP_ISO=`date +'"%Y-%m-%dT%H:%M:%S"'`
CFLAGS := -DTIMESTAMP_ISO=`date +'"%Y-%m-%dT%H:%M:%S"'`
# must be kept in sync with AC_CONFIG_MACRO_DIR in configure.ac
# ACLOCAL_AMFLAGS = -I config

AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(WITH_INCLUDES)
AM_CXXFLAGS = -Wall -pthread -ldl
AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES)
AM_CXXFLAGS := -Wall -pthread -ldl -DTIMESTAMP_ISO=`date +'"%Y-%m-%dT%H:%M:%S"'`

REPOREV = -D'REPO_REV="$(shell ./$(top_builddir)/Globals/GrabRepoInfo.sh $(top_builddir))"'

COMMON_INCLUDEDIR = $(top_srcdir)/CommonLibs
GLOBALS_INCLUDEDIR = $(top_srcdir)/Globals
NODEMANAGER_INCLUDEDIR = $(top_srcdir)/NodeManager
JSONBOX_INCLUDEDIR = $(top_srcdir)/NodeManager/JsonBox-0.4.3/include
JSONDB_INCLUDEDIR = $(top_srcdir)/NodeManager/JSONDB

REPOREV = -D'REPO_REV="$(shell ./$(top_builddir)/Globals/GrabRepoInfo.sh $(top_builddir))"'

STD_DEFINES_AND_INCLUDES = \
$(REPOREV) \
-I$(COMMON_INCLUDEDIR) \
Expand Down
2 changes: 1 addition & 1 deletion NodeManager
1 change: 0 additions & 1 deletion SubscriberRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,6 @@ SubscriberRegistry::Status SubscriberRegistry::addUser(const char* IMSI, const c
}



char *SubscriberRegistry::mapCLIDGlobal(const char *local)
{
if (!local) {
Expand Down
39 changes: 16 additions & 23 deletions apps/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,24 @@ ourlibs = \
$(COMMON_LA) \
$(NODEMANAGER_LA)

bin_PROGRAMS = sipauthserve comp128

sipauthserve_SOURCES = sipauthserve.cpp ../servershare.cpp ../SubscriberRegistry.cpp \
sbin_PROGRAMS = sipauthserve comp128
bin_SCRIPTS = syslogextractor hexmapper
confdir = /etc/OpenBTS
conf_DATA = sipauthserve.example.sql

sipauthserve_SOURCES = sipauthserve.cpp \
../servershare.cpp \
../SubscriberRegistry.cpp \
../NodeManager/JSONDB/JSONDB.cpp
sipauthserve_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES)
sipauthserve_LDADD = $(ourlibs) -losipparser2 -losip2

comp128_SOURCES = comp128.c
comp128_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES)
comp128_SOURCES = comp128.c
comp128_LDADD = $(ourlibs)

EXTRA_DIST = \
subscriberRegistry.example.sql \
sipauthserve.conf

# Populating comp128 in both locations for backwards compat
install: sipauthserve comp128
mkdir -p "$(DESTDIR)/OpenBTS/"
install comp128 "$(DESTDIR)/OpenBTS/"
install sipauthserve "$(DESTDIR)/OpenBTS/"
mkdir -p "$(DESTDIR)/usr/local/bin/"
install comp128 "$(DESTDIR)/usr/local/bin/"
install syslogextractor "$(DESTDIR)/usr/local/bin/"
install hexmapper "$(DESTDIR)/usr/local/bin/"
mkdir -p "$(DESTDIR)/etc/init/"
install sipauthserve.conf "$(DESTDIR)/etc/init/"
mkdir -p "$(DESTDIR)/etc/OpenBTS/"
install subscriberRegistry.example.sql "$(DESTDIR)/etc/OpenBTS/"
sipauthserve.example.sql: sipauthserve
( ./sipauthserve --gensql > sipauthserve.example.sql || true )

tmp_DB = /tmp/SR.db
TESTS = checkdb.sh
CLEANFILES = $(tmp_DB)

14 changes: 14 additions & 0 deletions apps/checkdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

set -e

tmp_DB='/tmp/SR.db'
conf_DATA='./sipauthserve.example.sql'

if [ ! -f ${conf_DATA} ]; then
exit 1
fi

echo "* check integrity of ${conf_DATA}"
sqlite3 -bail ${tmp_DB} ".read ${conf_DATA}" > /dev/null
exit $?
20 changes: 0 additions & 20 deletions apps/subscriberRegistry.example.sql

This file was deleted.

11 changes: 6 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ dnl You should have received a copy of the GNU General Public License
dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
dnl

AC_INIT(subscriberregistry,5.0.0-prealpha)
AC_PREREQ(2.57)
AC_CONFIG_SRCDIR([config/Makefile.am])
AC_CONFIG_AUX_DIR([.])
AM_CONFIG_HEADER(config.h)
AC_INIT(sipauthserve,5.0-master)

AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET

AM_INIT_AUTOMAKE
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE([-Wno-portability])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([config])
AC_CONFIG_SRCDIR([SubscriberRegistry.cpp])

AM_PROG_AS
AC_PROG_CXX
Expand Down
4 changes: 2 additions & 2 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sipauthserve (5.0) unstable; urgency=low
sipauthserve (5.0-master) unstable; urgency=low

* Test

-- Donald C. Kirker <donald.kirker@rangenetworks.com> Mon, 22 Apr 2013 00:11:00 -0700
-- Range Packager <buildmeister@rangenetworks.com> Thu, 25 Sep 2014 00:17:42 -0700
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7
3 changes: 3 additions & 0 deletions debian/dirs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var/lib/asterisk/sqlite3dir
etc/OpenBTS
OpenBTS
2 changes: 2 additions & 0 deletions debian/links
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
usr/local/sbin/comp128 OpenBTS/comp128
usr/local/sbin/sipauthserve OpenBTS/sipauthserve
32 changes: 10 additions & 22 deletions debian/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,22 @@ set -e

configure()
{
WEBUSER=www-data
DATE=$(date --rfc-3339='date')
CONFIG_BACKUP=/etc/OpenBTS/OpenBTS.dump-$DATE


CONFIG_BACKUP=/etc/OpenBTS/sipauthserve.dump-$DATE
if [ ! -e $CONFIG_BACKUP ]; then
sqlite3 /etc/OpenBTS/OpenBTS.db ".dump" > $CONFIG_BACKUP
sqlite3 /etc/OpenBTS/sipauthserve.db ".dump" > $CONFIG_BACKUP
fi

sqlite3 /etc/OpenBTS/OpenBTS.db ".read /etc/OpenBTS/subscriberRegistry.example.sql" > /dev/null 2>&1

if [ ! -d /var/lib/asterisk/sqlite3dir ]; then
mkdir -p /var/lib/asterisk/sqlite3dir
fi
sqlite3 /etc/OpenBTS/sipauthserve.db ".read /etc/OpenBTS/sipauthserve.example.sql" > /dev/null 2>&1

SRPATH=/var/lib/asterisk/sqlite3dir/sqlite3.db

DATE=$(date --rfc-3339='date')
SR_CONFIG_BACKUP=$SRPATH.dump-$DATE

SR_BACKUP=$SRPATH.dump-$DATE

if [[ -e $SRPATH && "`sqlite3 $SRPATH "PRAGMA table_info(sip_buddies)" || true`" != "" ]]; then
if [ ! -e $SR_CONFIG_BACKUP ]; then
sqlite3 $SRPATH ".dump" > $SR_CONFIG_BACKUP
if [ ! -e $SR_BACKUP ]; then
sqlite3 $SRPATH ".dump" > $SR_BACKUP
fi

HASPREPAID=`sqlite3 $SRPATH "PRAGMA table_info(sip_buddies)" | grep prepaid || true`
Expand All @@ -61,15 +54,10 @@ if [[ -e $SRPATH && "`sqlite3 $SRPATH "PRAGMA table_info(sip_buddies)" || true`"
sqlite3 $SRPATH "insert or ignore into 'rates' values ('out-of-network-call', 1)"
fi


# set up permissions for webui, temporary fix until ui is replumbed to use json
# directory permissions
chown -R root:www-data /var/lib/asterisk/sqlite3dir
chmod 775 /var/lib/asterisk/sqlite3dir/
if [ -e /var/lib/asterisk/sqlite3dir/sqlite3.db ]; then
chmod 664 /var/lib/asterisk/sqlite3dir/sqlite3*
fi

chown -R root:${WEBUSER} /var/lib/asterisk/sqlite3dir
chmod -R ug+rw /var/lib/asterisk/sqlite3dir/
chmod -R o-w /var/lib/asterisk/sqlite3dir/
}

case "$1" in
Expand Down
9 changes: 3 additions & 6 deletions debian/prerm
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ set -e
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

# remove()
# {
# killall runloop.sipauthserve.sh &>/dev/null
# }

case "$1" in
remove|upgrade|deconfigure)
# remove
set +e
stop sipauthserve
set -e
;;

failed-upgrade)
Expand Down
Loading

0 comments on commit 81df6d7

Please sign in to comment.