A handy trick to allow mod_event_socket commands to be treated like they are being run from the FreeSWITCH console.
The console includes some features that are not active when a command is sent over the Event Socket. A good example is the syntax for sending multiple commands in sequence:
However, this same command syntax will not work when sent via the Event Socket:
To force the command to be run as it would in the console, enable console_execute functionality as part of the command sent over the socket, like so:
In fact, this is exactly what the fs_cli executable does behind the scenes when it sends commands to FreeSWITCH!
- It must be enabled per command sent to the socket
- It incurs extra overhead to run. This is probably not a problem unless you're sending a high volume of commands using this strategy, and, it's not advised to use it unless you actually need it.
- And a brief note on the particular approach of sending multiple commands in one execution: they will run synchronously, and in the order provided, and subsequent commands will run even if previous commands failed (unlike, for example 'test -f blah && rm blah' in a Bash shell, which would not run the second command if the first returned a non-zero exit status).