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

Function: IsRedirectionLoopConfigured

Tom Wellige

Recommended Posts

The following function returns True if the current script user has an unconditional redirection to a user configured, where the current call already has been (in his call routing).

There is another function IsLoopConfigured available, following another approach to identify an existing call loop.

Please take a look into the How to avoid loops topic for more details.

To use the function within your call routing script just copy&paste it, as also the used GetUserNameFromExtension function, into the "Start" block and call it afterwards within an "Evaluate" block.


' IsRedirectionLoopConfigured 
' Checks if the undonditional redirection target of the script user is
' already in the PreviousScripts list, i.e. the call was previously already in that user's call routing.
' Parameter:
' Return:
'	boolean 
Function IsRedirectionLoopConfigured
	PBXScript.OutputTrace "-------------> IsRedirectionLoopConfigured"

	Dim bReturn
	bReturn = False

	If PBXUser.UnconditionalRedirect Then

		Dim sRedirectToUser
		sRedirectToUser = GetUserNameFromExtension(PBXUser.UnconditionalRedirectNumber)

		Dim Script
		For Each Script In PBXScript.PreviousScripts

			PBXScript.OutputTrace "Found user " & User.Name

			If sRedirectToUser = Script.UserName Then 
				PBXScript.OutputTrace "Found redirection target in the PreviousScripts list. So this is most likely a loop!"
				bReturn = True
			End If


	End If

	IsRedirectionLoopConfigured = bReturn

	PBXScript.OutputTrace "bReturn = " & bReturn
	PBXScript.OutputTrace "<------------- IsRedirectionLoopConfigured"
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.

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.