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

Function: IsUserLoggedOff

Tom Wellige

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 off from 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 IsAgentLoggedOff.


' IsUserLoggedOff
' Checks if given user is logged off
' Parameter:
'	sNumber			user name or extension
' Return:
'	boolean
Function IsUserLoggedOff( sNumber )
	PBXScript.OutputTrace "-------------> IsUserLoggedOff ( 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 off, meaning his state is 1
		bReturn = (User.State = 1)


	IsUserLoggedOff = bReturn

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


Link to comment
Share on other sites

  • 2 months later...

Hallo Tom

Ich versuche seit Stunden diese Skript einzubauen. Mein Callrouting stürzt an dieser Stelle jedoch immer ab.

Im Trace IpPbxSrv erhalte ich folgende Rückmeldung:

19 16:49:07.527 0015e8 Info SrvScript  0656F218 000003c4 SPBXScript::OutputTrace                 () IsAgentLoggedOff ( 9200 )
19 16:49:07.527 0015e8 Info SrvScript  0656F218 000003c4 SPBXScript::OutputTrace                 () -------------> IsAgentLoggedOff ( sNumber = 9200 )
19 16:49:07.528 0015e8 *Err SrvScrAPI  0195F2B8 000003c4 SPBXScriptSite::OnScriptError           ()
~Code:   0
~Src:    Laufzeitfehler in Microsoft VBScript
~Desc:   Falsche Anzahl an Argumenten oder ungültige Eigenschaftszuweisung
~RetVal: 800a01c2
~Line:   16051 
~Column: 1
~Source code:
~Function rulePlanteamZustellungTeams(ByRef rInputParams)
~ ^ error position
19 16:49:07.529 0015e8 Inf3 SrvPBXCtl  07AA3940 000003c4 SPBXCallHub::SetDisconnectReason        (CallRoutingFailed, ext cause 0, U:0, T:0, '','',Unknown) stored
19 16:49:07.529 0015e8 Info SrvPBXCtl  07AA3940 000003c4 SScrServer::OnScriptFinished            ()
19 16:49:07.529 0015e8 Inf2 SrvPBXCtl  07AA3940 000003c4 SScrServer::EventScriptFinished         ()
19 16:49:07.530 0008e4 Inf2 SrvPBXCtl  06CB7D88 000003c4 SScriptFsm::ActionOnScriptFinished      ()


Was mache ich falsch?

Vielen Dank für deine Antwort.

Link to comment
Share on other sites



da hat ein Fehler überlebt. Beim Copy&Paste aus dem alten Forum ist an vielen Stellen ein Befehl verschluckt worden. Ich dachte, alle Stellen an denen das passiert ist, hätte ich mittlerweile korrigiert.


Sorry! Ich habe den Code oben korrigiert. Einfach nochmal per Copy&Paste in den Start Block kopieren, dann gehts.


Zur Erklärung: in der folgenden Zeile hat das "Set" an Anfang gefehlt:


Set Users = g_PBXConfig.GetUserByAddress(sNumber)


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.

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.


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