This guide explores how you can setup Ozeki VoIP SIP SDK for managing
multiple phone calls professionally. Please find below the source codes for
this functionality and their explanation to speed up your work.
Telephoning nowadays is not only about calling somebody to tell some news but also
a tool for making business calls. A company telephone line has to support more than one
incoming call at the same time (Figure 1).
The support of multiple calls means that the telephone client can handle more than one call
at the same time. This does not necessarily mean that the callee hears all the calls
simultaneously but the calls are put into lines and the company telephone agent
transfers the calls to other telephones within the company system. While
the company telephone network seems to be a single telephone end-point from outside.
Figure 1 - Multiple phone calls
The following program code uses the background support of Ozeki VoIP SIP SDK,
therefore you will need to download and
install Ozeki SIP 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.
Ozeki VoIP SIP SDK has an illustrious support for multiple calls, you only have to handle them.
In this example program Code 1 includes the tools that are for this purpose. The sample program
supports two simultaneous calls they are stored in call1 and call2. There are flags that indicate the
number of the actual calls, the selected (active) call and the incoming call ID in case of an incoming call.
int selected_call = 0;
int incoming_call = 0;
int numberOfCalls = 0;
Code 1 - Extra tools for the multiple call support
The phone line registration in this example is the same as in case of any other softphones, the
only change is in the call handling. Code 2 shows the method for the incoming call handling.
As the example handles 2 simultaneous call, if the number of calls exceeds 2, the incoming call will be
automatically rejected. In other cases the incoming call will be signed to the first
free call object and a user interaction will be waited (acceptance or reject).
The calls need to be subscribed for the basic cal events, in this case the state change and the error as the
example program does not handle DTMF signals. Code 3 shows the methods that are basically the same as in case of other
softphones. The only difference is that in this sample program these methods need an IPhoneCall parameter that
indicates which phone call is used for subscription.
The phone state handling is similar to the other cases, it only differs in the
fact that you need to handle the active call instead of a single one. Code 4 shows the
case of the established call (InCall state). This is the case when you need to initialize the peripherals
and set the sender and receiver objects.
if (selected_call == 1)
else if (selected_call == 2)
Code 4 - Call state handling - InCall
Code 5 shows the handling of the completed call event. In this case the actual call
ending is in the event handler of the Hang Up button, this method only calls that
one and resets the media handlers if there are no more calls.
The user of the example softphone can start or accept a call with the Pick Up button.
Code 6 shows the event handler for the button's Click event. The method seems difficult
to understand but it is simpler than is seems.
In case of an incoming call the Pick Up button accepts the call. This is done by
firstly specifying the call (call1 or call2) an then setting the proper call button
that will indicate which call is the active one by using red as the text color.
In case of an outgoing call, the program chooses the first free call object to assign the outgoing call to it.
In both cases if there was another call (previously active) it will be set to hold and the
new (accepted incoming or started outgoing) call will be the active one.
Code 6 - Picking up the phone or starting an outgoing call
Code 7 contains the event handler method for the Hang Up button. This button ends an
active call or rejects an incoming one. If there is another call except for the
ended one, it will be the active one and will be set to InCall state again.
When the sample softphone has both simultaneous calls set, you can choose between the calls by using
the call buttons. The active call is always the one those button text is red. Code 8 shows one of the
call button event handler methods. The other is the sibling of this. It sets the button colors and sets the
call assigned to the button the active one while the other call will be set to hold.
You can use more than two simultaneous calls with Ozeki VoIP SIP SDK, too. In that case you should use some
kind of list for the calls but the basic concept is the same as in the case of this
example program. Now you can use this knowledge to build your own solution with
multiple call support.
This guide introduced you detailed information and sources for managing multiple phone calls
and showed how Ozeki VoIP SIP SDK can help you to fulfill your goals.
If you have read through this page carefully, you already have all the knowledge you
need to start your own solution.