Jump to content
  • IsExternalRedirectionConfigured

    IsExternalRedirectionConfigured

    VBScript   → Lua

     

    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"
    
        Dim bReturn
        bReturn = False
    
        Dim sPublicLineAccess
        sPublicLineAccess = g_PBXConfig.PublicAccessPrefix()
        PBXScript.OutputTrace "Configured public line access: " & sPublicLineAccess
    
        ' check forwarding
        If PBXUser.UnconditionalRedirect Then
    
            PBXScript.OutputTrace "Unconditional call forwarding configured to " & PBXUser.UnconditionalRedirectNumber
    
            If Left(PBXUser.UnconditionalRedirectNumber, Len(sPublicLineAccess)) = sPublicLineAccess Then
                PBXScript.OutputTrace "External call forwarding configured"
                bReturn = True
            Else
                PBXScript.OutputTrace "Internal call forwarding configured"
            End If
    
        Else
            PBXScript.OutputTrace "No unconditional call forwarding configured"
        End If
    
        IsExternalRedirectionConfigured = bReturn
    
        PBXScript.OutputTrace "bReturn: " & bReturn
        PBXScript.OutputTrace "<------------- IsExternalRedirectionConfigured"
    End Function

     

    This function makes use of the Server Script API function PBXConfig.PublicAccessPrefix 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.

     

    This function was initially posted into this forum topic.

     

     




    User Feedback

    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 account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
×
×
  • 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.