Ozeki Camera Recorder Stat

How to call an Onvif IP camera from a SIP phone in C#

This example demonstrates a simple method for how to register a SIP account to a PBX with your Windows Forms/WPF Application written in C#, that can answer the incoming calls and send the camera voice to a SIP phone automatically. To implement this example, you need to have OZEKI Camera SDK installed, and a reference to OzekiSDK.dll should be added to your Visual Studio project.

How to call an Onvif IP camera from a SIP phone using C#?

To establish the connection properly between your application and an IP camera you should apply the same code snippet what you have used in the example (How to connect to an IP camera device using C#?). Important: you should study this article in order to find out how to setup your Windows Forms/WPF Application correctly.

Getting started

To get started it is recomended to Download and Install the latest version of Ozeki Camera SDK. After installation you can find the example code discussed in this page with full source code in the following location on your harddisk:

Download Ozeki Camera SDK: http://www.camera-sdk.com/p_13-download-camera-onvif.html
Windows forms version: C:\Program Files\Ozeki\Ozeki SDK\examples.zip\Examples\Camera\
03_IPCamera\CameraSoundToSIPCall\CameraSoundToSIPCall.sln

To compile this example you will need Microsoft Visual Studio installed on your computer.

The additional statements and methods of this example are the following:

ISoftPhone _softphone: Please create a softphone object from the ISoftPhone interface.
IPhoneLine _phoneLine: You should create a phone line object from the IPhoneLine interface.

_softphone = SoftPhoneFactory.CreateSoftPhone(5000, 10000): You should also initialize this softphone with the default parameters.

Please set the port range indicated by the first two parameters as the minimum port's and the maximum port's number, this is the port's interval. If there is any firewall rule which restricts the usable ports, you can set the usable port range here, which will be used during the calls. These are sample ports only in the example, but a softphone with these parameters can be used in most of the cases.

In order to communicate (and to register to the PBX) you should create a phone line. In this example the necessary SIP account is already created so with this you can establish the phone line:

var account = new SIPAccount(registrationRequired, displayName, userName,
authenticationId, registerPassword, domainHost);
_phoneLine = _softphone.CreatePhoneLine(account);

When the application is running, the state of the phone line can change. To follow these changes, you should listen to the following change event:

_phoneLine.RegistrationStateChanged += phoneLine_RegistrationStateChanged;

When the phone line has been created, please call the RegisterPhoneLine() method to register the phone line to the softphone. If the registration is set to required, this method will also send the SIP REGISTER command. You only need to use the following line:

_softphone.RegisterPhoneLine(_phoneLine);

How to listen to incoming calls?
If you would like to be notified when there is an incoming call, you should set an event at the initialization of the softphone for this purpose:

_softphone.IncomingCall += softphone_IncomingCall;

When the event indicates that there is a call waiting to be received, it sets the call object, and subscribes to the call's events with help of the previously written method. Then you should call the ConnectToCall() method and answer the call:

_call = e.Item;
_call.CallStateChanged += call_CallStateChanged;
ConnectToCall();
_call.Answer();

You should attach the media handlers to the call. With the help of the connector object the
_camera.VideoChannel will be connected to the _videoSender, and the
_camera.AudioChannel will be connected to the _audioSender,:

public void ConnectToCall()
{
    _audioSender.AttachToCall(_call);
    _connector.Connect(_camera.AudioChannel, _audioSender);
}

Finally the call will be completed. Then you need to unsubscribe from the event. This works similarly to the subscriber (with the "-=" operator) and "disconnector" method, which close the connection between the two media handlers with the Disconnect() method.

_call.CallStateChanged -= call_CallStateChanged;
_connector.Disconnect(_camera.AudioChannel, _audioSender);

Calling an Onvif camera from a SIP phone example in C#

Windows Form  

Form1.cs

using System;
using System.Windows.Forms;
using Ozeki.Camera;
using Ozeki.Media;
using Ozeki.VoIP;

namespace CameraSoundToSIPCall
{
    public partial class MainForm : Form
    {
        private OzekiCamera _camera;
        private CameraURLBuilderWF _myCameraUrlBuilder;
        private MediaConnector _connector;

        private ISoftPhone _softPhone;
        private IPhoneLine _phoneLine;
        private IPhoneCall _call;
        private PhoneCallAudioSender _audioSender;

        public MainForm()
        {
            InitializeComponent();

            _myCameraUrlBuilder = new CameraURLBuilderWF();

            _connector = new MediaConnector();
            _audioSender = new PhoneCallAudioSender();
            _softPhone = SoftPhoneFactory.CreateSoftPhone(5000, 10000);
            _softPhone.IncomingCall += _softPhone_IncomingCall;
        }

        void _softPhone_IncomingCall(object sender, VoIPEventArgs<IPhoneCall> e)
        {
            var incomingCall = e.Item;

            if (_call != null)
            {
                incomingCall.Reject();
                return;
            }

            _call = incomingCall;
            ConnectToCall();

            _call.Answer();
        }

        private void ConnectToCall()
        {
            if (_call == null)
                return;

            _audioSender.AttachToCall(_call);

            _connector.Connect(_camera.AudioChannel, _audioSender);
        }

        private void btn_Compose_Click(object sender, EventArgs e)
        {
            var result = _myCameraUrlBuilder.ShowDialog();

            if (result != DialogResult.OK)
                return;

            tb_CameraURL.Text = _myCameraUrlBuilder.CameraURL;

            btn_Connect.Enabled = true;
        }

        private void btn_Connect_Click(object sender, EventArgs e)
        {
            if (_camera != null)
                _camera.Disconnect();

            btn_Connect.Enabled = false;
            _camera = new OzekiCamera(_myCameraUrlBuilder.CameraURL);
            _camera.CameraStateChanged += _camera_CameraStateChanged;

            _camera.Start();
        }

        void _camera_CameraStateChanged(object sender, CameraStateEventArgs e)
        {
            InvokeGui(() =>
            {
                switch (e.State)
                {
                    case CameraState.Streaming:
                        btn_Disconnect.Enabled = true;
                        break;
                    case CameraState.Disconnected:
                        btn_Disconnect.Enabled = false;
                        btn_Connect.Enabled = true;
                        break;
                }
            });
        }

        private void InvokeGui(Action action)
        {
            BeginInvoke(action);
        }

        private void btn_Disconnect_Click(object sender, EventArgs e)
        {
            _camera.Disconnect();
        }

        private void btn_Register_Click(object sender, EventArgs e)
        {
            try
            {
                if (_camera == null)
                    return;
                if (_phoneLine != null)
                    _phoneLine.RegistrationStateChanged -= _phoneLine_RegistrationStateChanged;

                var account = new SIPAccount(cB_RegReq.Checked, tb_displayName.Text, tb_userName.Text, tb_AuthName.Text,
                    tb_Password.Text, tb_Domain.Text, tb_OutbandProxy.Text);
                _phoneLine = _softPhone.CreatePhoneLine(account);
                _phoneLine.RegistrationStateChanged += _phoneLine_RegistrationStateChanged;
                _softPhone.RegisterPhoneLine(_phoneLine);

            }
            catch (Exception ex)
            {

            }
        }

        void _phoneLine_RegistrationStateChanged(object sender, RegistrationStateChangedArgs e)
        {
            InvokeGui(() =>
            {
                tb_PhoneLineState.Text = e.State.ToString();
            });
        }

        private void btn_Unregister_Click(object sender, EventArgs e)
        {
            if (_phoneLine == null)
                return;

            _softPhone.UnregisterPhoneLine(_phoneLine);
        }

        private void btn_Call_Click(object sender, EventArgs e)
        {
            if (_camera == null || _softPhone == null || _phoneLine == null)
                return;

            StartCall(tb_NumberToDial.Text);
        }

        private void btn_HangUp_Click(object sender, EventArgs e)
        {

            if (_call != null)
                _call.HangUp();
        }

        private void StartCall(string number)
        {
            if (_call != null)
                return;

            var dialParams = new DialParameters(number) { CallType = CallType.Audio };
            _call = _softPhone.CreateCallObject(_phoneLine, dialParams);
            _call.CallStateChanged += _call_CallStateChanged;
            ConnectToCall();
            _call.Start();
        }

        void _call_CallStateChanged(object sender, CallStateChangedArgs e)
        {
            var call = sender as ICall;
            if (call == null)
                return;

            if (call.CallState.IsCallEnded())
            {
                DisconnectFromCall();
                _call.CallStateChanged -= _call_CallStateChanged;
            }

            InvokeGui(() =>
            {
                tb_CallState.Text = e.State.ToString();
            });

        }

        private void DisconnectFromCall()
        {
            _audioSender.Detach();

            if (_audioSender == null)
                return;

            _connector.Disconnect(_camera.AudioChannel, _audioSender);
        }
    }
}

Code 1 - Calling an Onvif camera from a SIP phone example in C#

Please note that none of the cancel and disconnect methods are included in the example because of the demonstrating intent and briefness of the article.

GUI

The Graphical User Interface of an application for calling an Onvif camera from a SIP phone in C#
Figure 1 - The graphical user interface of your application

After the successful implementation of the functions and the GUI elements, the application will work properly. Pressing the connect button will load in the image of the IP camera device connected to your PC into the panel that you can see on the picture. Besides this you can register to a PBX and receive incoming calls to send the picture and voice of the camera.

Below you can find the code that belongs to the interface of the previously presented application. With the help of this section your Windows Forms Application will be able to work properly.

Form1.Designer.cs

namespace CameraSoundToSIPCall
{
    partial class MainForm
    {
        /// 
        /// Required designer variable.
        /// 
        private System.ComponentModel.IContainer components = null;

        /// 
        /// Clean up any resources being used.
        /// 
        /// true if managed resources should be disposed; otherwise, false.
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// 
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// 
        private void InitializeComponent()
        {
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.tb_userName = new System.Windows.Forms.TextBox();
            this.tb_AuthName = new System.Windows.Forms.TextBox();
            this.tb_Password = new System.Windows.Forms.TextBox();
            this.tb_Domain = new System.Windows.Forms.TextBox();
            this.tb_OutbandProxy = new System.Windows.Forms.TextBox();
            this.tb_PhoneLineState = new System.Windows.Forms.TextBox();
            this.tb_displayName = new System.Windows.Forms.TextBox();
            this.btn_Unregister = new System.Windows.Forms.Button();
            this.btn_Register = new System.Windows.Forms.Button();
            this.cB_RegReq = new System.Windows.Forms.CheckBox();
            this.label7 = new System.Windows.Forms.Label();
            this.label6 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.groupBox2 = new System.Windows.Forms.GroupBox();
            this.btn_Disconnect = new System.Windows.Forms.Button();
            this.btn_Connect = new System.Windows.Forms.Button();
            this.btn_Compose = new System.Windows.Forms.Button();
            this.tb_CameraURL = new System.Windows.Forms.TextBox();
            this.label8 = new System.Windows.Forms.Label();
            this.groupBox3 = new System.Windows.Forms.GroupBox();
            this.tb_CallState = new System.Windows.Forms.TextBox();
            this.label11 = new System.Windows.Forms.Label();
            this.btn_HangUp = new System.Windows.Forms.Button();
            this.btn_Call = new System.Windows.Forms.Button();
            this.tb_NumberToDial = new System.Windows.Forms.TextBox();
            this.label10 = new System.Windows.Forms.Label();
            this.label9 = new System.Windows.Forms.Label();
            this.groupBox1.SuspendLayout();
            this.groupBox2.SuspendLayout();
            this.groupBox3.SuspendLayout();
            this.SuspendLayout();
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.tb_userName);
            this.groupBox1.Controls.Add(this.tb_AuthName);
            this.groupBox1.Controls.Add(this.tb_Password);
            this.groupBox1.Controls.Add(this.tb_Domain);
            this.groupBox1.Controls.Add(this.tb_OutbandProxy);
            this.groupBox1.Controls.Add(this.tb_PhoneLineState);
            this.groupBox1.Controls.Add(this.tb_displayName);
            this.groupBox1.Controls.Add(this.btn_Unregister);
            this.groupBox1.Controls.Add(this.btn_Register);
            this.groupBox1.Controls.Add(this.cB_RegReq);
            this.groupBox1.Controls.Add(this.label7);
            this.groupBox1.Controls.Add(this.label6);
            this.groupBox1.Controls.Add(this.label5);
            this.groupBox1.Controls.Add(this.label4);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Location = new System.Drawing.Point(12, 90);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(267, 261);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "SIP Account";
            //
            // tb_userName
            //
            this.tb_userName.Location = new System.Drawing.Point(98, 38);
            this.tb_userName.Name = "tb_userName";
            this.tb_userName.Size = new System.Drawing.Size(155, 20);
            this.tb_userName.TabIndex = 16;
            //
            // tb_AuthName
            //
            this.tb_AuthName.Location = new System.Drawing.Point(98, 64);
            this.tb_AuthName.Name = "tb_AuthName";
            this.tb_AuthName.Size = new System.Drawing.Size(155, 20);
            this.tb_AuthName.TabIndex = 15;
            //
            // tb_Password
            //
            this.tb_Password.Location = new System.Drawing.Point(98, 90);
            this.tb_Password.Name = "tb_Password";
            this.tb_Password.Size = new System.Drawing.Size(155, 20);
            this.tb_Password.TabIndex = 14;
            //
            // tb_Domain
            //
            this.tb_Domain.Location = new System.Drawing.Point(98, 116);
            this.tb_Domain.Name = "tb_Domain";
            this.tb_Domain.Size = new System.Drawing.Size(155, 20);
            this.tb_Domain.TabIndex = 13;
            //
            // tb_OutbandProxy
            //
            this.tb_OutbandProxy.Location = new System.Drawing.Point(98, 142);
            this.tb_OutbandProxy.Name = "tb_OutbandProxy";
            this.tb_OutbandProxy.Size = new System.Drawing.Size(155, 20);
            this.tb_OutbandProxy.TabIndex = 12;
            //
            // tb_PhoneLineState
            //
            this.tb_PhoneLineState.Location = new System.Drawing.Point(98, 233);
            this.tb_PhoneLineState.Name = "tb_PhoneLineState";
            this.tb_PhoneLineState.ReadOnly = true;
            this.tb_PhoneLineState.Size = new System.Drawing.Size(155, 20);
            this.tb_PhoneLineState.TabIndex = 11;
            //
            // tb_displayName
            //
            this.tb_displayName.Location = new System.Drawing.Point(98, 13);
            this.tb_displayName.Name = "tb_displayName";
            this.tb_displayName.Size = new System.Drawing.Size(155, 20);
            this.tb_displayName.TabIndex = 10;
            //
            // btn_Unregister
            //
            this.btn_Unregister.Location = new System.Drawing.Point(178, 200);
            this.btn_Unregister.Name = "btn_Unregister";
            this.btn_Unregister.Size = new System.Drawing.Size(75, 23);
            this.btn_Unregister.TabIndex = 9;
            this.btn_Unregister.Text = "Unregister";
            this.btn_Unregister.UseVisualStyleBackColor = true;
            this.btn_Unregister.Click += new System.EventHandler(this.btn_Unregister_Click);
            //
            // btn_Register
            //
            this.btn_Register.Location = new System.Drawing.Point(98, 200);
            this.btn_Register.Name = "btn_Register";
            this.btn_Register.Size = new System.Drawing.Size(75, 23);
            this.btn_Register.TabIndex = 8;
            this.btn_Register.Text = "Register";
            this.btn_Register.UseVisualStyleBackColor = true;
            this.btn_Register.Click += new System.EventHandler(this.btn_Register_Click);
            //
            // cB_RegReq
            //
            this.cB_RegReq.AutoSize = true;
            this.cB_RegReq.Location = new System.Drawing.Point(98, 168);
            this.cB_RegReq.Name = "cB_RegReq";
            this.cB_RegReq.Size = new System.Drawing.Size(128, 17);
            this.cB_RegReq.TabIndex = 7;
            this.cB_RegReq.Text = "Registration Required";
            this.cB_RegReq.UseVisualStyleBackColor = true;
            //
            // label7
            //
            this.label7.AutoSize = true;
            this.label7.Location = new System.Drawing.Point(31, 67);
            this.label7.Name = "label7";
            this.label7.Size = new System.Drawing.Size(61, 13);
            this.label7.TabIndex = 6;
            this.label7.Text = "Auth name:";
            //
            // label6
            //
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(36, 93);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(56, 13);
            this.label6.TabIndex = 5;
            this.label6.Text = "Password:";
            //
            // label5
            //
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(46, 119);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(46, 13);
            this.label5.TabIndex = 4;
            this.label5.Text = "Domain:";
            //
            // label4
            //
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(12, 145);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(80, 13);
            this.label4.TabIndex = 3;
            this.label4.Text = "Outband Proxy:";
            //
            // label3
            //
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(6, 236);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(86, 13);
            this.label3.TabIndex = 2;
            this.label3.Text = "Phone line state:";
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(31, 41);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(61, 13);
            this.label2.TabIndex = 1;
            this.label2.Text = "User name:";
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(19, 16);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(73, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "Display name:";
            //
            // groupBox2
            //
            this.groupBox2.Controls.Add(this.btn_Disconnect);
            this.groupBox2.Controls.Add(this.btn_Connect);
            this.groupBox2.Controls.Add(this.btn_Compose);
            this.groupBox2.Controls.Add(this.tb_CameraURL);
            this.groupBox2.Controls.Add(this.label8);
            this.groupBox2.Location = new System.Drawing.Point(12, 12);
            this.groupBox2.Name = "groupBox2";
            this.groupBox2.Size = new System.Drawing.Size(405, 72);
            this.groupBox2.TabIndex = 1;
            this.groupBox2.TabStop = false;
            this.groupBox2.Text = "Connect";
            //
            // btn_Disconnect
            //
            this.btn_Disconnect.Enabled = false;
            this.btn_Disconnect.Location = new System.Drawing.Point(239, 40);
            this.btn_Disconnect.Name = "btn_Disconnect";
            this.btn_Disconnect.Size = new System.Drawing.Size(75, 23);
            this.btn_Disconnect.TabIndex = 4;
            this.btn_Disconnect.Text = "Disconnect";
            this.btn_Disconnect.UseVisualStyleBackColor = true;
            this.btn_Disconnect.Click += new System.EventHandler(this.btn_Disconnect_Click);
            //
            // btn_Connect
            //
            this.btn_Connect.Enabled = false;
            this.btn_Connect.Location = new System.Drawing.Point(83, 40);
            this.btn_Connect.Name = "btn_Connect";
            this.btn_Connect.Size = new System.Drawing.Size(75, 23);
            this.btn_Connect.TabIndex = 3;
            this.btn_Connect.Text = "Connect";
            this.btn_Connect.UseVisualStyleBackColor = true;
            this.btn_Connect.Click += new System.EventHandler(this.btn_Connect_Click);
            //
            // btn_Compose
            //
            this.btn_Compose.Location = new System.Drawing.Point(321, 11);
            this.btn_Compose.Name = "btn_Compose";
            this.btn_Compose.Size = new System.Drawing.Size(75, 23);
            this.btn_Compose.TabIndex = 2;
            this.btn_Compose.Text = "Compose";
            this.btn_Compose.UseVisualStyleBackColor = true;
            this.btn_Compose.Click += new System.EventHandler(this.btn_Compose_Click);
            //
            // tb_CameraURL
            //
            this.tb_CameraURL.Location = new System.Drawing.Point(83, 13);
            this.tb_CameraURL.Name = "tb_CameraURL";
            this.tb_CameraURL.Size = new System.Drawing.Size(232, 20);
            this.tb_CameraURL.TabIndex = 1;
            //
            // label8
            //
            this.label8.AutoSize = true;
            this.label8.Location = new System.Drawing.Point(6, 16);
            this.label8.Name = "label8";
            this.label8.Size = new System.Drawing.Size(71, 13);
            this.label8.TabIndex = 0;
            this.label8.Text = "Camera URL:";
            //
            // groupBox3
            //
            this.groupBox3.Controls.Add(this.tb_CallState);
            this.groupBox3.Controls.Add(this.label11);
            this.groupBox3.Controls.Add(this.btn_HangUp);
            this.groupBox3.Controls.Add(this.btn_Call);
            this.groupBox3.Controls.Add(this.tb_NumberToDial);
            this.groupBox3.Controls.Add(this.label10);
            this.groupBox3.Controls.Add(this.label9);
            this.groupBox3.Location = new System.Drawing.Point(285, 90);
            this.groupBox3.Name = "groupBox3";
            this.groupBox3.Size = new System.Drawing.Size(132, 261);
            this.groupBox3.TabIndex = 2;
            this.groupBox3.TabStop = false;
            this.groupBox3.Text = "Phone call";
            //
            // tb_CallState
            //
            this.tb_CallState.Location = new System.Drawing.Point(10, 233);
            this.tb_CallState.Name = "tb_CallState";
            this.tb_CallState.ReadOnly = true;
            this.tb_CallState.Size = new System.Drawing.Size(113, 20);
            this.tb_CallState.TabIndex = 6;
            //
            // label11
            //
            this.label11.AutoSize = true;
            this.label11.Location = new System.Drawing.Point(9, 209);
            this.label11.Name = "label11";
            this.label11.Size = new System.Drawing.Size(53, 13);
            this.label11.TabIndex = 5;
            this.label11.Text = "Call state:";
            //
            // btn_HangUp
            //
            this.btn_HangUp.Location = new System.Drawing.Point(48, 174);
            this.btn_HangUp.Name = "btn_HangUp";
            this.btn_HangUp.Size = new System.Drawing.Size(75, 23);
            this.btn_HangUp.TabIndex = 4;
            this.btn_HangUp.Text = "Hang Up";
            this.btn_HangUp.UseVisualStyleBackColor = true;
            this.btn_HangUp.Click += new System.EventHandler(this.btn_HangUp_Click);
            //
            // btn_Call
            //
            this.btn_Call.Location = new System.Drawing.Point(48, 145);
            this.btn_Call.Name = "btn_Call";
            this.btn_Call.Size = new System.Drawing.Size(75, 23);
            this.btn_Call.TabIndex = 3;
            this.btn_Call.Text = "Call";
            this.btn_Call.UseVisualStyleBackColor = true;
            this.btn_Call.Click += new System.EventHandler(this.btn_Call_Click);
            //
            // tb_NumberToDial
            //
            this.tb_NumberToDial.Location = new System.Drawing.Point(10, 116);
            this.tb_NumberToDial.Name = "tb_NumberToDial";
            this.tb_NumberToDial.Size = new System.Drawing.Size(113, 20);
            this.tb_NumberToDial.TabIndex = 2;
            //
            // label10
            //
            this.label10.AutoSize = true;
            this.label10.Location = new System.Drawing.Point(6, 93);
            this.label10.Name = "label10";
            this.label10.Size = new System.Drawing.Size(78, 13);
            this.label10.TabIndex = 1;
            this.label10.Text = "Number to dial:";
            //
            // label9
            //
            this.label9.Location = new System.Drawing.Point(7, 16);
            this.label9.Name = "label9";
            this.label9.Size = new System.Drawing.Size(116, 68);
            this.label9.TabIndex = 0;
            this.label9.Text = "Enter the phone number where the stream of the web or IP camera will be forwarded" +
    ".";
            //
            // MainForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(429, 361);
            this.Controls.Add(this.groupBox3);
            this.Controls.Add(this.groupBox2);
            this.Controls.Add(this.groupBox1);
            this.Name = "MainForm";
            this.Text = "Camera Sound To SIP Call";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.groupBox2.ResumeLayout(false);
            this.groupBox2.PerformLayout();
            this.groupBox3.ResumeLayout(false);
            this.groupBox3.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.TextBox tb_userName;
        private System.Windows.Forms.TextBox tb_AuthName;
        private System.Windows.Forms.TextBox tb_Password;
        private System.Windows.Forms.TextBox tb_Domain;
        private System.Windows.Forms.TextBox tb_OutbandProxy;
        private System.Windows.Forms.TextBox tb_PhoneLineState;
        private System.Windows.Forms.TextBox tb_displayName;
        private System.Windows.Forms.Button btn_Unregister;
        private System.Windows.Forms.Button btn_Register;
        private System.Windows.Forms.CheckBox cB_RegReq;
        private System.Windows.Forms.Label label7;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.GroupBox groupBox2;
        private System.Windows.Forms.Button btn_Disconnect;
        private System.Windows.Forms.Button btn_Connect;
        private System.Windows.Forms.Button btn_Compose;
        private System.Windows.Forms.TextBox tb_CameraURL;
        private System.Windows.Forms.Label label8;
        private System.Windows.Forms.GroupBox groupBox3;
        private System.Windows.Forms.TextBox tb_CallState;
        private System.Windows.Forms.Label label11;
        private System.Windows.Forms.Button btn_HangUp;
        private System.Windows.Forms.Button btn_Call;
        private System.Windows.Forms.TextBox tb_NumberToDial;
        private System.Windows.Forms.Label label10;
        private System.Windows.Forms.Label label9;
    }
}

Code 2 - GUI example in C#

DISCLAIMER: Please note that the following features will only work if your IP camera supports the given function. You should check the user manual of your IP camera to make sure it supports the feature that you wish to implement in C#.

Related Pages

FAQ

Below you can find the answers for the most frequently asked questions related to this topic:

  1. How can I get the URL of the camera?

    You can get the URL from the producer of the camera. (In the 10th tutorial you can find information on how to create an own IP camera discoverer program.)

  2. I have not managed to build the solution. How to solve it?

    • Please set the Target framework property of the project to .NET 4.0.
    • You should add the OzekiSDK.dll to the references of the solution.
    • Please import the missing classes.
  3. The registration was unsuccessful. Why?

    • Please make sure your PBX is configured properly.
       You should check whether the dialed number is valid.
    • Please make sure your registration data are valid.