single_command.tcl 558 B

1234567891011121314151617181920212223
  1. #!/usr/bin/tclsh
  2. lappend auto_path .
  3. package require esl
  4. if { $argc < 1 } {
  5. puts "Usage: tclsh $argv0 command arg(s)"
  6. puts "Example: tclsh $argv0 status"
  7. exit
  8. }
  9. #
  10. # Open connection to FreeSWITCH ESL
  11. # (FreeSWITCH must be running for this to work)
  12. #
  13. ESLconnection esl {127.0.0.1} 8021 {ClueCon}
  14. #
  15. # Send request (given as args to sendRecv)
  16. # Get answer from FreeSWITCH (return value from sendRecv)
  17. # Translate reponse to text (getBody command)
  18. # Print it (puts)
  19. #
  20. puts [ESLevent_getBody [esl sendRecv {api status}]]