Tel.: 00 36 52 532 731

How to make a video call?


This article is a detailed guide about making video calls in relation with Ozeki VoIP SIP SDK. To use this example, you need to have Ozeki VoIP SIP SDK installed, and a reference to ozeki voipsipsdk.dll should be added to your visual studio project. It's also recommended to visit the How to make a Voice Call article before you begin to study how to perform Video calls.

Figure 1 - Making video calls

What is video call, how does it work?

VoIP communication has extended functions that are not usually part of the ordinary telephoning system. One of these is the video phoning function that can be implemented in a VoIP application (Figure 1).

Video phoning uses the basis of the voice communication and extends it with some extra codec support and display methods. In case of a video communication not only audio but video data is also sent in a digitized and segmented form through the established phone line between the two VoIP clients. If both clients support video phoning, the users can talk to each other like they were in the same room.

How to make video call using C#?

The MediaHandler classes contain new media handlers for supporting video handling. As for the audio, the video support also has receiver and sender objects (PhoneCallVideoSender and PhoneCallVideoReceiver). For the sake of simplicity, this example is on the sending process only.

The basic peripheral device for the video is, of course, the web camera that also has its own model class in Ozeki VoIP SIP SDK (WebCamera).

After defining the basic tools, you need to know how you can use them for making video calls. It is really similar to the voice calls.

The call accept and start are done similar to the original softphones. In this case you can use the CallType class to identify if the call is actually a video or an audio call. It is possible to change the CallType during the call too.

Afterwards, if there is a camera connected to your computer, you should start that camera and connect to phoneCallVideoSender using the Connect method of the MediaConnector. In the end, you can connect the video of the camera with the help of the AttachToCall method of the phoneCallVideoSender.

Video call example in C#

using System;
using System.Threading;
using Ozeki.Media;
using Ozeki.Media.MediaHandlers;
using Ozeki.Media.MediaHandlers.Video;
using Ozeki.Network.Nat;
using Ozeki.VoIP;
using Ozeki.VoIP.Media;
using Ozeki.VoIP.SDK;

namespace Video_call
    internal class Program
        private static ISoftPhone mySoftphone; // softphone object    
        private static IPhoneLine phoneLine; // phoneline object          
        private static IPhoneCall call;
        private static string numberToDial;
        private static MediaConnector mediaConnector;

        private static void Main(string[] args)
            //Create a softphone object with RTP port range 5000-10000, and SIP port 5060    
            mySoftphone = SoftPhoneFactory.CreateSoftPhone(5000, 10000, 5060);

            // SIP account registration data, (supplied by your VoIP service provider)    
            var registrationRequired = true;  
            var userName = "sipusername";
            var displayName = "sipdisplayname";
            var authenticationId = "authenticationid";
            var registerPassword = "password";
            var domainHost = "";
            var domainPort = 5060;
            numberToDial = "1001";

            // Send SIP regitration request    
            mySoftphone_Register(mySoftphone, registrationRequired, displayName, userName, authenticationId, registerPassword,
                             domainHost, domainPort);

            // prevents the termination of the application    
            while (true) Thread.Sleep(10);

        static void mySoftphone_Register(ISoftPhone softphone, bool registrationRequired, string displayName, string userName,
        string authenticationId, string registerPassword, string domainHost, int domainPort)
                var account = new SIPAccount(registrationRequired, displayName, userName, authenticationId, registerPassword, domainHost, domainPort);
                var natConfiguration = new NatConfiguration(NatTraversalMethod.None);
                phoneLine = softphone.CreatePhoneLine(account, natConfiguration);
                phoneLine.PhoneLineStateChanged += mySoftphone_PhoneLineStateChanged;
            catch (Exception ex)
                Console.WriteLine("Error during SIP registration: " + ex.ToString());

        static void mySoftphone_PhoneLineStateChanged(object sender, VoIPEventArgs<PhoneLineState> e)
            if (e.Item == PhoneLineState.RegistrationSucceeded || e.Item == PhoneLineState.NoRegNeeded)

        static void CreateCall()
            call = mySoftphone.CreateCallObject(phoneLine, numberToDial, CallType.AudioVideo);

            mediaConnector = new MediaConnector();
            var phoneCallVideoSender = new PhoneCallVideoSender();
            var cam = WebCamera.GetDefaultDevice();

            if (cam != null)
                mediaConnector.Connect(cam, phoneCallVideoSender);


            call.CallStateChanged += call_CallStateChanged;
            call.CallErrorOccured += call_CallErrorOccured;

        static void call_CallStateChanged(object sender, VoIPEventArgs<CallState> e)
            Console.WriteLine("\nCall state: {0}.", e.Item);

        static void call_CallErrorOccured(object sender, VoIPEventArgs<CallError> e)
            Console.WriteLine("Error occured during the call: {0}.", e.Item);

If you have any question or need assistance, please contact us at

Training guides, simple examples

This article is a simple example as a solution to introduce the implementation of this feature, if you would like to visit the detailed developer documentations, you can learn much more from the Ozeki VoIP SIP SDK Training chapter.

Related Pages