Jump to content

- Functions

- # UserStatus

  Followers 0

  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.

  This function was initially posted into this forum topic.

  By Tom Wellige

  - June 5, 2022
  Share
  Share
  Followers 0
  Previous Page SetNewVoicemailFlag

## 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.