Lua → VBScript
This function calls (launches) a given command, i.e. launches any given application.
Please see the Introduction chapter for some usage instructions.
Please note: the Lua Beta Testing versions of SwyxWare (13.1x) do not limit any file/command access. In the final release version file/command access will only be permitted in the SwyxWare CPE (customer premise equipment) version. Within the cloud versions (SDC and SwyxON) file/command access will not be permitted.
------------------------------------------------------------------ -- LaunchCmd -- -- Calls/launches the given command -- -- Parameter: -- sCommand command to be called -- -- Return: -- boolean true, false or nil -- string output of command ------------------------------------------------------------------ function LaunchCmd ( sCommand ) PBXScript.OutputTrace ("------> LaunchCmd ( " .. sCommand .. " )") local bReturn = false local sReturn = "" local file = io.popen(sCommand) if file ~= nil then sReturn = file:read('*all') local tReturn = {file:close()} bReturn = tReturn[1] end PBXScript.OutputTrace ("bReturn = " .. tostring(bReturn)) PBXScript.OutputTrace ("sReturn = " .. sReturn) PBXScript.OutputTrace ("<------ LaunchCmd") return bReturn, sReturn end
Please note that this command will be launched on the SwyxServer machine. No windows will be opened, and no user input can be made. So only start command line applications which do not require any user input.
As the call routing is executed by the Swyx Server service, the command will also be executed by the Swyx Server service. That means, it is executed by the Windows user, the Swyx Server service is running under (usually this is the local SwyxServiceAccount user).
If your command contains back slashes, you need to exscape them. So instead of "DIR C:\Announcements\*.WAV" you need to pass "DIR C:\\Announcements\\*.WAV".
This function makes use of the Server Script API function PBXScript.OutputTrace() to write trace information into the SwyxServer trace file.
By Tom Wellige
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now