Jump to content
  • IsRedirectedFromByName()

    IsRedirectedFromByName()

    Lua   → VBScript   SwyxWare 13.26

     

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

    Please see the Introduction chapter for some usage instructions.

     

    ------------------------------------------------------------------
    -- IsRedirectedFromByName
    --
    -- Checks if current call is redirected by a given user.
    --
    -- Parameter:
    --   sUserName       name of user to check if call is redirected from
    --
    -- Return:
    --   boolean         true  - call was redirected by given user 
    --                   false - call was not redirected by the given user
    ------------------------------------------------------------------
    function IsRedirectedFromByName (sUserName)
        PBXScript.OutputTrace ("----------> IsRedirectedFromByName ( sUserName = " .. sUserName .. " )")
    
        local bReturn = false
        local tScripts  = nil
    
        tScripts = PBXScript.PreviousScripts()
        if (tScripts ~= nil) then
            for i = 1, #tScripts do
    
                PBXScript.OutputTrace ("PreviousScript.username = " .. tScripts[i].username)
    
                if (tScripts[i].username == sUserName) then
                    PBXScript.OutputTrace ("This is a redirected call from " .. sUserName)
                    bReturn = true
                end
                
            end
        end
    
        PBXScript.OutputTrace ("bReturn = " .. tostring(bReturn))
        PBXScript.OutputTrace ("<--------- IsRedirectedFromByName")
    
        return bReturn
    end

     

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

     

     

    Please note: this function makes use of obsolete functionality in the PBXScript.PreviousScripts() table which was replaced in SwyxWare v13.27 to identify users and groups, instead of users only. There is an updated version of this function available, IsRedirectedFromByNameEx, which makes use of the new functionality.

     

     

    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 IsRedirectedFromByName("Mr. Boss") then
        PBXCall.CallingPartyName ("BOSS - " & PBXCall.CallingPartyName())
    end

     

    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
     Share


     Share




    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.