Question:
I am seeking some guidance on how to implement sip call recording on our voice servers using the HMP elements. We are making 2 outbound call legs and bridging them together. Could you provide guidance on this capability as well as important things to understand when leveraging the recording feature?
Answer:
On call recording the answer depends on what part of the call is important to you and if you want to record when a person answers the phone or only care about when the two calls are bridged together.
We have 3 primary ways to record.
- Record two devices into one file. (RecordConversation)
- Record a single device and any device it gets routed to. (RecordAndFollowConverstation)
- Record the output of a conference.
If you only care about recording the call once the two folks are talking, then option 1 is the best bet. If however, a caller is calling in and you want to hear them as they traverse the menu and then also record when they are routed to an agent then #2 is the best bet.
#3 is just simply recording all of the output of a conference.
This brings us to “voice resource” management. When you record (#1,#2 or #3) you need an available voice resource. Many people use the voice resource of one of the caller’s channel to do the recording. This is fine as long as you don’t expect to need to monitor for digits during the conversation. If you need use the channels voice resource to monitor for digits, or want to quickly route away and play a message and route back then you need to get an additional voice resource. VoiceElements, by default, configures one voice resource for each channel. So, if you have 100 channels you would also have 100 voice resources. If you pull an “extra” resource to do a recording then if you had 100 calls come in at the same time, you would be short a resource.
Fortunately you can add voice resources without charge by adding/changing this line to your VoiceElementsServer.exe.config file:
<setting name="AdditionalVoiceResources" serializeAs="String">
<value>10</value>
</setting>
Lastly, you need to know that the recording must be done on its own thread. (note this example uses the voice resource of the primary channel for the record operation and someOtherChannel.
void Record(object obj)
{
Log.Write("Record Started");
try
{
ChannelResource cr = (ChannelResource)obj;
string recordName = String.Format(@"{0}\R{1}-{2}.WAV", IvrApplication.WorkingFolder, DateTime.Now.ToString("yyyyMMddHHmmss"), cr.DeviceName);
cr.VoiceResource.TerminationDigits = "";
cr.VoiceResource.WipeDigitBuffer();
cr.VoiceResource.MaximumTime = 200;
cr.VoiceResource.MaximumSilence = 200;
TerminationCode tc = cr.VoiceResource.RecordConverstation(recordName, cr, someOtherChannel);
Log.Write("Record Complete. TC: {0}", tc);
}
catch (Exception ex)
{
Log.WriteException(ex, "Record");
}
}
Here if either side hangs up the call. You should issue a Stop on the voice resource from another thread before you dispose of the channel to ensure that the recording it tidy.
You could use the GetVoiceResource() operation to get a voice resource instead of using the channel from the server, but this is the basic idea. All recording operate with this basic concept.