[sr-dev] git:master: kamctl: added shortcuts for dialog mi commands

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 5 15:11:12 CET 2013


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Nov  5 15:10:29 2013 +0100

kamctl: added shortcuts for dialog mi commands

---

 utils/kamctl/kamctl      |   30 +++++++++++++++++++++++++++++-
 utils/kamctl/kamctl.base |   18 ++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletions(-)

diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index 2e25d2e..b286d55 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -1550,7 +1550,6 @@ cr() {
 	esac
 }
 
-
 #
 ##### ------------------------------------------------ #####
 ### DISPATCHER management
@@ -1643,6 +1642,30 @@ dispatcher() {
 
 #
 ##### ------------------------------------------------ #####
+### DIALOG management
+#
+dialog() {
+	case $1 in
+		show|list)
+			require_ctlengine
+			mecho "dialog memory records"
+			$CTLCMD dlg_list
+			;;
+		showdb)
+			require_dbengine
+			mecho "dialog database records"
+			QUERY="select * FROM $DIALOG_TABLE ORDER BY id; "
+			$DBROCMD "$QUERY"
+			;;
+		*)
+			usage_dialog
+			exit 1
+
+	esac
+}
+
+#
+##### ------------------------------------------------ #####
 ### DIALPLAN management
 #
 dialplan() {
@@ -2732,6 +2755,11 @@ case $1 in
 		dispatcher "$@"
 		;;
 
+	dialog)
+		shift
+		dialog "$@"
+		;;
+
 	dialplan)
 		shift
 		dialplan "$@"
diff --git a/utils/kamctl/kamctl.base b/utils/kamctl/kamctl.base
index a5e6211..27532a3 100644
--- a/utils/kamctl/kamctl.base
+++ b/utils/kamctl/kamctl.base
@@ -314,6 +314,11 @@ DISPATCHER_PRIORITY_COLUMN=priority
 DISPATCHER_ATTRS_COLUMN=attrs
 DISPATCHER_DESCRIPTION_COLUMN=description
 
+# dialog tables
+if [ -z "$DIALOG_TABLE" ] ; then
+	DIALOG_TABLE=dialog
+fi
+
 # dialplan tables
 if [ -z "$DIALPLAN_TABLE" ] ; then
 	DIALPLAN_TABLE=dialplan
@@ -483,6 +488,19 @@ EOF
 }
 USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_dispatcher"
 
+usage_dialog() {
+	echo
+	mecho " -- command 'dialog' - manage dialog records"
+	echo
+cat <<EOF
+   * Examples: dialog show
+   *           dialog showdb
+ dialog show ..................... show in-memory dialog records
+ dialog showdb ................... show database dialog records
+EOF
+}
+USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_dialog"
+
 usage_dialplan() {
 	echo
 	mecho " -- command 'dialplan' - manage dialplans"




More information about the sr-dev mailing list