Jump to content
Gold Sponsor: Data-Way IT-Consulting, Austria

  • LaunchCmd()

    LaunchCmd()

    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.

     

     


    Tom Wellige
     Share


     Share




    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    Add a comment...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.