Tom Wellige Posted September 3, 2019 #1 Share Posted September 3, 2019 This post is taken from the Swyx Forum Archive (2007-2014) and was originally posted 30.06.2009 by me The following function returns True if the given user/agent is free, i.e. is logged in and not busy and no "away" or "do not disturb" status is set. It makes use of the PBXConfig object which is fully described in the following Swyx knowledgebase article: Request configuration and user data (incl. user status) within an Extended Call Routing script (kb2910) Please note that it is not necessary to instantiate the PBXConfig object yourself, as it is already available in the global variable g_PBXConfig. To use the function within your call routing script just copy&paste it into the "Start" block and call it afterwards within an "Evaluate" block. Please also note that in a previous version of this post the function was named IsAgentFree. '---------------------------------------------------------------- ' IsUserFree ' ' Checks if given user is free or not. ' ' Parameter: ' sNumber extension ' ' Return: ' boolean '---------------------------------------------------------------- Function IsUserFree( sNumber ) PBXScript.OutputTrace "-------------> IsUserFree ( sNumber = " & sNumber & " )" Dim bReturn bReturn = False 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 ' does the server recognize this user a free ? bReturn = (User.State = 2) Next IsUserFree = bReturn PBXScript.OutputTrace "bReturn = " & bReturn PBXScript.OutputTrace "<------------- IsUserFree" End Function 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.