Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Normally, to retrieve call audio recordings from TIM Plus, an authenticated web user must log in to the web interface, navigate to the desired call using the 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 datasource, voicelocation and voicefilename values from the 
    Referencemacro
    Labelcalls
    table in the TIM Plus database for the call you want to retrieve.
  • Request a security token from TIM Plus, by authenticating using an authorised web user's login credentials
  • Request the call from the Echo Service, using the security token obtained above
  • Receive the call audio in WAV format, forcibly obfuscated if any such events apply to the requested call

Below is an example code showing how to retrieve a voice recording from TIM Plus.

C#

Example

example

This is a very simple example of some

Referencemacro
LabelC#
code to request a call's voice recording from TIM Plus. A more complex example would describe passing parameters in the class's constructor, for instance, but this should demonstrate the logic behind the procedure.

Use the following code to request a security token from TIM Plus, plugging in the appropriate values for the dataSource, voiceFilename, and voiceLocation variables for the call you want to retrieve. These values can be obtained directly from the calls database table, reports, or web commands.

A security token in this context is a URL which is used to obtain the actual voice recording from the Echo Service.

Code Block
titleSimple call retrieval example
linenumberstrue
languagecsharp
using System;
using System.Net;
using System.Text;
 
private class GetAudioFile
{
    string dataSource = "3";
    string voiceFilename = "344f91cf-ba35-48e4-8080-a80a3816f5e7";
    string voiceLocation = "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(dataSource) + 
                              "recordingid=" + System.Uri.EscapeDataString(voiceFilename) +
                              "voicelocation=" + System.Uri.EscapeDataString(voiceLocation) + 
                              "salt=" + System.DateTime.Now.Ticks);
 
        echoUrl = 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 echoUrl will now contain a full URL which you must request in a similar way, using another System.Net.WebClient object.

The security token URL is valid for one minute (60 seconds).