Jump to content
Tom Wellige

Function: IsRedirectedFromByName

Recommended Posts

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


This function returns True was redirected/transferred by a certain user which is identified by his name.

It makes use of the PBXScript.PreviousScripts collection to search the given user name in it. If it is found in there, the call has been at that user (i.e. that users call routing) before it ended up in this call routing.

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.


' IsRedirectedFromByName
' Checks if current call is redirected from a given user.
' Parameter:
'	sUserName		name of user to check if call is redirected from
' Return:
'	boolean
Function IsRedirectedFromByName(ByVal sUserName)
	PBXScript.OutputTrace "----------> IsRedirectedFromByName ( sUserName = " & sUserName & " )"

	Dim bReturn
	bReturn = False

	Dim PrevScripts
	Set PrevScripts = PBXScript.PreviousScripts

	Dim PrevScript
	For Each PrevScript In PrevScripts

		PBXScript.OutputTrace "PrevScript.UserName = " & PrevScript.UserName

		If PrevScript.UserName = sUserName Then
			PBXScript.OutputTrace "this is a redirected call from " & sUserName
			bReturn = True
		End If


	IsRedirectedFromByName = bReturn

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


A usage of this function could be the following:


Boss redirects all his calls to his secretary. The secretary redirects all her calls to the operator because she has to leave the office. So, when calling the boss directly one would end up at the operator.

For the operator it would be useful to know if this is such a "boss" call. So, all you have to do is to call this function with the name of the boss user and afterwards e.g. manipulate the text being shown in the SwyxIt! display


If IsRedirectedFromByName("Mr. Boss") Then

	PBXCall.CallingPartyName = "BOSS - " & PBXCall.CallingPartyName

End If



Another usage of this function can be found in the function IsRedirectedFromByNumber.


Share this post

Link to post
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.