Record Conversation

It can be useful to record both sides of a phone call. The RecordConversation allows you to do just that.

The RecordConversation method allows you to pass in two routable resources and a filename, and it will record both sides of a call, placing the audio in the same file. This function is useful for when you want to record the duration of a call.

Please note that the RecordConversation is a synchronous command, so if you try to run it from your main thread, it will block. Instead, you will need to call it from a separate thread, as shown in the example below:

public void RecordConversation()
RecordResource = TelephonyServer.GetVoiceResource();
RecordResource.MaximumTime = 6000; // You can set this to any arbitrarily high number. This allows a max recording of 6000 seconds or 1 hour.
RecordResource.MaximumSilence = 6000;
RecordResource.TerminationDigits = "";
tc = RecordResource.RecordConverstation(filename, VoiceResource, ChannelResource); /* By recording the Channel resource and the voice resource that a channel resource is routed to, you record what the IVR plays to the user.
Alternatively, if you need to record both legs of a call, you would pass in the ChannelResource of one leg of the call, and the ChannelResource of the second leg of the call.*/
public void RunScript()
System.Theading.Thread recordThread = new System.Threading.Thread(RecordConversation);

To stop the RecordConversation, you will need to stop the Voice Resource that is recording the call. A good place to put this is in your finally block when you are cleaning up resources.


If you need to record multiple call legs (i.e. a user calls into an IVR, and you want to have a recording that contains the IVR leg, and the transfer), you will need to start a new RecordConversation to manage that side of the recording. You can join the files together, by using the WaveAppend function in the TelephonyServer class:

telephonyServer.WaveAppend("file1.wav", "file2.wav"); /* A good place to put this is at the end of the call after you clean up your ChannelResource */