Jump to content
  • IsRedirectedFromByNameEx()


    Lua   → VBScript   SwxWare v13.27


    This function checks if the current call was redirected by a given user or group.

    Please see the Introduction chapter for some usage instructions.


    -- IsRedirectedFromByNameEx
    -- Checks if current call is redirected by a given user or group.
    -- The user or group is identified by its name.
    -- Parameter:
    --   sName           name of user or group to check if call is redirected from
    -- Return:
    --   boolean         true  - call was redirected by given user or group
    --                   false - call was not redirected by the given user or group
    function IsRedirectedFromByNameEx (sName)
        PBXScript.OutputTrace ("----------> IsRedirectedFromByNameEx ( " .. sName .. " )")
        local bReturn  = false
        local tScripts = nil
        tScripts = PBXScript.PreviousScripts()
        if (tScripts ~= nil) then
            for i = 1, #tScripts do
                if (tScripts[i].entitytype == PBXScriptTypeUser) then
                    PBXScript.OutputTrace ("found user " .. tScripts[i].entityname)
                    PBXScript.OutputTrace ("found group " .. tScripts[i].entityname)
                if (tScripts[i].entityname == sName) then
                    PBXScript.OutputTrace ("this is a redirected call from " .. sName)
                    bReturn = true
        PBXScript.OutputTrace ("bReturn = " .. tostring(bReturn))
        PBXScript.OutputTrace ("<--------- IsRedirectedFromByNameEx")
        return bReturn


    This function makes use of the Server script API function PBXScript.PreviousScripts() to check if the call has been transferred by the given user or group (defined by its name) and PBXScript.OutputTrace() to write trace information into the SwyxServer trace file.



    Please note: this function makes use of newly introduced functionalitly in SwyxWare v13.27 within the PBXScript.PreviousScripts() table. It is therefore able to check for users and groups the call have been before reaching the current script.

    There is a previous version of this function available, IsRedirectedFromByName, which can check for users only.



    A usage example of this function could be the following:


    Boss redirects all his calls to his secretary. The secretary redirects all her calls to the operator because she has to leave the office. So, when calling the boss directly one would end up at the operator.


    For the operator it would be useful to know if this is such a "boss" call. So, all you have to do is to call this function with the name of the boss user and afterwards e.g. manipulate the text being shown in the SwyxIt! display.


    if IsRedirectedFromByNameEx("Mr. Boss") then
        PBXCall.CallingPartyName ("BOSS - " & PBXCall.CallingPartyName())


    Another usage of this function can be found in the function IsRedirectedFromByNumber().



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


    Tom Wellige


    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.