Mou
Mou

Reputation: 16282

How to record & save skype call communication by c#

I am trying to record & save skype call communications using c#, but it is only working half-way. When I call a mobile number from skype and connects, then what they are saying is not being recorded, but what I am saying is being recorded & saved.

I just do not understand why the other person's voice is not getting recorded & saved. Here is my code:

public void Skype_CallStatus(Call call, TCallStatus status)
{
    int result = 0;
     Configuration config = 
         ConfigurationManager.OpenExeConfiguration
           (System.Windows.Forms.Application.ExecutablePath);
    if (status == TCallStatus.clsInProgress)
    {
        mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);
        mciSendString("record recsound", "", 0, 0);

    }
    else if (status == TCallStatus.clsFinished)
    {
        DateTime currdate = DateTime.Now;
        string datetime = string.Format("{0:yyyyMMddhhmmss}.wav", DateTime.Now);

        string wavfilename = "";
        if (config.AppSettings.Settings["VoiceRecordsPath"].Value != null)
        {
            //wavfilename = config.AppSettings.Settings["VoiceRecordsPath"]
            //.Value.Replace(",","") + "_" + CSRBusiness.User.Country + "_" 
            //+ datetime + @".wav";
            wavfilename = CSRBusiness.User.Country + "_" + datetime;
        }
        Directory.SetCurrentDirectory( config.AppSettings.Settings
            ["VoiceRecordsPath"].Value.Replace(",", ""));

        //result = mciSendString("save recsound " + wavfilename, "", 0, 0);
        result = mciSendString("save recsound d://test.wav", "", 0, 0);
        mciSendString("close recsound ", "", 0, 0);
        MessageBox.Show(result.ToString());
    }
   // MessageBox.Show(result.ToString());
}

Actually, voice is recorded and saved from this area:

else if (status == TCallStatus.clsFinished)
{

}

So I need help in figuring out what to do to record & save both ends of the call. Where can I do this in my code?

Upvotes: 1

Views: 1466

Answers (1)

David
David

Reputation: 34543

mciSendString doesn't know anything about Skype. All it is doing is recording what your computer's microphone picks up (which does not include the other user in Skype).

I would expect that you would have to get the audio stream from Skype itself for the other person in order to record it.

Upvotes: 2

Related Questions