Voice Communication via Network/Internet


This article was contributed by Zhaohui Xing.

Environment: Windows NT4/2000 and Visual C++ 5.0 (and greater)

This is the simplest prototype to demonstrate how to realize a basic Voice Communication via Internet/Network on PC platforms. The technique in this demo can be applied to develop the PC internet voice communication software, such as Internet Phone.

To save development time, I borrowed the idea of Client/Server design in Microsoft MSDN sample "GlabolChat". 

This sample has been tested in a intranet consisted of NT4.0 Server/Workstation and a LAN consisted of Win2000 Professional. The CPUs in the testing PC are at least  Intel P2 266 or faster, and SoundCard, Mic, Speaker are must.

In the tests, it can work smoothly in bi-directions voice talk with the a acceptable sound quality.

The basic system design

This sample contain two modules, Talkserver and Talkclient.

The basic system diagram is like:

System diagram

 

Server Module

Server module has two type sockets, server sockets and client sockets. One server socket supports a certain network protocol and listens the incoming connection with such protocol. When a client connection request comes, the server socket create a client socket to build the link with the client. The client socket works to receive the messages from its client, transit the message to peer client socket, then the peer client socket send the messages to the target client. The client socket also get the messages from the peer   socket and send these message to its client.  

 

Client Module

The user can use the client modules to communicate in voice with each other. The socket in the client is implemented as sending/receiving messages to/from the server.

The method to capture and transit sound data in client module is  building and runing a wave input device, when this wave input device records enough to size of the data buffer in its wave header structure, it notifies client instance. When the client receives the wave input device message, client retrieves the sound data in the wave input device buffer, then encodes the sound data into the voice communication message and sends to the peer (or target) client.

To play a voice message is similar. The client has a wave out device. After the client receive voice message from other client, it decodes the sound data from the message, put the sound data to the wave output device and drives it to play the sound. 

 

Change sound quality

By changing the wave device buffer and wave format type defined in vtDef.h, you can change the sound quality in some kind of levels. 

Downloads

Download the project - 253 Kb



Comments

  • Cool VoIP ActiveX controls !!

    Posted by hkhan on 03/09/2004 12:53am

    VaxVoIP are providing VoIP ActiveX , VoIP OCX , VoIP COM , VoIP DLL , VoIP LIB and VoIP CAB to enable your applications and Web pages to have PC-To-PC or Peer-To-Peer Voice Conversation over the Internet Protocol (VoIP). visit: www.vaxvoip.com

    • I want example VoIP

      Posted by vextra on 04/29/2005 04:36pm

      Thank You.

      Reply
    • i am doing o project on VoiP

      Posted by alok_kola on 03/07/2005 05:21am

      I need som help

      Reply
    Reply
  • What's the audio codec it uses ?

    Posted by Legacy on 01/16/2004 12:00am

    Originally posted by: Whatever

    Can anyone implement other better codecs in it ?

    Reply
  • How can 3 pc talk?

    Posted by Legacy on 12/24/2003 12:00am

    Originally posted by: TrustKoong

    How can 3pc talk in group? and sound very delay.
    

    Reply
  • Cool VoIP Controls Visit: http://www.vaxvoip.com

    Posted by Legacy on 07/29/2003 12:00am

    Originally posted by: Hasnat

    VAX Voip Component is the easiest way to enable your applications and Web pages to have Voice Conversation over the Internet Protocol (VoIP). The VoIP Controls package includes VoIP ActiveX (OCX), VoIP COM DLL, VoIP .LIB and VoIP Downloadable .CAB

    Reply
  • How to run this

    Posted by Legacy on 07/25/2003 12:00am

    Originally posted by: Venkat

    Hi Guys,
    Please tell me know to run this project.
    Do i need any hardware to rn this project.
    Please let me know.

    Thanks a lot for your help in advance.
    Thanks & Regards
    Venkat

    Reply
  • Error in preparing buffer when resetting!!

    Posted by Legacy on 04/18/2003 12:00am

    Originally posted by: Bryant

    Dear all:
    I always get two error codes, each of which are "Error in preparing buffer when resetting" and "Server Connection Dropped!", when trying to talk chat. My testing scenario is set as follows:
    PC A: run talkserver
    PC B and C: run talkclient
    All of these three PC with same OS at the same time, including windowsXP and windows2000.
    Is any idea about this and what kind of effort I can make to avoid the above problem and improve the performance?
    Thanks a lot!

    Reply
  • Bug fix for vtDef.h

    Posted by Legacy on 04/10/2003 12:00am

    Originally posted by: Jay Bowden

    I noticed that this #define needs parenthesis:
    
    

    #define SIZEVTMSGHDR 4*sizeof(BYTE)+sizeof(long) // The sum of m_ucIdentity,

    Should be:

    #define SIZEVTMSGHDR (4*sizeof(BYTE)+sizeof(long))

    What happens is when you take "X-SIZEVTMSGHDR" it
    expands to X-4+4 instead of X-(8)! Like
    in talkclientDlg.cpp line 620:

    // Get wave data buffer size
    m_uiBufLen = m_vtRecvMsgBuf.m_lLength - SIZEVTMSGHDR;


    Don't know what behavior may be caused by this.

    Thanks!

    Reply
  • gaurav from svits indore

    Posted by Legacy on 04/09/2003 12:00am

    Originally posted by: gaurav

    yet to see the project

    Reply
  • Echo: Use a Headset!

    Posted by Legacy on 03/14/2003 12:00am

    Originally posted by: Jay Bowden

    That's all.

    Reply
  • Nice Code But Memory Leaks

    Posted by Legacy on 12/17/2002 12:00am

    Originally posted by: Khalid Noor

    You are allocating memory with new but not releasing.
    m_vtMsgBuf = new VTMSG;

    one solution could be

    CTalkserverDlg::~CTalkserverDlg()
    {
    if(m_vtMsgBuf)
    {
    delete m_vtMsgBuf;
    m_vtMsgBuf = NULL;
    }
    }

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Managing your company's financials is the backbone of your business and is vital to the long-term health and viability of your company. To continue applying the necessary financial rigor to support rapid growth, the accounting department needs the right tools to most efficiently do their job. Read this white paper to understand the 10 essentials of a complete financial management system and how the right solution can help you keep up with the rapidly changing business world.

  • Corporate e-Learning technology has a long and diverse pedigree. As far back as the 1980s, companies were adopting computer-based training to supplement traditional classroom activities. More recently, rich web-based applications have added streaming audio and video, real-time collaboration and other new tools to the e-Learning mix. At the same time, the growing availability of informal learning tools--a category that includes everything from web searches to social media posts--are having a major impact on …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds