浏览代码

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
Daniel-Constantin Mierla 12 年之前
父节点
当前提交
a075383454
共有 2 个文件被更改,包括 20 次插入16 次删除
  1. 19 15
      utils/kamctl/kamctl.fifo
  2. 1 1
      utils/kamctl/kamctlrc

+ 19 - 15
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:
 

+ 1 - 1
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