Use these code-programs when debugging and testing Full Duplex application on the same PC, without internet connection. This software receives your packets to the Full Duplex client and then Full Duplex plays them.

Introduction

Hi friends, this is my second article in Code Project. Therefore, I’ll try to make it better.

The application is Windows 98.SE tested. When using Direct Sound objects, don’t forget to include in your application the following libs in your project settings - link:

dsound.lib

dxguid.lib

winmm.lib

It is very fashionable to talk about VoIP – Voice Over IP, but many of my friends think that this is too difficult to understand, how to urge? Therefore, I’ll try to explain VoIP from my side.

To make a commercial VoIP application is too difficult. For many of us, it is good to use some programs to talk in home networks with friends. Before starting to build a VoIP application, it was 2 years behind, I scraped with two main problems:

First – how to program network applications via TCP/IP?

Second – how to record and play waveform audio on my PC?

First problem was very easy to decide – read “Visual C++ 6” book published by SAMS. To solve the second problem, I encountered with hard to understand Windows Sound Programming. In the beginning, I started to read BIG BOOKS how to program DMA – Direct Memory Access and sound card direct programming using in/out ports, but soon I detected that this kind of programming is a very thankless job and I started to search additional ways to solve the problem. This is easily called Direct Sound. (DMA programming is a good choice, but only if you are programming device drivers or when programming on Assembler.)

Let me explain how I did it.

First, assume you and some of your friends have a need to talk inside a private network. This is easily to test applications at home network. Remember one! To develop and test network applications, there is no need to have a real Internet or TCP/IP WAN network. You can use “loopback” server with IP address 127.0.0.1 and some of the free ports between 3000 and 5000. (Before this, install TCP/IP protocols on your machine – using Start button, Control Panel, Networks and add new protocol – Microsoft TCP/IP.)

The main program is a full duplex 8KHz 8bit recording and playing waveform audio application that can send and receive captured audio data via Internet connection. In real conditions, to test the program, you must install and start 2 copies of this program on 2 different PCs in your network. One of these two programs must be set to work as a server, and another program must be set to work as a client. Start the server program to listen for network events and then activate another program to work as a client and try to connect with the first one (server). To make a connection, you must know the IP address, or name and port of the computer where the server program was started. If the IP and port are not the same as the IP and port of the server program, there will not be a connection.

When 2 programs are connected, you can use “8bit 8KHz DUPLEX” button to start recording and receiving the audio data from another computer. When you want to stop the recording and playing process, press the “Stop DUPLEX” button.

If you have no TCP/IP network at home, you can test the software using the second application. An echo receiver and transmitter program works as echo server that can be started on the same PC. In this case, you can connect your VoIP application to an already started echo server using IP -127.0.0.1 address and port 4000. Now, click on “8bit 8KHz DUPLEX” button and start to talk on the microphone, you will listen your voice echo on the headphones. You can make some experiments with this echo server even if you plan to test the program on a working TCP/IP network. This is a good choice, think about that, in some cases there will be difficulty to tell somebody to speak all day “1,2,3 check”.

Conclusions

VoIP program is working. In some cases, there will be problem with full duplex working regime. To start the program, you need a PCI full duplex sound card and DirectX installed on your PC. Software was tested on Windows 98 (CPU AMD 300MHz, 64MB RAM) machine with ALS4000 sound card and DirectX 8. There may be a problem to start the program on NT/2000 – these operating systems do not support 8KHz, 8bit Mono Full Duplex audio recording and playing without a proper DirectX version.

About software “FULL_DUPLEX”

Program contains 3 main classes: FULL_DUPLEX.dlg, CmySocket and Duplex.

First and the main class is Dlg class. CmySocket class takes care about network communications and Duplex class operates with waveform audio.

Duplex creates a streaming 1-second playing and recording audio buffer using functions HRESULT Duplex::CreateOutputBuffer() and HRESULT Duplex::SetBufferFormats(). This 1 second is divided by 15 different segments, and for each segment is specified NotificationEvent. So when the recording process comes to the next position in audio buffer, front segment can be read or written from the main program. This is done by thread UINT WaitThreadProc( LPVOID param ) in the FULL_DUPLEX.dlg class. Each time when WaitThreadProc detects that there are some audio data ready to be send via network, this function activates dlg->SendAudio(audio,lenght);. If there are some data to be written in audio buffer this is done using CopyMemory(receive_audio,dlg->audio_receive,500);. If there are no received data from network connection, we fill the playing buffer with silence using FillMemory(audio,500,128);. That is all.

Future features can be added later, so they will provide DSP – Digital Signal Processing techniques on the input and output audio signals, differential compression and decompression and noise filtering using low pass filters. This simple compression algorithm can provide effective decreasing in data transmitting rate from 8Kbits/s to 3.2Kbits/s.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

I need to develop a softphone to make calls to telephone my website users must be able to download this softphone and they should be able to call, and I need to track all the call information, and the customers balance and everything
the customers are able to get points in their account online,

Please help me I have searched a lot, and I could find some sourcecodes for softphone how can i develop a proxy application and, how can i communicate with them, do i need to keep this in a machine with public ip and i need to run this server application there

I was searching for the VOIP program & came across your program.I downloaded it & installed FullDuplex on 2 seperate PC's for one i started in server mode other in client mode & on client i used 8bit 8KHz Duplex but i cannot hear my voice on server.

For a complete idiot, if I want to learn about voip what do I do, I can use a computer, program in HTML and PHP. what are the very basics of Voip. I would be glad if some body would just make it simple..

I'm feed up with the bad sound quality I experience when using skpye. Could I use your program to talk to someone across the internet? I know that if we are behind a router then we'll have to setup port forwarding etc (which is easy).

I'm developing SIP Softphone. I'm have some deficulties in detecting voice and cancelling echo. Who can help me? please send to email: dongpd@cdit.com.vn. I'll have special gift for person who help me
Thanks

Dear Petrov!
I am trying to apply security to VoIP application, this is my graduation project in university. I have spent a lot of time in SRTP and MIKEY theory so that i don't have enough time for building the application. Unfortunately, i am not good at programming. So can you do me a favour to help me include the AES block code to the this application. Thanks a lot.
I am looking forward to your reply.
Please contact me at qphongkdt@gmail.com.

I am planning to shift my job from networking to s/w domain with VC++ knowledge. I would like to have some live projects to include in VC++ and i need to get trained on that. If anyone know any training center where they provide live projects in VC++ and give some training located at bangalore, Please send me the details to my mail id sandeepeie@gmail.com.

I would like to get training on specific live project where i can learn all the necessities of that projects. What the classes used in the project. I need to include in my resume about the project. I am interested in doing a project in VC++ MFC.

I know VC++ concepts. I need a training on a project specific. Please mail me with the details to my mail id sanei05@gmail.com

I need stack development protocol of ITUT H323 standard for transmitting voice over data network. An IP Phone, which works on top of H323 protocol stack, need to be developed in OCX form as well as an applciation.

I am an MCA student. I came across this link while searching a project on VoIP. I tried to run it on my PC, but errors occur. Some of them are:
fatal error LNK1104: cannot open file 'dsound.lib'
cannot find file 'afxwin.h'
I have to submit my academic project within a month.so plz send me the whole project and also how I can deal with the errors.

dear friend ,
i am also a member of codeproject.com....
i saw your request for voip project. i also have the same academic project to be submitted. i have already crossed my deadline . so if you have got the code please forward to my mail id cmrnit@yahoo.co.in

I've succeeded in finding some code of the sort I wanted. Still some errors exist. If u r luking for a custom VoIP dailer, just look into www.vaxvoip.com there u'll find some sample codes. keep it as a base n develop ur version frm it.