From 0a6f0ab0c7b43e22d65d3b1cd3022d7a90ae570c Mon Sep 17 00:00:00 2001 From: DanB Date: Tue, 5 Aug 2014 22:41:56 +0200 Subject: [PATCH] Fixups osips_event tutorial --- cmd/cgr-engine/cgr-engine.go | 2 +- data/conf/cgrates.cfg | 1 - .../osips_event/cgrates/etc/cgrates/cgrates.cfg | 3 +-- .../osips_event/opensips/etc/init.d/opensips | 4 ++-- pkg/debian/rules | 11 ++++++----- pkg/pkg_cgrates_deb.sh | 10 +++++----- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/cmd/cgr-engine/cgr-engine.go b/cmd/cgr-engine/cgr-engine.go index 7f5423a5d..b3782cb07 100644 --- a/cmd/cgr-engine/cgr-engine.go +++ b/cmd/cgr-engine/cgr-engine.go @@ -166,7 +166,7 @@ func startSessionManager(responder *engine.Responder, loggerDb engine.LogStorage } else if cfg.SMCdrS == utils.INTERNAL { <-cacheChan // Wait for the cache to init before start doing queries cdrsConn = responder - } else { + } else if len(cfg.SMCdrS) != 0 { for i := 0; i < cfg.SMReconnects; i++ { client, err = rpcclient.NewRpcClient("tcp", cfg.SMCdrS, 0, cfg.SMReconnects, utils.GOB) if err == nil { //Connected so no need to reiterate diff --git a/data/conf/cgrates.cfg b/data/conf/cgrates.cfg index 88e042b0d..48cafe74d 100644 --- a/data/conf/cgrates.cfg +++ b/data/conf/cgrates.cfg @@ -116,7 +116,6 @@ # rated_subjects = # Filter on CDR RatedSubject fields # cost_intervals = # Filter on CDR Cost - [session_manager] # enabled = false # Starts SessionManager service: # switch_type = freeswitch # Defines the type of switch behind: diff --git a/data/tutorials/osips_event/cgrates/etc/cgrates/cgrates.cfg b/data/tutorials/osips_event/cgrates/etc/cgrates/cgrates.cfg index 4f90bd033..25206c5ff 100644 --- a/data/tutorials/osips_event/cgrates/etc/cgrates/cgrates.cfg +++ b/data/tutorials/osips_event/cgrates/etc/cgrates/cgrates.cfg @@ -119,6 +119,7 @@ time_window = 5m # Will only keep the CDRs who's call setup time is not older enabled = true # Starts SessionManager service: switch_type = opensips # Defines the type of switch behind: # rater = internal # Address where to reach the Rater +cdrs = internal # Address where to reach the CDR server for CDR processing # reconnects = 3 # Number of reconnects to rater/cdrs before giving up. # debit_interval = 10 # Interval to perform debits on. # min_call_duration = 0s # Only authorize calls with allowed duration bigger than this @@ -136,8 +137,6 @@ switch_type = opensips # Defines the type of switch behind: [opensips] # listen_udp = 127.0.0.1:2020 # Address where to listen for datagram events coming from OpenSIPS # mi_addr = 127.0.0.1:8020 # Adress where to reach OpenSIPS mi_datagram module -# events_subscribe_interval = 60s # Automatic events subscription to OpenSIPS, 0 to disable it -# cdrs = internal # Address where to reach CDR Server, empty to disable CDR processing <""|internal|127.0.0.1:2013> # reconnects = 3 # Number of attempts on connect failure. [derived_charging] diff --git a/data/tutorials/osips_event/opensips/etc/init.d/opensips b/data/tutorials/osips_event/opensips/etc/init.d/opensips index f64a959d7..c2f22cbed 100755 --- a/data/tutorials/osips_event/opensips/etc/init.d/opensips +++ b/data/tutorials/osips_event/opensips/etc/init.d/opensips @@ -19,7 +19,7 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/opensips NAME=opensips DESC=opensips -TUTFOLDER = /usr/share/cgrates/tutorials/osips_event/opensips +TUTFOLDER=/usr/share/cgrates/tutorials/osips_event/opensips CFGFILE=$TUTFOLDER/etc/opensips/opensips.cfg M4CFGFILE=$TUTFOLDER/etc/opensips/opensips.m4 M4ARCHIVEDIR=$TUTFOLDER/etc/opensips/archive @@ -107,7 +107,7 @@ if test "$DUMP_CORE" = "yes" ; then # echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern fi -OPTIONS="-P $PIDFILE -m $S_MEMORY -M $P_MEMORY -u $USER -g $GROUP" +OPTIONS="-f $CFGFILE -P $PIDFILE -m $S_MEMORY -M $P_MEMORY -u $USER -g $GROUP" case "$1" in start|debug) diff --git a/pkg/debian/rules b/pkg/debian/rules index 716004c41..81a0b841b 100755 --- a/pkg/debian/rules +++ b/pkg/debian/rules @@ -4,25 +4,26 @@ # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 -export GOPATH=$(CURDIR) +#export GOPATH=$(CURDIR) +export GOPATH=/usr/local/goapps PKGDIR=debian/cgrates -SRCDIR=src/github.com/cgrates/cgrates +SRCDIR=/usr/local/src/cgrates/cgrates.git/cgrates %: dh $@ clean: dh_clean - rm -rf $(GOPATH)/bin/* $(GOPATH)/pkg/* + #rm -rf $(GOPATH)/bin/* $(GOPATH)/pkg/* #cd $(GOPATH)/src && find * -name '*.go' -exec dirname {} \; | xargs -n1 go clean rm -f $(GOPATH)/goinstall.log binary-arch: clean dh_prep dh_installdirs - exec $(SRCDIR)/update_external_libs.sh - cd $(SRCDIR) && go install + #exec $(SRCDIR)/update_external_libs.sh + #cd $(SRCDIR) && go install mkdir -p $(PKGDIR)/usr/bin cp $(GOPATH)/bin/cgr-* $(PKGDIR)/usr/bin/ mkdir -p $(PKGDIR)/etc/cgrates diff --git a/pkg/pkg_cgrates_deb.sh b/pkg/pkg_cgrates_deb.sh index 7273621db..8a1c77551 100755 --- a/pkg/pkg_cgrates_deb.sh +++ b/pkg/pkg_cgrates_deb.sh @@ -5,10 +5,10 @@ rm -rf $WORK_DIR mkdir -p $WORK_DIR cp -r debian $WORK_DIR/debian cd $WORK_DIR -git clone https://github.com/cgrates/cgrates.git src/github.com/cgrates/cgrates -tar xvzf src/github.com/cgrates/cgrates/data/tutorials/fs_csv/freeswitch/etc/freeswitch_conf.tar.gz -rm src/github.com/cgrates/cgrates/data/tutorials/fs_csv/freeswitch/etc/freeswitch_conf.tar.gz -tar xvzf src/github.com/cgrates/cgrates/data/tutorials/fs_json/freeswitch/etc/freeswitch_conf.tar.gz -rm src/github.com/cgrates/cgrates/data/tutorials/fs_json/freeswitch/etc/freeswitch_conf.tar.gz +#git clone https://github.com/cgrates/cgrates.git src/github.com/cgrates/cgrates +#tar xvzf src/github.com/cgrates/cgrates/data/tutorials/fs_csv/freeswitch/etc/freeswitch_conf.tar.gz +#rm src/github.com/cgrates/cgrates/data/tutorials/fs_csv/freeswitch/etc/freeswitch_conf.tar.gz +#tar xvzf src/github.com/cgrates/cgrates/data/tutorials/fs_json/freeswitch/etc/freeswitch_conf.tar.gz +#rm src/github.com/cgrates/cgrates/data/tutorials/fs_json/freeswitch/etc/freeswitch_conf.tar.gz dpkg-buildpackage -us -uc #rm -rf $WORK_DIR