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

  • IsRedirectedFromByName()

    IsRedirectedFromByName()

    Lua   → VBScript

     

    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.

     

     

    A usage 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.



    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.