Jump to content
  • IsRedirectedFromByName

    IsRedirectedFromByName

    VBScript   → Lua   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(ByVal sUserName)
        PBXScript.OutputTrace "----------> IsRedirectedFromByName ( sUserName = " & sUserName & " )"
    
        Dim bReturn
        bReturn = False
    
        Dim PrevScripts
        Set PrevScripts = PBXScript.PreviousScripts
    
        Dim PrevScript
        For Each PrevScript In PrevScripts
    
            PBXScript.OutputTrace "PrevScript.UserName = " & PrevScript.UserName
    
            If PrevScript.UserName = sUserName Then
                PBXScript.OutputTrace "this is a redirected call from " & sUserName
                bReturn = True
            End If
    
        Next
    
        IsRedirectedFromByName = bReturn
    
        PBXScript.OutputTrace "bReturn = " & bReturn
        PBXScript.OutputTrace "<--------- IsRedirectedFromByName"
    End Function

     

    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 collection 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 If

     

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

     

     

    This function was initially posted into 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.