Click here to Skip to main content
15,867,568 members
Articles / Desktop Programming / Windows Forms

Voice and Text Conferencing Library

Rate me:
Please Sign up or sign in to vote.
5.00/5 (12 votes)
14 Feb 2010CPOL4 min read 62.5K   14.8K   59   6
A library for creating a voice and text conferencing application
ConferenceServer

ConferenceClient

Introduction

This Library was a part of my final year project. I have searched a lot on the web related to voice conferencing in C# but I couldn't find anything useful so I decided to modify peer to peer voice chat code that I found on CodeProject named “A Voice Chat Application in C#” into Voice conferencing. It also contains Text Conferencing feature that helps programmers to build conferencing software.

Voice Conferencing is based on client server architecture. Voice Conferencing Server uses two servers one for managing client (e.g. adding and removing client) and the other to handle communication. Voice Conferencing Client also uses two clients, one for entry and exit and the other for communication. Text Conferencing also uses client/server architecture. Text Conferencing server utilizes one TCP Server and Text Conferencing Client is based on a TCP client.

The main feature of this Conferencing Library is that it provides the complete implementation of conferencing work. Programmers just have to use its predefined methods and events in their code.

Using the Code

Voice Conferencing

VoiceConferencingServer class handles all work related to Voice Chat at the server side. Its constructor takes three arguments:

C#
public VoiceConferencingServer(String Name,int HandlingPort,int CommunicationPort)
  1. Server Name (String)
  2. Handling Port (this port is used for handling Clients entry and exit in Voice Chat Server)
  3. Communication Port (all the voice communication is done through this port)

VoiceConferencingServer class contains two events related to User Handling and four methods related to voice conferencing.

C#
interface VoiceConferencingServer {                  
       //User Handling Events             
       event VoiceChatServer.UserAddedEventHandler ClientAdded;                 
       event VoiceChatServer.UserRemovedEventHandler ClientRemoved;
       //Methods    
       void InitializeCall(object sender);   
       void UninitializeCall(); void Mute(); 
       void Unmute(); 
       }

ClientAdded Event is raised when a new Client is logged into the voice server. It uses UserArgs class as argument.

ClientRemoved Event is raised when a new Client is logged out to the voice server. It uses UserArgs class as argument.

InitializeCall Method takes one argument “Form control”. This method starts both the user handling and voice communication server.

UninitializeCall Method disposes servers and terminates all communication between client and server.

Mute Method is used to mute server voice.

Unmute Method is used to unmute server voice.

VoiceConferencingClient class handles all work related to Voice conferencing on client side. Its constructor takes four arguments:

C#
public VoiceConferencingClient
	(String _ServerIP,String Name,int HandlingPort,int CommuncationPort)
  1. _ServerIP (Server IP Address)
  2. Name (Client Name)
  3. Handling Port (this port is used for handling logged in and logged out process in VoiceConferencingClient)
  4. Communication Port (All the voice communication is done through this port)

VoiceConferencingClient class contains four methods related to voice conferencing.

C#
interface VoiceConferencingClient { 
          void InitializeCall(object sender);     
          void UninitializeCall(); 
          void Mute(); 
          void Unmute(); 
          }

InitializeCall Method connects to server and starts voice conferencing between client and server.

UninitializeCall Method disposes clients and terminates all communication between client and server.

Mute Method is used to mute client voice.

Unmute Method is used to unmute client voice.

Text Conferencing

TextConferencingServer class handles all work related to Text conferencing on server side. Its constructor takes two arguments:

C#
public TextConferencingServer(int Port,String Name)
  1. Port (it is used to handle conferencing work)
  2. Name (Server Name)

TextConferencingServer class contains three events and two methods:

C#
interface ITextConferencingServer{  
       //Events                  
       event TextConferencingServer.ClientAddedEventHandler ClientAdded;           
       event TextConferencingServer.ClientRemovedEventHandler ClientRemoved;
       event TextConferencingServer.MessageEventHandler MessageRecieved;
       //Methods      
       void SendMessage(string mess, string reciever);
       void BroadcastMessage(byte[] message);
       }

ClientAdded Event is raised when a new Client is logged into the voice server. It uses UserArgs class as argument.

ClientRemoved Event is raised when a new Client is logged out to the voice server. It uses UserArgs class as argument.

MessageRecieved Event is raised when message is received on server. It uses MessageArgs class as argument.

SendMessage Method takes two arguments, one message that you want to send and second client name to whom you want to send.

BroadcastMessage Method takes one argument message that you want to broadcast to all connected users.

TextConferencingClient class handles all works related to Text conferencing on client side. Its constructor takes two arguments:

C#
public TextConferencingClient(String ServIP,int Port, String Name)
  1. ServIP (Server IP Address)
  2. Port (it is used to handle conferencing work)
  3. Name (Client Name, it should be unique)

TextConferencingClient class contains three events and one method.

C#
interface ITextConferencingClient{ 
          //Events 
          event TextConferencingClient.MessageEventHandler MessageRecieved; 
          event TextConferencingClient.UserAddedEventHandler UserAdded;
          event TextConferencingClient.UserRemovedEventHandler UserRemoved;
          //Methods
          void sendMessage(string message, string Reciever);
          }

ClientAdded Event is raised when a new Client is logged in to the voice server. It uses UserArgs class as argument.

ClientRemoved Event is raised when a new Client is logged out to the voice server. It uses UserArgs class as argument.

MessageRecieved Event is raised when message is received on server. It uses MessageArgs class as argument.

SendMessage Method takes two arguments, one message that you want to send and second client name to whom you want to send.

Prerequisite

You need to have DirectX installed in your PC, because this library use DirectX to capture sound and you also have to add DirectX’s DLL in your project. You can download it from Microsoft’s website.

References

  1. Voice Chat Application in C#
  2. Chat Application Using Asynchronous UDP sockets

Future Work

I am working on webcam conferencing and Remote Desktop and I hope it will be on CodeProject very soon.

History

  • 15th February, 2010: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer Technology Promotion International
Singapore Singapore
He is a Software Engineer working in Technology Promotion International.He has completed his BS(Software Engineering) from University of Karachi,Pakistan.he has scored 1st Position in the batch of 2008 in department of Computer Science and scored 2nd Position in faculty of Science.
He has been working in Technology Promotion International since June 2008. Here,he has worked on many Projects and learned many different technologies like WPF, Silverlight, LINQ and many more.His major expertise are in C#,ASP.NET,Crystal Report,SQL Server.

Comments and Discussions

 
Questionvideo and audio conference using vb.net Pin
Member 997221820-Apr-13 6:45
Member 997221820-Apr-13 6:45 
Questionvoicecall Pin
Grishma Doshi21-Feb-12 22:10
Grishma Doshi21-Feb-12 22:10 
Questionhow to run Pin
pankajm324-Feb-11 19:03
pankajm324-Feb-11 19:03 
GeneralConferencelibrary Pin
pankajm323-Feb-11 23:21
pankajm323-Feb-11 23:21 
hi ,can you please give more details about the codec and any compression technique if used so in voiceconference part of the application.
Questionarabic support Pin
leonkennedy5-Feb-11 8:34
leonkennedy5-Feb-11 8:34 
GeneralHi Pin
andersonguilherm19-Jul-10 22:16
andersonguilherm19-Jul-10 22:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.