First let’s start at the end. If you are looking for free software to record Skype voice conversations, please skip to the bottom of this page and download the attached file. It contains a Windows Installer msi file and should install a recorder on your machine.

The rest of you, please keep reading :)

Skype uses a public API to listen and transmit messages to all programs on your computer. Messages are being transmitted via the native windows API and will require us to use some external method calls.In this article we are going to build a WPF client that will communicate with Skype, detect voice calls, redirect the incoming and outgoing streams into files and finally, create a complete conversation file.

SendMessageTimeout sends the specified message to one or more windows. Notice we have two overloads of SendMessageTimeout. One accepts a value to be sent and the other accepts a stuct. We are going to use the first overload to connect to Skype and the second to send API commands.

Receiving messages

In order to receive messages from Skype we need to register our window in the system. RegisterWindowMessage defines a new window message that is guaranteed to be unique throughout the system. The lpString can be used when sending or posting messages.

Next we need to intercept incoming messages. We can do that by attaching a native hook to the method WndProc. This method is available to us in windows forms; however, since we are using WPF we will need to explicitly attach it to our window:

Every time we receive a notification from Skype we need to check for beginning and end of voice calls and if a call that we are recording has ended we need to process the results.

Connecting to a working instance of Skype

Once have launched and logged into our account in Skype we need to try and connect to the working instance. We can do that by sending a message with the DiscoverAPI handle. Skype will pop up a dialog asking us if we allow a program to connect to Skype. Once we clicked allow we will get back a message indicating we are online:

Once we have discovered that a conversation has started we need to send two commands to Skype. The first command will redirect the incoming audio stream to a wave file and the second will do the same to the local microphone audio stream:

You can tell that the last step was to open the location of the conversation file for the user to inspect.

Conclusion

The Skype open API contains many more useful commands and you can see the complete documentation here. For your connivance I have attached the complete code to this example and a full msi installer for a working demo program.