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

  • IsExternalRedirectionConfigured()

    IsExternalRedirectionConfigured()

    Lua   → VBScript

     

    This function returns true if the current script user has an unconditional redirection to an external destination enabled.

    Please see the Introduction chapter for some usage instructions.

     

    ------------------------------------------------------------------
    -- IsExternalRedirectionConfigured
    --
    -- Checks if there is an unconditional call forwarding configured to an
    -- external number. The function checks if the configured unconditional
    -- call forwarding starts with the configured public line access.
    --
    -- Parameter:
    --
    -- Return:
    --   boolean         true  - external redirection configured
    --                   false - no external redirection configured
    ------------------------------------------------------------------
    function IsExternalRedirectionConfigured()
        PBXScript.OutputTrace "-------------> IsExternalRedirectionConfigured"
    
        local bReturn = false
        local tConfig = nil
        local sPublicLineAccess = ""
    
        tConfig = PBXScript.GetPBXConfig()
        sPublicLineAccess = tConfig.publicaccessprefix
        PBXScript.OutputTrace ("Configured public line access: " .. sPublicLineAccess)
    
        -- check forwarding
        if (PBXUser.UnconditionalRedirect()) then
    
            PBXScript.OutputTrace ("Unconditional call forwarding configured to " .. PBXUser.UnconditionalRedirectNumber())
    
            if (StringLeft(PBXUser.UnconditionalRedirectNumber(), StringLen(sPublicLineAccess)) == sPublicLineAccess) then
                PBXScript.OutputTrace ("External call forwarding configured")
                bReturn = true
            else
                PBXScript.OutputTrace ("Internal call forwarding configured")
            end
    
        else
            PBXScript.OutputTrace ("No unconditional call forwarding configured")
        end
    
        PBXScript.OutputTrace ("bReturn: " .. tostring(bReturn))
        PBXScript.OutputTrace ("<------------- IsExternalRedirectionConfigured")
    
        return bReturn
    end

     

    This function makes use of the Server Script API function PBXScript.GetPBXConfig() to get the configured public line access. Afterwards it uses PBXUser.UnconditionalRedirect() and PBXUser.UnconditionalRedirectNumber() to check if a redirection is enabled and configured to a number starting with the public line access. It also uses PBXScript.OutputTrace() to write trace information into the SwyxServer trace file. It also uses the GSE build-in helper functios StringLeft() and StringLen().

     

    This function was converted from VBScript into Lua from the initially posted version in this forum topic.

     

     


    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.