How to develop a VoIP softphone in C# by using OZEKI VoIP SIP SDK This presentation describes what you should do – having done the SIP registration – to.

Slides:



Advertisements
Similar presentations
Hosted VoIP Service Special Calling Features Flash Services Feature Access Codes.
Advertisements

Facts about Welcome to this video from Ozeki. In this video I will present what makes Ozeki Phone System XE the Worlds best on-site software PBX for Windows.
Lectures on File Management
The Web Warrior Guide to Web Design Technologies
KX-NS1000 Initial Set Up For step by step : 16 May,
Copyright © Blue-Wireless Pty Ltd 2005 SoftBX MS Outlook™ SoftPhone & Operator Training for Installation & Setup/User Guide.
Ozeki Informatics Ltd. | | info.ozekiphone.com | Ozeki Informatics Ltd. | | +36.
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering 3 October 2007.
1 Flash Programming Introduction Script Assist. 2 Course Description This course concentrates on the teaching of Actionscript, the programming language.
M3903 Enhanced Telephone The M3903 Enhanced Telephone is a multi-line digital phone supporting up to four lines and/or features. The productivity- enhancing.
Voice over internet protocol (VOIP) November, 2007 SIM Mobile Services Ltd Phone , Mobile ,
Welcome u How to use your Phone Effectively u Telephone Features u Voice Messaging Features.
Responding to an Everbridge Notification. Internet based notification system available 24/7/365 Multijurisdictional emergency and non-emergency notifications.
SMS Gateway OZEKI NG Document version: v Adding SMS functionality to SysAid.
Telephone Training M3904 Telephone Set IT Support Center
Welcome u How to use the new NCAR telephone system u Telephone Features u Voice Messaging Features.
Software Development. Chapter 3 – Your first Windows 8 app.
Go to our website, and click on the eMedia Catalog link To find books, either click on the advanced search (which I will.
Chapter 2 (Horstmann’s Book) – Part 2 The Object-Oriented Design Process Hwajung Lee.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
Lab 8 – C# Programming Adding two numbers CSCI 6303 – Principles of I.T. Dr. Abraham Fall 2012.
DS200 IDEA GENERAL STRUCTURE. PURPOSEPURPOSE The purpose of this presentation is to explain the setup and the use of DS200 IDEA application.
Copyright ©: SAMSUNG & Samsung Hope for Youth. All rights reserved Tutorials Software: Building apps Suitable for: Advanced.
Welcome u How to use the new NCAR telephone system u Telephone Features u Voice Messaging Features.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Panasonic Communications Co., Ltd. Communication Network Company
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
C# Tutorial -1 ASP.NET Web Application with Visual Studio 2005.
Welcome u How to use NCAR’s telephone system u Telephone Features u Voice Messaging Features.
Downloading and Installing Autodesk Revit 2016
Downloading and Installing Autodesk Inventor Professional 2015 This is a 4 step process 1.Register with the Autodesk Student Community 2.Downloading the.
Welcome u How to use the new NCAR telephone system u Telephone Features u Voice Messaging Features.
Object-Oriented Programming (Java), Unit 28 Kirk Scott 1.
Fall 2002CS 150: Intro. to Computing1 Streams and File I/O (That is, Input/Output) OR How you read data from files and write data to files.
Welcome u How to use the new NCAR telephone system u Telephone Features u Voice Messaging Features.
Files Tutor: You will need ….
Intermediate 2 Computing Unit 2 - Software Development.
REC [ ] How to implement CAMERA RECORDING for USB WEBCAM or IP CAMERA in C#.NET SOURCE CODE: ! Welcome to this presentation that explains.
Introduction to Avaya Unified Messaging Introduction to American University’s New Messaging System: Avaya Unified Messaging.
Broadcast your amazing pumpkin to your website Even ghosts, goblins, monsters and pumpkins need to call somebody in 3D 1/9.
Step to join public session - Register 1.View all session in the month. 2.Then select any topic what you’re interested 3.Click any link which you will.
How to start software development for your webcam & IP camera in C# Welcome to this video that will explain you briefly how to get started on ONVIF webcam.
Using your ENA Connect Phone Polycom IP 321/331/335.
How to make an Interactive Voice Response (IVR) using an OzML script This slideshow is intended to be a great explanation on how to develop an Interactive.
Using your ENA Connect Phone Polycom IP 650/ Getting to know your IP 650/670 Soft Keys Shortcut to call logs Menu navigation arrows = select X =
How to create your Own Alarm System This is the next lesson of Ozeki Video Guide. Now you can learn how you can build your own alert system with Ozeki.
Introduction to Avaya Unified Messaging Introduction to American University’s New Messaging System: Avaya Unified Messaging.
How to develop a VoIP softphone in C# that enables SIP Instant Messaging (IM) This presentation describes how to create a softphone in C# that allows you.
How to develop a VoIP softphone in C# by using OZEKI VoIP SIP SDK This presentation demonstrates the first steps concerning to how to develop a fully-functional.
Page 1 Mobile Dialer – Highly Reputed VoIP Dialer with fully customized Softphone Call Us
CWA 3105 Presents At&t Connect for Windows pc This will be a quick set up guide for our new virtual meeting program We are the ELITE to have this trial.
Perform a complete mail merge Lesson 14 By the end of this lesson you will be able to complete the following: Use the Mail Merge Wizard to perform a basic.
7961 interface overview Line keys & speed dials
Unit 2 Technology Systems
By Asma Hamad Alharbi.
Welcome to Customer Interaction Center (CIC) Client and Phone Training
Development Environment
Cisco 7841 IP Telephone Features and Functionality Unity Voic
Get the most out of your call center
Computer Programming I
“IMO is a messaging and free video calling app.”
Chapter Eleven Handling Events.
IP Broadcasting System
Progress leisure OCR GCSE ICT.
File Handling Programming Guides.
Introduction to TouchDevelop
Smart Personal Console (SPC)
Simple, Flexible and Easy-to-Scale Cloud PBX Solution
ClicktoHuddle Training
Connect Client Training
Presentation transcript:

How to develop a VoIP softphone in C# by using OZEKI VoIP SIP SDK This presentation describes what you should do – having done the SIP registration – to develop a fully-functional softphone in C# in the most simplest way - by using the previously written components of Ozeki VoIP SIP SDK. Part 2 Part 1: SIP registration  Part 2: Making and receiving calls Part 3: Controlling the calls 1/19

Previously on this series Windows PC.NET compatible development kit (e.g. MS Visual Studio) installed on your PC.NET Framework installed on your PC Ozeki VoIP SIP SDK installed on your PC In order to build a VoIP softphone application in C# you will need the followings: 2/19 Download free example source code for this project (Part 1) from ! After studying the previous tutorial, you need be familiar with adding VoIP components to your references and creating a Softphone class that provides a softphone object to the user using the input setups. Now you have a console window which interacts with the user and handles your softphone with the provided opportunities. Download free example source code for this project (Part 2) from !

In the ‘using section’ you need to add some extra lines, as well as: Without these lines you would have to use the namespace information as a label for all tools of the SDK. Source code analysis using Ozeki.Media; using Ozeki.Media.MediaHandlers; using Ozeki.Network.Nat; using Ozeki.VoIP; using Ozeki.VoIP.SDK; 3/19 Classes: Softphone.cs is used to introduce how to declare, define and initialize a softphone, how to handle some of the Ozeki VoIP SIP SDK's events and how to use some features. So the aim is creating a ‘telephone software’, which has the same functionalities (or much more), as an ordinary phone’s. You will use the Program.cs class to create a new softphone, so you can use the functions and listen to the events placed here.

The microphone will be connected to the mediaSender, and the speaker will be connected to themediaReceiver with the help of the connector object. The mediaSender and the mediaReceiver media handlers will be attached to the call object, this step is necessary if you would like to send and receive media data (for example: voice) during the communication. This sender and receiver object can be connected to different devices, media handlers as well. You also need a variable to indicate the incoming call: Objects (1) IPhoneCall call; Microphone microphone; Speaker speaker; MediaConnector connector; PhoneCallAudioSender mediaSender; PhoneCallAudioReceiver mediaReceiver; bool incomingCall; In the guide you have created a softphone and a phone line object from the ISoftPhone and the IPhoneLine interfaces. Now, you need to create some new objects: 4/19

In a constructor, you need to initialize the following new objects, variables: Since your softphone has no any incoming call yet, you need to set the variable to ‘false’. Objects (2) microphone = Microphone.GetDefaultDevice(); speaker = Speaker.GetDefaultDevice(); connector = new MediaConnector(); mediaSender = new PhoneCallAudioSender(); mediaReceiver = new PhoneCallAudioReceiver(); incomingCall = false; 5/19

There are some methods to help your later work, for example the methods designed to start and stop the devices, to connect them with the other media handlers, etc. Let's start with the device starter/stopper ones. In this example microphone and a speaker were used, but you can also use many other devices as objects, e.g. a webCamera. As you can see, this method checks first if there is a device to be started or not. After that, it starts the existing device with a single command. The method which stops them works on a similar way, with the Stop() command of the device's object. Starting and stopping the devices if (microphone != null) { microphone.Start(); } 6/19

Connecting the media handlers (1) if (microphone != null) { connector.Connect(microphone, mediaSender); } In order to send voice through the microphone to the other client's speaker, you need to connect the correct devices. Please note that it is possible to use several different kind of media handlers with the Ozeki VoIP SIP SDK, for example there is a similar way to connect a WaveStreamPlayback or anMP3Playback object to the mediaSender object, to play a.wav or an.mp3 file into the call, as voice (and you can receive and record voices, videos as well, and there is much more). To connect the microphone object to the mediaSender object with the help of the connector object, use the following lines: 7/19

The first parameter of the connector is the source, and the second is the destination of the data stream. So, in case of speaker, it looks like: As it shows, the mediaReceiver sends the voice to the speaker. (There is method called ‘disconnector’, which closes the connection between the two media handlers with the Disconnect() method.) There is a way to close all of the connections with only one command: This line closes every connection. Connecting the media handlers (2) if (speaker != null) { connector.Connect(mediaReceiver, speaker); } 8/19 connector.Dispose();

In the source code, you can find two methods to help in subscribtion and unsubscribtion. Subscribe to the events: The first line: if the call state changes The second line: if an error occurs during the call. The method to unsubscribe from the events works similar to the subscriber (with the ‘-=‘ operator). Subscribing for the call events call.CallStateChanged += (call_CallStateChanged); call.CallErrorOccured += (call_CallErrorOccured); 9/19

If you would like to be notified when there is an incoming call, you need to set an event at the initialization of the softphone: When the event notifies that there is a call waiting to be accepted, it sets the call object, and subscribes to the events of the call with the help of the previously written method. It also sets the value of the incomingCall variable to ‘false’ to indicate: there is no other call waiting. Listening to the incoming calls softphone.IncomingCall += softphone_IncomingCall; 10/19

Maybe this is the main part of your softphone within the Softphone class. If the call state changes, an event occurs. You can handle these events within the Softphone.cs and the Program.cs file as well. In this example two states has been used by their name: Handling the call states (1) CallState.Answered CallState.InCall 11/19

The ‘Answered’ state occurs, when the call is being answered, and the ‘InCall’ state occurs during the call, so if there is an active communication. To understand the difference between the two cases: the ‘Answered’ state can occur only once per call, but we can enter into the same call again and again (for example if we put the call on hold, and then take the call off hold). In the ‘Answered’ state, we need to: Start the devices, with the help of the previously written method Attach the media handlers to the call Please note that we need the devices to be connected to the media sender and receiver objects, but it's already done at the initializationof the softphone. In this example you need these lines in order to attach the media handlers to the call: Handling the call states (2) 12/19 mediaReceiver.AttachToCall(call); mediaSender.AttachToCall(call);

In the ‘InCall’ state, you need to: Start the devices with the help of the previously written method Please note that the media handlers are already set to the call In both cases, you subscribes to the call events when the call is made or received. More states can be used when the call ends: If the call ends, you can be notified about it as the IsCallEnded() method returns with a true value. For example it can occur, when an error occurs or the call enters into ‘Completed’ state, but we can handle them all in once. When the call ends, you need to: Stop the devices with the help of the previously written method. Detach the media handlers from the call Unsubscribe from the call events Finally, set the call objects to ‘null’ Handling the call states (3) 13/19

Making a call means creating a call object, subscribing to the call events and then call the Start() method of the call object. In the example the softphone checks first, if there is an already active call or not. If there is no active call, the you need to call the correct methods, illustrated above. To hang up the call, you can use the call object's HangUp() method. Making a call if (call == null) { call = softphone.CreateCallObject(phoneLine, numberToDial) ; WireUpCallEvents(); call.Start(); } 14/19

As you could see, when the variable, which indicates the incoming call, has been set to ‘true’, then there is a call to accept (so, your phone is ‘ringing’). In this example there is only text to notify if the phone is ringing. In order to let it ring with voice, you have a lot of options provided by the SDK or just by most of the programming languages. When you would like to accept a call, you need to set the value of the variable to ‘false’. In order to indicate that there are no incoming calls anymore, you need to accept the call with the Accept() method of the call object: To hang up the call, You can use the call object's HangUp() method. Accepting a call if (incomingCall == true) { incomingCall = false; call.Accept(); } 15/19

You can find a method, called ‘DispatchAsync(Action action)’ in the source file. This method is used to solve the thread blockings, because the ReadLine() methods would block the thread. Program.cs This class will introduce the usage of a softphone object, handles the console events, interacts with the user and uses the opportunities provided by the Softphone class. In this example, the softphone can accept calls automatically, and can call the number, given by the user. You can handle everything with separated methods. These methods are communicating with each other, and making the source code more understandable and reusable. Solving the Thread blockings 16/19

The first step is the initialization the softphone you have created. To do this, you need to call an initializer method. You also need to subscribe to the call events. For this purpose you need the following lines: Now you are listening to the phone line and the call states or errors and to the incoming calls. This method will be called in the Main() method. Initialization (1) mySoftphone = new Softphone(); mySoftphone.PhoneLineStateChanged += mySoftphone_PhoneLineStateChanged; mySoftphone.CallStateChanged += mySoftphone_CallStateChanged; mySoftphone.IncomingCall += mySoftphone_IncomingCall; mySoftphone.CallErrorOccurred += mySoftphone_CallErrorOccurred; 17/19

Handling an error, occurred during the call By subscribing to listening to the call errors, you can notify the user about the occurred errors with a simple message in this example. Handling if there is an incoming call If there is an incoming call, your softphone notifies the user about that and automatically accepts the call with the help of the previously written method of the softphone. Handling the call's states You can reach the call states, since you are listening them. When the call ends, you calls the method that is asking the user about a number to be dialled. There are more call states, but in this tutorial you will need only this one. Handling if the registration succeeded In the previous example (that introduces how to register to a PBX with a SIP account), you could learn how to handle the states of the phone line. You've notified the user about the success, and now you are telling the user to dial a number by calling a method to ask about it. Asking the user about a number to be dialled In this example, the phone asks the user about a number to be dialled and then stores that number as a string. You need to store the number as a string value, since it can contain special characters as well. Initialization (2) 18/19

Check the 3. part of the ‘How to develop a VoIP softphone in C# by using OZEKI VoIP SIP SDK’ tutorial series and get to know how to control the calls using such useful features as call holding, redialing, call transferring, etc.! After studying this tutorial, you need be familiar with reaching the media handlers, handling the devices and attachning them to the call object. Now you also know how to make and accept calls, and how to handle the call states and events. Part 2 Thank you for your attention! For more information please visit or send an to 19/19