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

  • IsRedirectedFromByNumber

    IsRedirectedFromByNumber

    VBScript   → Lua

     

    This function returns True if the call was redirected/transferred by a certain user (extension) or list of extensions, separated by ; (semikolon).

    Please see the Introduction chapter for some usage instructions.

     

    '----------------------------------------------------------------
    ' IsRedirectedFromByNumber
    '
    ' Returns true if the current call is redirected by any of the numbers
    ' given in the semicolon separated list. It also returns the number that
    ' redirected the call.
    '
    ' Parameter:
    '   sNumbers    [in]    semicolon separated list of all numbers
    '   sNumber     [out]   empty if call wasn't redirected by anyone from the list, 
    '                       otherwise the extension that redirected the call.
    '
    ' Return:
    '   boolean
    '----------------------------------------------------------------
    Function IsRedirectedFromByNumber( ByVal sNumbers, ByRef sNumber )
        PBXScript.OutputTrace "------> IsRedirectedFromByNumber ( '" & sNumbers & "' )"
    
        Dim bReturn
        bReturn = False
        sNumber = ""
    
        Dim i, aNumbers, sName
    
        aNumbers = Split(sNumbers, ";")
    
        For i = LBound(aNumbers) To UBound(aNumbers)
    
            PBXScript.OutputTrace "Checking extension: " & aNumbers(i)
            sName = GetUserNameFromExtension(aNumbers(i))
            PBXScript.OutputTrace "Found username: " & sName
    
            If sName <> "" Then
                If IsRedirectedFromByName(sName) Then
                    PBXScript.OutputTrace "Call is redirected from this user"
                    bReturn = True
                    sNumber = aNumbers(i)
                Else
                    PBXScript.OutputTrace "Call is not redirected from this user"
                End If
            End If
    
        Next
    
        IsRedirectedFromByNumber = bReturn
    
        PBXScript.OutputTrace "bReturn = " & bReturn
        PBXScript.OutputTrace "<------ IsRedirectedFromByNumber ( Return '" & bReturn & "' )"
    End Function

     

    This function makes use of the function GetUserNameFromExtension to get the username for a given extension, and also the function IsRedirectedFromByName to then check if the call is redirected/transferred from that user. It makes also use of the Server Script API function PBXScript.OutputTrace to write trace information into the SwyxServer trace file.
     

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