mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-07 21:44:51 +00:00
ESL-9
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12729 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
523e0653ed
commit
80e6a1bd0f
@ -2,21 +2,42 @@
|
|||||||
|
|
||||||
import string
|
import string
|
||||||
import sys
|
import sys
|
||||||
|
from optparse import OptionParser
|
||||||
from ESL import *
|
from ESL import *
|
||||||
|
|
||||||
con = ESLconnection("localhost","8021","ClueCon")
|
def main(argv):
|
||||||
#are we connected?
|
|
||||||
|
|
||||||
if con.connected:
|
try:
|
||||||
|
|
||||||
#get argument passed to script
|
parser = OptionParser()
|
||||||
command = string.join(sys.argv[1:])
|
parser.add_option("-a", "--auth", dest="auth", default="ClueCon",
|
||||||
|
help="ESL password")
|
||||||
|
parser.add_option("-s", "--server", dest="server", default="127.0.0.1",
|
||||||
|
help="FreeSWITCH server IP address")
|
||||||
|
parser.add_option("-p", "--port", dest="port", default="8021",
|
||||||
|
help="FreeSWITCH server event socket port")
|
||||||
|
parser.add_option("-c", "--command", dest="command",
|
||||||
|
help="command to run, surround mutli word commands in \"\'s")
|
||||||
|
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
con = ESLconnection(options.server, options.port, options.auth)
|
||||||
|
#are we connected?
|
||||||
|
|
||||||
|
if con.connected:
|
||||||
#run command
|
#run command
|
||||||
e=con.sendRecv("api "+ command)
|
e=con.sendRecv("api "+ options.command)
|
||||||
print e.getBody()
|
print e.getBody()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
print "Not Connected"
|
print "Not Connected"
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
except:
|
||||||
|
|
||||||
|
print parser.get_usage()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main(sys.argv[1:])
|
Loading…
x
Reference in New Issue
Block a user