VBScript → Lua
This function returns True if the call was redirected/transferred by a certain user (extension) or list of extensions, separated by ; (semikolon).
Please see the Introduction chapter for some usage instructions.
'---------------------------------------------------------------- ' 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) Else PBXScript.OutputTrace "Call is not redirected from this user" End If End If Next IsRedirectedFromByNumber = bReturn PBXScript.OutputTrace "bReturn = " & bReturn PBXScript.OutputTrace "<------ IsRedirectedFromByNumber ( Return '" & bReturn & "' )" End Function
This function 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. It makes also use of the Server Script API function PBXScript.OutputTrace to write trace information into the SwyxServer trace file.
Please note: from SwyxWare v13.27 on it is possible to have call routing also for groups and not just users. This function can not be extended to identify the new groups as well, so it can identify users only.
This function was initially posted into this forum topic.
By Tom Wellige
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now