Script socket.lua
Socket listener.
This is a socket listener for running Jester sequences via the FreeSWITCH event system. It is experimental, use at your own risk.
To start listener, set it as a startup script in conf/autoload_configs/lua.conf.xml:
<param name="startup-script" value="jester/socket.lua [server] [port] [password]" />
Or via luarun:
luarun jester/socket.lua [server] [port] [password]
It listens for CUSTOM events of subclass 'jester::socket'.
Firing an event for the listener looks something like this:
sendevent CUSTOM
Event-Subclass: jester::socket
Jester-Profile: socket
Jester-Sequence: mysequence
Jester-Sequence-Args: arg1,arg2
Params for the event are as follows:
Jester-Sequence:
Required. The name of the sequence to run.
Jester-Profile:
Optional. The profile to run the sequence under. Defaults to 'socket'.
Jester-Sequence-Args:
Optional. Arguments to pass to the sequence, in the same form that normal
sequence arguments are passed.
To exit the listener, you can send this event:
sendevent CUSTOM
Event-Subclass: jester::socket
Jester-Socket-Exit: yes
WARNING: there is no session object available with this approach, so be careful not to use actions that need a session (play, record, get_digits, etc.) or the listener will crash! The sequences should be more along the lines of performing database/file manipulation, logging to file, etc.
Info:
- Copyright: 2011-2015 Chad Phillips
- Author: Chad Phillips