]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
tcl example thanks Mark Mann
authorBrian West <brian@freeswitch.org>
Thu, 14 Jan 2010 14:39:57 +0000 (14:39 +0000)
committerBrian West <brian@freeswitch.org>
Thu, 14 Jan 2010 14:39:57 +0000 (14:39 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16307 d0543943-73ff-0310-b7d9-9358b9ac24b2

libs/esl/tcl/pkgIndex.tcl [new file with mode: 0644]
libs/esl/tcl/single_command.tcl [new file with mode: 0755]

diff --git a/libs/esl/tcl/pkgIndex.tcl b/libs/esl/tcl/pkgIndex.tcl
new file mode 100644 (file)
index 0000000..4379890
--- /dev/null
@@ -0,0 +1,11 @@
+# Tcl package index file, version 1.1
+# This file is generated by the "pkg_mkIndex" command
+# and sourced either when an application starts up or
+# by a "package unknown" script.  It invokes the
+# "package ifneeded" command to set up package-related
+# information so that packages will be loaded automatically
+# in response to "package require" commands.  When this
+# script is sourced, the variable $dir must contain the
+# full path name of this file's directory.
+
+package ifneeded esl 0.0 [list load [file join $dir ESL.so]]
diff --git a/libs/esl/tcl/single_command.tcl b/libs/esl/tcl/single_command.tcl
new file mode 100755 (executable)
index 0000000..0410e14
--- /dev/null
@@ -0,0 +1,22 @@
+lappend auto_path .
+package require esl
+
+if { $argc < 1 } {
+       puts "Usage:   tclsh $argv0 command arg(s)"
+       puts "Example: tclsh $argv0 status"
+       exit
+}
+
+#
+# Open connection to FreeSWITCH ESL
+#   (FreeSWITCH must be running for this to work)
+#
+ESLconnection esl {127.0.0.1} 8021 {ClueCon}
+
+#
+# Send request               (given as args to sendRecv)
+# Get answer from FreeSWITCH (return value from sendRecv)
+# Translate reponse to text  (getBody command)
+# Print it                   (puts)
+#
+puts [ESLevent_getBody [esl sendRecv {api status}]]