VBScript → Lua
This collection holds informations about all scripts that has been started for this call before the current script has been started. If a call is forwarded from a script with option "Proceed with destination's call routing", i.e. when PBXCall.ConnectToEx is called with bProceedWithDestinationScript set to true. Note that the standard redirection (immediate, delayed, busy) always set this flag.
The collection contains PreviousScript objects containing the following information for each previous script:
- UserName (obsolete from SwyxWare v13.27, contains valid value for user scripts only)
- UserId (obsolete from SwyxWare v13.27, contains valid value for user scripts only)
-
EntityType (new from SwyxWare v13.27)
either PBXScriptTypeUser(1) or PBXScriptTypeGroup (2) -
EntityId (new from SwyxWare v13.27)
long value containing the SwyxWare interal id of user or user group -
EntityName (new from SwyxWare v13.27)
string value containing the name of user or user group - StartTime
- EndTime
The following example code lists all previous script information into the server trace file:
Dim Scripts Set Scripts = PBXScript.PreviousScripts PBXScript.OutputTrace "Number of previous scripts: " & Scripts.Count Dim Script ' til SwyxWare v13.26 For Each Script In Scripts PBXScript.OutputTrace "UserName: " & Script.UserName PBXScript.OutputTrace "UserID: " & Script.UserID PBXScript.OutputTrace "StartTime: " & Script.StartTime PBXScript.OutputTrace "EndTime: " & Script.EndTime Next ' from SwyxWare v13.27 For Each Script In Scripts PBXScript.OutputTrace "EntityType: " & Script.EntityType ' 1 = PBXScriptTypeUser, 2 = PBXScriptTypeGroup PBXScript.OutputTrace "EntityId: " & Script.EntityId ' SwyxWare internal id of user or user group PBXScript.OutputTrace "EntityName: " & Script.EntityName ' name of user or user group PBXScript.OutputTrace "StartTime: " & Script.StartTime PBXScript.OutputTrace "EndTime: " & Script.EndTime Next
Please note that a previous script object does contain the user or group name only, not any of the internal extensions of that user or group.
A common usage for this collection is to check if the current call was originally meant for some other certain user or group.
There are ready made functions which search this collection for a given user (til SwyxWare v13.26) or given user or group (from SwyxWare 13.27)
- IsRedirectedFromByName (til SwyxWare v13.26)
- IsRedirectedFromByNameEx (from SwyxWare v13.27)
Based on that function there is another function available which takes an extension or a list of extensions to resolve these numbers via PBXConfig.GetUserByAddress into a user name and then check against this collection:
By Tom Wellige