"Hello, Skype? It's me .Net... Can I record you?"
- Posted: Sep 07, 2011 at 6:00 AM
- 10,515 Views
- 3 Comments
I don't know about you, but there's some I love about being a coder. It's when I see an existing application that I can extend, connect to, link with, improve. When I say to myself, "I really wish this app, could do X" and then realize I might be able to actually make the app do "X" myself! The feeling of creation and power is what keeps me coming back to my keyboard...
Today's post is like that. Gal Ratner looked at Skype and seemed to say, "I wish I could record the calls I make with Skype... I bet that would be some cool code..."
Not only did he do it, but he's shared it with us too. ![]()
How to record Skype voice conversations
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.Let’s start by including the necessary external methods:
...
Here's a snip of the code from the post... What I find interesting is how the commands are sent to Skype. It's not the kind of thing you normally see in a COM or .Net API (because it's not... funny that)
public static string RecordOutputCommand = @"ALTER CALL {0} SET_OUTPUT FILE=""{1}.output""";
public static string RecordInputCommand = @"ALTER CALL {0} SET_CAPTURE_MIC FILE=""{1}.input""";
private void RecordButton_Click(object sender, RoutedEventArgs e)
{
// Fill in the new conversation file name
string conversationFile = String.Format(Utils.SkypeConversationsFile, Utils.SkypeConversationsFolder, Utils.CurrentCallNumber);
FileNameTextBox.Text = conversationFile;
try
{
if (!Directory.Exists(Utils.SkypeConversationsFolder))
Directory.CreateDirectory(Utils.SkypeConversationsFolder);
}
catch (Exception ex)
{
MessageBox.Show("Cannot create directory " + Utils.SkypeConversationsFolder + ". " + ex.Message);
}
// Start recording
if (RecordButton.Content.ToString() == "Start Recording")
{
string recordOutputCommand = String.Format(Utils.RecordOutputCommand, Utils.CurrentCallNumber, conversationFile);
string recordInputCommand = String.Format(Utils.RecordInputCommand, Utils.CurrentCallNumber, conversationFile);
NativeCalls.SendSkypeMessage(recordOutputCommand);
NativeCalls.SendSkypeMessage(recordInputCommand);
RecordButton.Content = "Stop Recording";
}
else
{
// Stop recording
string recordEndOutputCommand = String.Format(Utils.RecordEndOutputCommand, Utils.CurrentCallNumber);
string recordEndInputCommand = String.Format(Utils.RecordEndInputCommand, Utils.CurrentCallNumber);
NativeCalls.SendSkypeMessage(recordEndOutputCommand);
NativeCalls.SendSkypeMessage(recordEndInputCommand);
RecordButton.Content = "Start Recording";
MakeConversationFile();
}
}
Here's a snip from the Solution;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 [GD: Click through for the download...]
If you're interested in extending Skype, you might start here...
Here’s a few more links you might find interesting:
Comments Closed
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Great! Thanks!
Cool! Let me give this a try.
This looks fantastic, can't wait to try it.
Remove this comment
Remove this thread
close