[sr-dev] git:master: kamctl: use FIFOPATH instead of OSER_FIFO in kamctlrc

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 27 11:38:57 CEST 2013


Module: sip-router
Branch: master
Commit: a075383454c92bed225b7904920090f515a938d5
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a075383454c92bed225b7904920090f515a938d5

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Aug 27 11:16:52 2013 +0200

kamctl: use FIFOPATH instead of OSER_FIFO in kamctlrc

- no longer relation to former project name, however OSER_FIFO can still
  be set to keep the compatibility with older deployemnts, but will be
  used only when FIFOPATH is not explicitely set

---

 utils/kamctl/kamctl.fifo |   34 +++++++++++++++++++---------------
 utils/kamctl/kamctlrc    |    2 +-
 2 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/utils/kamctl/kamctl.fifo b/utils/kamctl/kamctl.fifo
index fead9de..50c8e92 100644
--- a/utils/kamctl/kamctl.fifo
+++ b/utils/kamctl/kamctl.fifo
@@ -23,8 +23,12 @@ fi
 ##### ----------------------------------------------- #####
 ### parameters
 #
-if [ -z "$OSER_FIFO" ]; then
-	OSER_FIFO=/tmp/kamailio_fifo
+if [ -z "$FIFOPATH" ]; then
+	if [ -z "$OSER_FIFO" ]; then
+		FIFOPATH=/tmp/kamailio_fifo
+	else
+		FIFOPATH=$OSER_FIFO
+	fi
 fi
 
 #
@@ -53,12 +57,12 @@ fifo_cmd()
 	fi
 	name=kamailio_receiver_$$
 	path=$CHROOT_DIR/tmp/$name
-	if [ ! -w $OSER_FIFO ]; then
-		merr "Error opening Kamailio's FIFO $OSER_FIFO"
-		merr "Make sure you have the line 'modparam(\"mi_fifo\", \"fifo_name\", \"$OSER_FIFO\")' in your config"
+	if [ ! -w $FIFOPATH ]; then
+		merr "Error opening Kamailio's FIFO $FIFOPATH"
+		merr "Make sure you have the line 'modparam(\"mi_fifo\", \"fifo_name\", \"$FIFOPATH\")' in your config"
 		merr "and also have loaded the mi_fifo module."
 		if [ ! -z $CHROOT_DIR ]; then
-			merr "[chrooted environment] Check that $OSER_FIFO is symlinked to ${CHROOT_DIR}${OSER_FIFO}"
+			merr "[chrooted environment] Check that $FIFOPATH is symlinked to ${CHROOT_DIR}${FIFOPATH}"
 		fi
 		exit 2
 	fi
@@ -87,7 +91,7 @@ fifo_cmd()
 	cat < $path | filter_fl &
 
 	# issue FIFO request (printf taken to deal with \n)
-	printf "$CMD" > $OSER_FIFO
+	printf "$CMD" > $FIFOPATH
 
 	# wait for the reader to complete
 	wait
@@ -102,9 +106,9 @@ CTLCMD=fifo_cmd
 fifo_kamailio_monitor() {
 	name=kamailio_receiver_$$
 	path=$CHROOT_DIR/tmp/$name
-	if [ ! -w $OSER_FIFO ]; then
-		merr "Error opening Kamailio's FIFO $OSER_FIFO"
-		merr "Make sure you have the line 'modparam(\"mi_fifo\", \"fifo_name\", \"$OSER_FIFO\")' in your config"
+	if [ ! -w $FIFOPATH ]; then
+		merr "Error opening Kamailio's FIFO $FIFOPATH"
+		merr "Make sure you have the line 'modparam(\"mi_fifo\", \"fifo_name\", \"$FIFOPATH\")' in your config"
 		merr "and also have loaded the mi_fifo module."
 		exit 1
 	fi
@@ -133,14 +137,14 @@ fifo_kamailio_monitor() {
 		mecho "[cycle #: $attempt; if constant make sure server lives]"
 
 		cat < $path | filter_fl &
-		cat > $OSER_FIFO <<EOF
+		cat > $FIFOPATH <<EOF
 :version:$name
 
 EOF
 		wait
 
 		cat < $path | filter_fl &
-		cat > $OSER_FIFO << EOF
+		cat > $FIFOPATH << EOF
 :uptime:$name
 
 EOF
@@ -149,7 +153,7 @@ EOF
 
 		mecho "Transaction Statistics: "
 		cat < $path | filter_fl &
-		cat > $OSER_FIFO <<EOF
+		cat > $FIFOPATH <<EOF
 :get_statistics:$name
 UAS_transactions
 UAC_transactions
@@ -161,7 +165,7 @@ EOF
 
 		mecho "Stateless Server Statistics: "
 		cat < $path | filter_fl &
-		cat > $OSER_FIFO <<EOF
+		cat > $FIFOPATH <<EOF
 :get_statistics:$name
 sent_replies
 sent_err_replies
@@ -173,7 +177,7 @@ EOF
 
 		mecho "UsrLoc Stats: "
 		cat < $path | filter_fl &
-		cat > $OSER_FIFO <<EOF
+		cat > $FIFOPATH <<EOF
 :get_statistics:$name
 usrloc:
 
diff --git a/utils/kamctl/kamctlrc b/utils/kamctl/kamctlrc
index e5d8311..472d991 100644
--- a/utils/kamctl/kamctlrc
+++ b/utils/kamctl/kamctlrc
@@ -122,7 +122,7 @@
 # CTLENGINE="FIFO"
 
 ## path to FIFO file
-# OSER_FIFO="FIFO"
+# FIFOPATH="/tmp/kamailio_fifo"
 
 ## check ACL names; default on (1); off (0)
 # VERIFY_ACL=1




More information about the sr-dev mailing list