Jump to content
Tom Wellige

PBXCall.LastRecordedMessage

Recommended Posts

This property returns the name (incl. path) of the last recorded message (by the Record Message block).

 

PBXCall.LastRecordedMessage

 

This function returns a string value.

 

When making use of the Record Message functionality the SwyxServer defines the unique name of the WAV file to take the recording. After a recording this name can be requested from the server i.e. by this property. The Record Message block also provides a variable the name will be written in.

 

The file is named Rec_yyyyMMddhhmmss.wav where yyyMMddhhmmss is the time and date of the recording. The PBXCall.SendEmail function deletes the last recording. So retrieve it beforehand. If you got a file name it remains valid until the script is finished. After that the file will be deleted by the server.

 

If you need to know how many seconds were recorded in that WAV file you can use the PBXCall.LastRecordedMessageLength function.

 

The following example copies the last recorded message to a given file server and rename it. Copy the first code snippet into the Start block of your script. The second code snippet can be used afterwards in a Script Code block.

 

function Get2Digits ( s )
  if Len(s) > 1 then
    Get2Digits = s
  else
    Get2Digits = "0" & s
  end if
end function

Dim sRecording, sTarget
sTarget = "\\fileserver\recordings\%callid%_%date%_%time%.wav"
sTarget = Replace(sTarget, "%callid%", PBXCall.CallID)
sTarget = Replace(sTarget, "%date%", Year(Now) & Get2Digits(Month(Now)) & Get2Digits(Day(Now)))
sTarget = Replace(sTarget, "%time%", Get2Digits(Hour(Now)) & Get2Digits(Minute(Now)) & Get2Digits(Second(Now)))

sRecording = PBXCall.LastRecordedMessage

if sRecording <> "" then
  Dim fso
  Set fso = CreateObject("Scripting.FileSystemObject")
  fso.CopyFile sRecording, sTarget
  Set fso = Nothing
end if

 

Share this post


Link to post
Share on other sites

×
×
  • 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.