[sr-dev] git:master:33fa1f11: kamctl: added miprint command

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 22 14:36:37 CET 2016


Module: kamailio
Branch: master
Commit: 33fa1f11e892fdafa07335268dae6786ead101ac
URL: https://github.com/kamailio/kamailio/commit/33fa1f11e892fdafa07335268dae6786ead101ac

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-11-22T14:30:16+01:00

kamctl: added miprint command

- print the mi command to be sent to fifo file

---

Modified: utils/kamctl/kamctl
Modified: utils/kamctl/kamctl.fifo

---

Diff:  https://github.com/kamailio/kamailio/commit/33fa1f11e892fdafa07335268dae6786ead101ac.diff
Patch: https://github.com/kamailio/kamailio/commit/33fa1f11e892fdafa07335268dae6786ead101ac.patch

---

diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index d88f182..5f29e41 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -2812,6 +2812,12 @@ case $1 in
 		$CTLCMD "$@"
 		;;
 
+	fifoprint|miprint)
+		require_ctlengine
+		shift
+		$CTLCMDPRINT "$@"
+		;;
+
 	ser|sercmd|kamcmd)
 		require_kamcmd
 		shift
diff --git a/utils/kamctl/kamctl.fifo b/utils/kamctl/kamctl.fifo
index b71c5fc..1fc622c 100644
--- a/utils/kamctl/kamctl.fifo
+++ b/utils/kamctl/kamctl.fifo
@@ -49,7 +49,7 @@ USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_fifo"
 fifo_cmd()
 {
 	mdbg "entering fifo_cmd $*"
-	
+
 	if [ "$#" -lt 1 ]; then
 		merr "fifo_cmd must take at least command name as parameter"
 		exit 1
@@ -106,6 +106,24 @@ fifo_cmd()
 
 CTLCMD=fifo_cmd
 
+fifo_cmd_print()
+{
+	# construct the command now
+	CMD=":$1:$name\n";
+	shift
+	while [ -n "$1" ] ; do
+		CMD="${CMD}${1}\n"
+		shift
+	done
+	CMD="${CMD}\n"
+
+	minfo "The command is:\n"
+
+	mecho "$CMD"
+}
+
+CTLCMDPRINT=fifo_cmd_print
+
 fifo_kamailio_monitor() {
 	name=kamailio_receiver_$$
 	path=$CHROOT_DIR/tmp/$name
@@ -139,7 +157,7 @@ fifo_kamailio_monitor() {
 		attempt=`$EXPR $attempt + 1`
 		#clear
 		tput clear
-		
+
 		# print_stats $name $path $attempt
 		mecho "[cycle #: $attempt; if constant make sure server lives]"
 
@@ -190,7 +208,7 @@ usrloc:
 
 EOF
 		wait
-		
+
 		if [ $loops -ne $attempt ] ; then
 			sleep $WATCH_PERIOD
 		fi




More information about the sr-dev mailing list