ESL Example Clients
Some examples of Event Socket clients to inspire your own code.
Click to expand Table of Contents
- 1 Liverpie
- 2 Telnet Client
- 3 Ruby Libraries
- 4 Python Libraries
- 5 PHP Client
- 6 Java Client Libraries
- 7 Javascript / Node.js library
- 8 .NET Client library
- 9 Go Client library (golang)
Liverpie
Liverpie (language independent IVR proxy) is a free little piece of software, written in Ruby, that talks to FreeSWITCH on one side, and to any web application on the other, regardless of language, platform etc. It translates FreeSWITCH mod_socket dialogue into HTTP talk (embedding various parameters in HTTP headers), so you can write your own http-speaking finite state machine and hook it to FreeSWITCH via Liverpie. Note also that Liverpie expects the response in YAML so you can save yourself the pain of providing XML if you are comfortable with Liverpie doing the translation.
Find Liverpie here: www.liverpie.com
Telnet Client
telnet to port 8021 and enter "auth ClueCon" as password to authenticate. From here you can send any of the commands listed in this document. Note that you need to provide a double empty line after the command so it processed.
Ruby Libraries
Python Libraries
- A Twisted based client and example can be found in the the scripts/python/freepy directory of the FreeSWITCH source code
- eventsocket: an alternative twisted protocol which supports inbound and outbound methods + examples
- PySWITCH: one more library for Python and Twisted programmers. It has extensive support for FreeSWITCH API, bgapi and Dialplan Tools.
- greenswitch: This is an implementation of Event Socket Protocol using gevent greenlets. It is already in production and processing hundreds of calls per day.
- switchio: asyncio powered cluster control which leverages modern Python's new native coroutines. Comes with a full-blown auto-dialer originally built for stress testing.
PHP Client
Website based PHP example PHP Event Socket
Another example in PHP : freeswitcheventsocketlistener
Java Client Libraries
Java_ESL describes several options for using Java to communicate with the ESL.
Javascript / Node.js library
- Node-esl module available on GitHub and on npm. Provides support for both Inbound and Outbound connections, a Server helper for multiple Outbound connections, and implements the Event Socket Library interface. Examples can be found in the examples directory of the source.
- Node.js esl module (available using npm) offers both a client and a server implementation. The code is on github with documentation. Examples: Voicemail with CouchDB storage and CNAM injection (short example showing how to set a variable using an async web query).
- Node.js ESClient
- Example of an IVR using outbound ESL: http://freeswitch-users.2379917.n2.nabble.com/Javascript-Outbound-Event-Socket-Linger-Command-td7530943.html
.NET Client library
Support is included in tree for building under Windows. See libs/esl/managed managed_esl.201x.
There is a sample application included named ManagedEslTest. This will demonstrate how the start a simple inbound example as provided but also shows the other modes as well.
The managed portions are platform neutral but the esl swig wrapper (the ESL project in the managed solution) is platform dependent and must be built for the intended platform. You must also have previously built the main FreeSWITCH project as the native esl library is included from there otherwise you will receive a esl.lib not found error.
[1] AgbaraVOIP .NET Client
Go Client library (golang)
These Go libraries support both inbound and outbound event socket connections.