Jump to content
Tom Wellige

Function: IsRedirectedFromByNumber

Recommended Posts

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


This function returns True was redirected/transferred by a certain user (extension) or list of extensions,separated by ; (semikolon).

It makes use of the function GetUserNameFromExtension to get the username for a given extension, and also the function IsRedirectedFromByName to then check if the call is redirected/transferred from that user.

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.


' IsRedirectedFromByNumber
' Returns true if the current call is redirected by any of the numbers
' given in the semicolon separated list. It also returns the number that
' redirected the call.
' Parameter:
'	sNumbers	[in]	semicolon separated list of all numbers
'	sNumber		[out]	empty if call wasn't redirected by anyone from the list, 
'						otherwise the extension that redirected the call.
' Return:
'	boolean
Function IsRedirectedFromByNumber( ByVal sNumbers, ByRef sNumber )
	PBXScript.OutputTrace "------> IsRedirectedFromByNumber ( '" & sNumbers & "' )"

	Dim bReturn
	bReturn = False
	sNumber = ""

	Dim i, aNumbers, sName

	aNumbers = Split(sNumbers, ";")

	For i = LBound(aNumbers) To UBound(aNumbers)

		PBXScript.OutputTrace "Checking extension: " & aNumbers(i)
		sName = GetUserNameFromExtension(aNumbers(i))
		PBXScript.OutputTrace "Found username: " & sName

		If sName <> "" Then
			If IsRedirectedFromByName(sName) Then
				PBXScript.OutputTrace "Call is redirected from this user"
				bReturn = True
				sNumber = aNumbers(i)
				PBXScript.OutputTrace "Call is not redirected from this user"
			End If
		End If


	IsRedirectedFromByNumber = bReturn

	PBXScript.OutputTrace "bReturn = " & bReturn
	PBXScript.OutputTrace "<------ IsRedirectedFromByNumber ( Return '" & bReturn & "' )"
End Function


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.