What is the difference between built-in (or embedded) languages in FreeSWITCH and scripts using the Event Socket Library (ESL)? - freeswitch

Many languages are embedded into FreeSWITCH (such as JavaScript, see the docs), made possible by SWIG "to make the core FreeSWITCH library accessible to scripting".
Languages can also use the Event Socket Library for the same purpose, so what is the difference?

As the FreeSWITCH 1.2 book points out, they are indeed not the same:
ESL scripts versus built-in languages
Keep in mind that ESL-based programs are not the same as using
built-in languages. The FreeSWITCH event socket is a TCP-based
connection to FreeSWITCH. The ESL is an abstraction library that is
available for more languages than just the few that are built-in to
FreeSWITCH. You must first install the Lua, Perl, Python, or PHP for
your system before using ESL.
Built-in languages ship with a FreeSWITCH installation by default, and they can be used to write scripts to control (and configure1) a FreeSWITCH instance instead of editing the XML files to achieve the same. These scripts can only be called either from a dialplan action or form the console as an API call (e.g., look for luarun or jsrun).
Scripts using the Event Socket Library (ESL) can be run from anywhere achieving the same results as built-in languages, but first they establish a network connection to the FreeSWITCH instance to be able to send API calls.
1 See Serving Configuration with mod_lua and Serving Configuration with JavaScript documentation pages.

Related

Exporting data from Ada application with websocket

I'm developing a scholar project where I have a core written in Ada language that generates data information.
As requested by the project, I need to send all the new produced information, with a certain period, to a remote webserver via websocket.
In javascript language is really easy to connect to a web socket:
var exampleSocket = new WebSocket("ws://www.example.com/socketserver", "protocolOne");
I would be able to execute a similar command in Ada, is it possible?
May be possible to workaround the problem calling an html page (with GET parameters) containing javascript code so that this page manages the websocket with remote webserver?
For those still looking for this answer; AWS now supports websockets...
https://docs.adacore.com/aws-docs/aws/high_level_services.html#websockets
Both AWS and Black has supports websockets. AWS is the most mature of the two, so I suggest that you use that.

Are there any good instant message APIs for the Mac?

Just curious, if you were to build an instant message client for the Mac what existing API or service would you use to handle the transfer of messages from one user to another? I am looking for something that can be used in conjunction with objective-c and is compatible with other popular messaging services such as MSN, Yahoo, Aim, gtalk, etc. I don't want to host the service, but rather connect to existing services and use their "pipes".
Thanks
There are many Instant messenger protocols out there.
There is a good bet you could find a Java API for which protocol you would like to use like the XMPP Java API.
Or
for C or C++ you could use the libpurple library.
Your question lacks a lot of informations, so it's rather hard to answer. Please add some details on your requirements. What protocols do you need, what functionality, what development language do you use?
As a start:
Adium has been released under the GPL, thus you can use the code in your own projects as long as the license fits your needs.
http://trac.adium.im/
Another option, if you don't want to implement multiple networks but prefer to use a single protocol where the server provides gateways to other networks you can also check out Jabber/XMPP libraries that are available for the mac.
http://www.google.de/search?q=jabber+library+mac&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:de:official&client=firefox-a

Can XMPP be used like Comet's http long wait?

Can XMPP be applied in a similar way to the reverse Ajax pattern? Can it be used to implement http long wait like Comet? Is there an example of using such a technique with XMPP?
Yes. Take a look at XMPP over BOSH. It's a long-lived non-polling technique. From the BOSH specification:
This specification defines a transport protocol that emulates the semantics of a long-lived, bidirectional TCP connection between two entities (such as a client and a server) by efficiently using multiple synchronous HTTP request/response pairs without requiring the use of frequent polling or chunked responses.
jbosh is an open source Java implementation. Tigase.org has a number of projects, including BOSH support, and appears to be mostly Java/GWT. JAXMPP is a Java library in the framework, although it's not clear what feature set it supports. I've not tried any of these myself.
Like Ire told you can use bosh for that. On the client-side(javascript) you could use strophe.js.
Prosody is an easy to install XMPP-server which supports BOSH.
To learn how to create programs using strophe.js you could read Professional XMPP programming with javascript and Jquery

How can Windows API calls to an application/service be monitored?

My company is looking at implementing a new VPN solution, but require that the connection be maintained programatically by our software. The VPN solution consists of a background service that seems to manage the physical connection and a command line/GUI utilty that initiates the request to connect/disconnect. I am looking for a way to "spy" on the API calls between the front-end utilty and back-end service so that our software can make the same calls to the service. Are there any recommended software solutions or methods to do this?
Typically, communications between a front-end application and back-end service are done through some form of IPC (sockets, named pipes, etc.) or through custom messages sent through the Service Control Manager. You'll probably need to find out which method this solution uses, and work from there - though if it's encrypted communication over a socket, this could be difficult.
Like Harper Shelby said, it could be very difficult, but you may start with filemon, which can tell you when certain processes create or write to files, regmon, which can do the same for registry writes and reads, and wireshark to monitor the network traffic. This can get you some data, but even with the data, it may be too difficult to interpret in a manner that would allow you to make the same calls.
I don't understand why you want to replace the utility, instead of simply running the utility from your application.
Anyway, you can run "dumpbin /imports whatevertheutilitynameis.exe" to see the static list of API function names to which the utility is linked; this doesn't show the sequence in which they're called, nor the parameter values.
You can then use a system debugger (e.g. Winice or whatever its more modern equivalent might be) to set breakpoints on these API, so that you break into the debugger (and can then inspect parameter values) when the utility invokes these APIs.
You might be able to glean some information using tools such as Spy++ to look at Windows messages. Debugging/tracing tools (Windbg, or etc.) may allow you to see API calls that are in process. The Sysinternals tools can show you system information to some degree of detail of usage.
Although I would recommend against this for the most part -- is it possible to contact the solution provider and get documentation? One reason for that is fragility -- if a vendor is not expecting users to utilize that aspect of the interface, they are more likely to change it without notice.

Firefox plugin - sockets

I've always wanted a way to make a socket connection to a server and allow the server to manipulate the page DOM. For example, this could be used in a stock quotes page, so the server can push new quotes as they become available.
I know this is a classic limitation (feature?) of HTTP's request/response protocol, but I think this could be implemented as a Firefox plugin (cross-browser compatibility is not important for my application). Java/Flash solutions are not acceptable, because (as far as i know) they live in a box and can't interact with the DOM.
Can anyone confirm whether this is within the ability of a Firefox plugin? Has someone already created this or something similar?
You may want to look at Comet which is a fancy name for a long running HTTP connection where the server can push updates to the page.
It should be possible. I have developed a xulrunner application that connects to a TCP server using sockets. Extension development would likely have the same capabilities. I used a library from mozdev - JSLib. Specifically check out the networking code. The fact that there is a Firefox add-on for JSlib add-on for Firefox makes more more confident.
Essentially, as I understand it, sockets are not part of JavaScript, but through XPCOM, you can get raw socket access like you would in any c/c++ application.
Warning: JSLib doesn't seem to receive a lot of attention and the mailing list is pretty sparse.
Java/Flash solutions are not acceptable, because (as far as i know)
they live in a box and can't interact with the DOM.
That's not actually true of Java. You can interact with Java via JavaScript and make DOM changes.
http://stephengware.com/proj/javasocketbridge/
In this example there are two JavaScript methods for interaction
Send:
socket_send("This was sent via the socket\n\n");
Receive:
on_socket_get(message){ more_code(message); }
You may want to look at Comet
a.k.a. server push. This does not let the server "update" the client page directly, but all the new data is sent to the page through a single connection.
Of course, a Firefox extension (as well as plugins, which are binary libraries that can do whatever any other application can do) can work with sockets too. See 1, 2.

Resources