VBScript → Lua
This function returns the number of currently logged in users (regardless if free or busy) into a given group.
Please see the Introduction chapter for some usage instructions.
'------------------------------------------------------------------- ' NumberOfLoggedInUsersInGroup ' ' Returns the number of users which are currently logged in into the given group. ' The users need to have a higher status as "1", i.e. being logged in (regardless if free or busy). ' ' Parameter: ' sGroup name or number of group ' ' return value: ' integer number of logged in users '-------------------------------------------------------------------- Function NumberOfLoggedInUsersInGroup ( sGroup ) PBXScript.OutputTrace("-------------> NumberOfLoggedInUsersInGroup ( sGroup = " & sGroup & " )") Dim nReturn nReturn = 0 Dim Users Set Users = g_PBXConfig.GetUserByAddress(sGroup) Dim User For Each User In Users PBXScript.OutputTrace("Found user " & User.Name & " with current state " & User.State) If User.State > 1 Then nReturn = nReturn + 1 Next NumberOfLoggedInUsersInGroup = nReturn PBXScript.OutputTrace("nReturn = " & nReturn) PBXScript.OutputTrace("<------------- NumberOfLoggedInUsersInGroup") 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 all users in the given group to get their status and PBXScript.OutputTrace to write trace information into the SwyxServer trace file.
This function is also featured in this blog article.
By Tom Wellige
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 accountSign in
Already have an account? Sign in here.
Sign In Now