DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Elevate your data management. Join a lively chat to learn how streaming data can improve real-time decision-making, and how to reduce costs.

Platform Engineering: Enhance the developer experience, establish secure environments, automate self-service tools, and streamline workflows

Build Cloud resilience. High-profiled cloud failures have shown us one thing – traditional approaches aren't enough. Join the discussion.

Data Engineering: The industry has come a long way from organizing unstructured data to adopting today's modern data pipelines. See how.

Avatar

Sacha Manji

Orlando, US

Joined Jan 2015

Stats

Reputation: 0
Pageviews: 8.0K
Articles: 1
Comments: 0
  • Articles

Articles

article thumbnail
How to make SIP video calls in C#
while searching on the internet on how to make sip video calls using c#, i recognised that there aren’t any brief and straightforward tutorial in this topic. i found multi-page articles (sorry, but some of them are full of bullsh*t) and neverending forum threads, but none of them provided me complete solution. therefore, i undertook to create a short and concise guide on how to make video calls in c# using the voip technology. look at the prerequisites: pbx: to be able to make and receive video calls you, a phone system (e.g. asterisk) is essentially needed. you need to add a new sip account in your pbx for this application. visual studio: this solution is based on a console softphone, so a new visual c# console application is just enough. voipsdk.dll: i used prewritten voip components to implement the sip video calling feature. the necessary .dll file can be found on this website: c# voip stack . it should be added to your references. test phone: to test your application you can use any voip phone stat supports video calling (e.g. bria softphone). now take a look at the code. as you can see below, just a few lines of c# code are enough to connect the application to a pbx and to initiate a video call. firstly, you need to perform the sip registration tasks. you need to create a softphone and a phone line object, then you need to specify the sip account to be used for the phone line. these configurations are needed to be able to register to your pbx. after calling the registerphoneline method the regsitration procedure starts, and the application will indicates its status due to the mysoftphone_phonelinestatechanged method. the phonecallvideosender and phonecallvideoreceiver objects are responsible for video handling. to handle the usb webcamera, the webcamera object can be used. the calltype class is used to identify whether the call is a video or an audio call. test the program: to make a test call, provide valid sip account details for this console application to be able to register to your pbx, then specify a telephone number to be dialled (it can be an other sip account that has been previously registered to the pbx). after running the application, it dials the provided phone number automatically meanwhile sending the image of the webcamera. using system; using ozeki.media.mediahandlers; using ozeki.media.mediahandlers.video; using ozeki.voip; using ozeki.voip.sdk; namespace video_call { internal class program { private static isoftphone softphone; // 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 softphone = softphonefactory.createsoftphone(5000, 10000); // sip account registration data, (supplied by your voip service provider) var registrationrequired = true; var username = "444"; var displayname = "444"; var authenticationid = "444"; var registerpassword = "444"; var domainhost = "192.168.115.25"; var domainport = 5060; var account = new sipaccount(registrationrequired, displayname, username, authenticationid, registerpassword, domainhost, domainport); // send sip regitration request registeraccount(account); // prevents the termination of the application console.readline(); } static void registeraccount(sipaccount account) { try { phoneline = softphone.createphoneline(account); phoneline.registrationstatechanged += sipaccount_regstatechanged; softphone.registerphoneline(phoneline); } catch (exception ex) { console.writeline("error during sip registration: " + ex); } } private static void sipaccount_regstatechanged(object sender, registrationstatechangedargs e) { console.writeline(e.state); if (e.state == regstate.registrationsucceeded) createcall(); } static void createcall() { //numbertodial = "333"; //call = softphone.createcallobject(phoneline, numbertodial); var dialparams = new dialparameters("333"); dialparams.calltype = calltype.audiovideo; call = softphone.createcallobject(phoneline, dialparams); mediaconnector = new mediaconnector(); var phonecallvideosender = new phonecallvideosender(); var cam = webcamera.getdefaultdevice(); if (cam != null) { cam.start(); mediaconnector.connect(cam, phonecallvideosender); } phonecallvideosender.attachtocall(call); call.callstatechanged += call_callstatechanged; call.start(); } static void call_callstatechanged(object sender, callstatechangedargs e) { console.writeline("\ncall state: {0}.", e.state); } } }
January 26, 2015
· 7,992 Views

User has been successfully modified

Failed to modify user

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: