VBScript → Lua
This function plays a given wav file.
PBXCall.PlayMessage (bstrSoundfile, [nSkipFirstSeconds], [bRepeatAfterHoldOrTransfer], [FileOwner])
This function returns an integer value of PBXSuccess (0) on success. See list of defined return values.
Parameters:
bstrSoundfile
Name of soundfile.
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.
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.
FileOwner
Optional. Default: 0
Defines user whose file should be played. Can be a user ID or a user name. If 0 bstrSoundfile of the current script user will be played. Note that only non-private files of other users can be accessed.
PBXCall.PlayMessage "Weclome.wav", 10, True, "Operator"
By Tom Wellige