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

By Tom Wellige
Recommended Comments
There are no comments to display.