mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
[mod_python3, ESL py3mod] Add Python3 support.
This commit is contained in:
29
libs/esl/python3/server.py
Normal file
29
libs/esl/python3/server.py
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import SocketServer
|
||||
from ESL import *
|
||||
|
||||
class ESLRequestHandler(SocketServer.BaseRequestHandler ):
|
||||
def setup(self):
|
||||
print self.client_address, 'connected!'
|
||||
|
||||
fd = self.request.fileno()
|
||||
print fd
|
||||
|
||||
con = ESLconnection(fd)
|
||||
print "Connected: "
|
||||
print con.connected()
|
||||
if con.connected():
|
||||
|
||||
info = con.getInfo()
|
||||
|
||||
uuid = info.getHeader("unique-id")
|
||||
print uuid
|
||||
con.execute("answer", "", uuid)
|
||||
con.execute("playback", "/ram/swimp.raw", uuid);
|
||||
|
||||
#server host is a tuple ('host', port)
|
||||
server = SocketServer.ThreadingTCPServer(('', 8040), ESLRequestHandler)
|
||||
server.serve_forever()
|
||||
|
||||
|
Reference in New Issue
Block a user