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

     

    Please note that the status signalling between all involved users (incl. the one the current call routing runs for) must be configured (just as in SwyxIt!).

     

    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.



    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.