This article is a detailed guide about recording incoming and outgoing voice calls
in relation with Ozeki VoIP SIP SDK. After reading through this page you
will be fully familiar with all the essential terms concerning voice call recording
and what you will need for creating your own solution using Ozeki VoIP SIP SDK.
In Voice over IP model the communication is made through the Internet Protocol and the data that
is sent between the two end points is digitized. This data can be recorded and saved in
audio files if needed (Figure 1).
Figure 1 - VoIP call recording
VoIP phone calls allow voice call recording in more than one ways. You can record only
one of the clients' voice, or record both into separate files or even record them into
one mixed file. This last solution makes the most sense, of course.
The following program code uses the background support of Ozeki VoIP SIP SDK,
therefore you will need to download and install the SDK on your computer before
starting to use the program code. You will also need to have Visual Studio 2010 or
compatible IDE and .NET Framework installed on your system, as the program code below is written in C# language.
The call recording is an easy task with Ozeki VoIP SIP SDK even if you need to
record both the incoming and the outgoing voices. You only need to extend your softphone application with some extra
tools and the recording can be done automatically when you make a call (Code 1).
You can record audio streams into .wav audio files, and for this purpose you will
need a WaveStreamRecorder media handler object. If you want to record both parties' voice
in one file, you will also need an AudioMixerMediaHandler that will mix the incoming and the outgoing voices.
The two extra strings are used for the .wav file name during the recording. The filename specifies the
.wav file's name that will be the parameter for the recorder's constructor.
The file name for the recording will start with the caller string that will be
the dialed number in the case of an outgoing call (Code 2). This instruction is needed to put into the
Pick Up button's event handler that starts the outgoing call.
caller = DialedNumber.Text;
Code 2 - The caller initialization in case of an outgoing call
In the case of an incoming call, the caller will store the displayed name of the
actual caller. This string is only used for specifying the recorded file's name (Code 3).
Code 3 - The caller initialization in case of an incoming call
The recording needs to be established when the call state becomes InCall (Code 4). In this case the
recorder needs to be initialized with the filename that will consist of the caller string
and the hour, minute and second information of the current time. This file naming
convention is necessary for securing the unique file names, as you do not want to
overwrite the recorded files.
As only the file name is specified, the .wav file will be stored in the same folder
as the .exe of the application. If you want to save it somewhere else, you can specify the file path.
The recorder needs to be subscribed for the stopped event too.
The recording will be perfect, if you make the following connections during the establishment.
You need to connect the microphone and the mediaReceiver objects to the mixer. This will ensure that the two audio
streams will be mixed. Then you need to connect the mixer to the recorder that will record the mixed
audio stream into the file specified by the filename parameter.
When all the other connections and attachments are set, you need to start the recording by calling
the recorder.StartStreaming() method.
The WaveStreamRecorder object needs to be subscribed for the stopped event that is hadled
in the following methods in Code 6.
void WaveStreamRecorder_Stopped(object sender, EventArgs e)
if (RecorderStopped != null)
public event EventHandler<EventArgs> RecorderStopped;
Code 6 - Event handler for the record stop
As this example program records all the calls you make with it, it is suggested to
show a pop-up window to inform the user about this fact. This window will appear
every time you press the Pick Up button in case of accepting an incoming call and
in the case of starting an outgoing one too.
private void PickUp_Click(object sender, EventArgs e)
MessageBox.Show("Please note, that all your calls made by this softphone will be recorded.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
Code 7 - Information about the recording
This example program briefly demonstrated how you can record a voice call by mixing the incoming and
outgoing voices together. You can use this code to extend your softphone applications with voice recording
support or you can invent it further the way you want to use voice recording.
This article introduced you the basic knowledge about recording voice calls
and showed how Ozeki VoIP SIP SDK can help you to fulfill your wishes about this topic.
If you have read through this page carefully, you already have all the knowledge you need to start on your own solution.
As you are now familiar with all the terms concerning this topic, now it is time to take a step further and explore what other extraordinary solution Ozeki VoIP SIP SDK can provide to you.