Overview
Normally, to retrieve call audio recordings from TIM Enterprise, an authenticated web user must log in to the web interface, navigate to the desired call using the Live Call View screen or by running a report, click on the call, then play it using the built-in web-based call player.
It is also possible to programmatically retrieve call recordings using a two-step authenticated request process. This works in the following way:-
- Obtain the call's datasource, voicelocation and voicefilename properties from the calls values from the
table in the TIM Enterprise database for the call you want to retrieve.Referencemacro Label calls - Request a security token from TIM Enterprise, by authenticating using an authorised web user's login credentials
- Request the call from the RTA Echo Service, using the security token obtained above
- Receive the call audio in WAV your chosen format, forcibly obfuscated if any such events apply to the requested call
The following page shows some Below is an example code showing how to retrieve a voice recording from TIM Enterprise.
C#
Example Sourceexample
This is a very simple example of some
Referencemacro | ||
---|---|---|
|
Use the following code to request a security token from TIM Enterprise, plugging in the appropriate values for _the datasource, _voicefilename, and _voicelocation variables for the call you want to retrieve. These values are obtained directly from the calls database table or through any of the web scripts available.
A security token in this context is a URL which is used to obtain the actual voice recording from the RTA Echo Service.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
using System; using System.Net; using System.Text; private class GetAudioFile { Stringstring _datasourcedataSource = "\\3\\"; Stringstring _voicefilenamevoiceFilename = "NCS00000000EA39883596CC41E799B4630006CF2D56"; Stringstring _voicelocationvoiceLocation = "4"; string echoUrl = ""; using (WebClient client = new WebClient()) { client.Headers["User-Agent"] = "3rd-Party-Agent"; client.Credentials = new NetworkCredential("username", "password"); byte[] responseBody = client.DownloadData("http://enterprise.example.com/voice.wav?cmd=getvmsg&datasource=" + System.Uri.EscapeDataString(_datasourcedataSource) + "recordingid=" + System.Uri.EscapeDataString(_voicefilenamevoiceFilename) + "voicelocation=" + System.Uri.EscapeDataString(_voicelocationvoiceLocation) + "salt=" + System.DateTime.Now.Ticks); StringechoUrl RTAURL = Encoding.UTF8.GetString(responseBody); } if (!string.IsNullOrEmpty(echoUrl)) { // Use another WebClient object to query the URL provided in "echoUrl" to retrieve the actual call recording... } } |
Assuming the request was successful (and the response status was a 200 OK), the variable RTAURL will echoUrl will now contain a full URL which you must can request in a similar way, using a another System.Net.WebClient object.
The security token URL is valid for one minute (60 seconds).
Again using a System.Net.WebClient object, request the voice file directly from the RTA Service.