This article is a detailed guide about playing voice information from the microphone
into a SIP voice call in relation with Ozeki VoIP SIP SDK.
After reading through this page you will be fully familiar with all the essential
terms concerning playing voice into a SIP call and what you will need for creating your own solution using Ozeki VoIP SIP SDK.
Voice calling needs the basic audio devices to operate with, and the most basic one is the microphone
that allows you to have your voice digitized into an audio stream. The microphone is an input device
that captures analog voice from its environment and transmits it to the
driver program that uses audio codecs to make it a digital data flow.
This data flow can be used in a SIP phone call.
Figure 1 - Incoming SIP message
The following sections show how you can use the microphone and play the audio stream
into a SIP phone call with the support of Ozeki VoIP SIP SDK. Before you start, you will need to download and
install Ozeki VoIP SIP SDK on your computer. The C# codes will need to be done in
Visual Studio 2010 or compatible so you will need to have that installed too.
Source Code Snippets for Microphone Handling
The microphone is the basic input device for a VoIP phone call that is represented by the
Microphone class of Ozeki VoIP SIP SDK. For every VoIP application a microphone needs to be
initialized like in Code 1.
When working with Ozeki VoIP SIP SDK you do not need to know how to handle
the microphone as the SDK implements all the necessary methods for this purpose.
You only need to start and stop the device or attach it to the proper AudioHandler object.
In the call_CallStateChange event handler method you can see how your
microphone should be handled.
In Code 2 there is a code snippet for starting the microphone in case of a call establishment
that is indicated by the InCall call state.
Code 2 - Starting the microphone
In case of the end of a call the microphone needs to be stopped and disconnected from the
AudioHandler that is an AudioSender in this case (Code 3).
Code 3 - Stopping the microphone
The AudioSender object needs to be attached to the call (Code 4) and if this is done all
the voice data coming from the microphone is digitized and played into the call by
the AudioSender object.
Code 4 - You need to attach the AudioSender to the call
As Ozeki VoIP SIP SDK implements the codecs that do the digitization of the voice and all the
functionalities that are needed to play the digitized audio data into a call, you only need to use
these simple code lines to make you microphone work with your softphone application.
This article introduced you the basic knowledge about
playing voice from a microphone into a SIP voice call
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.