Jump to content
  • UserStatus

    UserStatus

    VBScript   → Lua

     

    This function returns the current status of the given user.

    Please see the Introduction chapter for some usage instructions.

     

    '----------------------------------------------------------------
    ' UserStatus
    '
    ' Returns the current status of the given user.
    '
    ' Parameter
    '    sNumber        user name or extension
    '
    ' Return
    '     integer       0 - State Unavailable (no status signalling configured!)
    '                   1 - Logged Off
    '                   2 - Logged On (no speaking)
    '                   3 - Speaking External
    '                   4 - Alerting
    '                   5 - Speaking Internal
    '                   6 - Away (since SwyxWare 2011)
    '                   7 - Do not Disturb (since SwyxWare 2011)
    '                   8 - Busy Indication from external presence source (e.g. MS Teams) (since SwyxWare 13)
    '----------------------------------------------------------------
    Function UserStatus(ByVal sNumber)
     
        PBXScript.OutputTrace("-------------> UserStatus ( sNumber = " & sNumber & " )")
     
        Dim nReturn
        nReturn = 0
     
        Dim Users
        Set Users = g_PBXConfig.GetUserByAddress(sNumber)
     
        Dim User
        For Each User In Users
     
            PBXScript.OutputTrace("Found user " & User.Name & " with current state " & User.State)
            nReturn = User.State
     
        Next
     
        UserStatus = nReturn
     
        PBXScript.OutputTrace("nReturn = " & nReturn)
        PBXScript.OutputTrace("<------------- UserStatus")
     
    End Function

     

    This function makes use of the Server Script API functions PBXConfig.GetUserByAddress to resolve the user state and PBXScript.OutputTrace to write trace information into the SwyxServer trace file.

     

    You can use the Insert Script Code block to route all return values on different exits of this block in order to evaluate the user status graphically.

     

    image.png

     

     

    image.png

     

    image.png

     

     

     

    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.