Jump to content
  • PBXCall.LastRecordedMessage

    PBXCall.LastRecordedMessage

    VBScript   → Lua

     

    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.

     

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

     

    The file is named Rec_yyyyMMddhhmmss.wav where yyyMMddhhmmss is the time and date of the recording.

     

    The file name remains valid until the script is finished. After that the file will be deleted by the server.

     

    Hint: the PBXCall.SendEmail function deletes the last recording as well. So handle the file if needed beforehand.

     

     

    The following example copies the last recorded message to a given file server and renames 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

     

    An even better solution would be to create a VBScript function from the second code snippet, place it also into the Start block and then call this function e.g. with an Evaluate block from with your GSE script. By doing so, you could add some proper error handling and tracing into your code.

     

     


    Tom Wellige
     Share


     Share




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