Lua → VBScript SwxWare v13.10
This function plays a given wav file.
local nReturn = PBXCall.PlayMessage(sAnnouncement, nSkipFirstSeconds, bRepeatAfterHoldOrTransfer, nFileOwnerId, sFileOwnerName)
This function returns a PBXResult value of PBXSuccess, PBXFailure, PBXCallTermNormalCallClearing or PBXCallTermOriginatorDisconnected.
Parameters:
sAnnouncement
Name of soundfile.
local nReturn = PBXCall.PlayMessage("Welcome.wav")
If no explicit path is given in the filename, SwyxServer searches this file in the database, in the following scopes in that order:
- User
- User Default
- Global
- System Default
It is also possible to play a local file from the SwyxServer machine. In this case it is necessary, that the Windows user account the SwyxServer service is running under (usually the SwyxServiceAccount), has read privileges on that file.
local nReturn = PBXCall.PlayMessage("C:\Announcements\MyMessage.wav")
The .wav file must be in 16kHz, 16bit, PCM, mono format.
The GetFilesInFolder() function from the Function Collection shows an example that plays all .wav files in a given folder.
nSkipFirstSeconds
Optional. Default: 0
Skip the first n seconds of the given sound file. If value is 0 then file will be played completely.
bRepeatAfterHoldOrTransfer
Optional. Default: true
- false: sound file will NOT be repeated after current playback was interruppted by a 'hold' or 'transfer' user action.
- true: sound file will be repeated after current playback was interruppted by a 'hold' or 'transfer' user action.
nFileOwnerId
Optional. Default: 0
Defines user whose file should be played by the SwyxWare internal unser id. If 0 sAnnouncement of the current script user will be played. Note that only non-private files of other users can be accessed.
local nReturn = PBXCall.PlayMessage("Weclome.wav", 0, True, 15)
sFileOwnerName
Optional. Default: ""
Defines user whose file should be played by his SwyxWare user name. If "" sAnnouncement of the current script user will be played. Note that only non-private files of other users can be accessed.
local nReturn = PBXCall.PlayMessage("Weclome.wav", 0, True, 0, "Erika Mustermann")

By Tom Wellige