VBScript Example - Request the status of any user
With the following VBScript function, which originates on the public Swyx Forum (www.swyxforum.com), it is possible to request the current status of any user or group from within the call routing.
The original post with all related discussions can be found here.
'---------------------------------------------------------------- ' 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 (from SwyxWare 2011 on) ' 7 - Do not Disturb (from SwyxWare 2011 on) '---------------------------------------------------------------- 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
In order to use his function you need to do the following:
- Copy & paste the code into the Start block of your call routing script
- Make sure to have mutual status signalling configured between the call routing script user and the user you request the status from
- To call the UserStatus function you can use for example the Insert Script Code block
- To do so add the following code to its Parameters page
UseExit = UserStatus (100)
- Now you need to switch to the Links page and configure the exits. Enable the exits and configure their names.
- With having done this you have a block returning the status of the user with the extension 100 on it's exits:
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
0 Kommentare