Jump to content
Gold Sponsor: Data-Way IT-Consulting, Austria

Function: IsUserLoggedOn


Tom Wellige
 Share


Recommended Posts

This post is taken from the Swyx Forum Archive (2007-2014) and was originally posted 05.09.2011 by me

 

This function returns True of the given user is logged on on the server.

 

It makes use of the PBXConfig object which is fully described in the following Swyx knowledgebase article:

 

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

 

'----------------------------------------------------------------
' IsUserLoggedOn
'
' Checks if given user is logged on
'
' Parameter:
'	sNumber			user name or extension
'
' Return:
'	boolean
'----------------------------------------------------------------
Function IsUserLoggedOn( sNumber )
	PBXScript.OutputTrace "-------------> IsUserLoggedOn ( 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

		' is the user logged on, meaning his state is >= 2 ?
		bReturn = (User.State >= 2)

	Next

	IsUserLoggedOn = bReturn

	PBXScript.OutputTrace "bReturn = " &bReturn
	PBXScript.OutputTrace "<------------- IsUserLoggedOn"
    
End Function

 

Link to comment
Share on other sites


Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
×
  • Create New...

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.