sjthomason / pyesl Goto Github PK
View Code? Open in Web Editor NEWPure Python FreeSWITCH Event Socket Client Library
License: MIT License
Pure Python FreeSWITCH Event Socket Client Library
License: MIT License
The example in wiki is like this:-
import SocketServer
import ESL
class ESLRequestHandler(SocketServer.BaseRequestHandler):
def setup(self):
print self.client_address, 'connected!'
fd = self.request.fileno()
print fd
con = ESL.ESLconnection(fd)
print 'Connected: ', 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()
ESL.ESLconnection()
being passed a file descriptor. The current ESLconnection.__init__(self, host, port, password)
seem not supporting this.
The __init__
signature for official lib:-
class ESLconnection(builtins.object)
| Methods defined here:
|
| __del__ lambda self
|
| __getattr__ lambda self, name
|
| __init__(self, *args)
And the corresponding cpp source:-
ESLconnection::ESLconnection(int socket)
{
connection_construct_common();
esl_attach_handle(&handle, (esl_socket_t)socket, NULL);
}
What prevents sendRecv
from becoming an infinity loop if self.__event_queue
is empty and it gets an event with the a content type other than "api/response" or "command/reply"?
If I'm reading your code correctly (and I'm not sure that I am) then sendRecv
would store this event in self.__event_queue
and then call self.recvEvent()
which grabs the just stored event from the queue and returns it again.
Is there something I'm missing?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.