Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Skype API Video Call

Tags:

c#

skype4com

I was working on a security monitor application and the best approach i found was Skype.

when a possible intrusion occurs the application calls a specified Skype ID which is probably my android phone i am done with all the image processing stuff. But i am stuck with this Skype API i wrote this piece of code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SKYPE4COMLib;


namespace SkypeCall
{
    class Program
    {
        static void Main(string[] args)
        {
            Skype skype;
            skype = new Skype("Skype4COM.Skype", "Skype_");

            Call call = skype.PlaceCall(SkypeID);
            call.StartVideoSend();
        }
    }
}

This initiates a voice call but in the call.StartVideoSend(); shows an error

 An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in SkypeCall.exe

Additional information:  CALL: Action failed

i even tried this but i guess that's old API and couldn't get anything out of it. And not even by sending commands .

if somebody would help me out i'll be grateful.

like image 666
Anunay Inuganti Avatar asked Jan 30 '12 15:01

Anunay Inuganti


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

What is the full name of C?

In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr. Stroustroupe.

Is C language easy?

C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.

Is C programming hard?

C is more difficult to learn than JavaScript, but it's a valuable skill to have because most programming languages are actually implemented in C. This is because C is a “machine-level” language. So learning it will teach you how a computer works and will actually make learning new languages in the future easier.


1 Answers

I think you need to wait until the call is connected.

easiest way would be to test the call.Status

class Program
    {
        static void Main(string[] args)
        {
            Skype skype;
            skype = new SKYPE4COMLib.Skype();
            string SkypeID = args[1];
            Call call = skype.PlaceCall(SkypeID);
            do
            {
                System.Threading.Thread.Sleep(1);
            } while (call.Status != TCallStatus.clsInProgress);
            call.StartVideoSend();
        }
    }

You could also add an event, however I think this will fire on every call so unless you are only using it for this project it might be too much.

class Program
    {
        static string SkypeID = "";
        static void Main(string[] args)
        {
            Skype skype;
            skype = new SKYPE4COMLib.Skype();
            skype.CallStatus += new _ISkypeEvents_CallStatusEventHandler(skype_CallStatus);
            Call call = skype.PlaceCall(SkypeID);

            Console.ReadKey();
        }

        static void skype_CallStatus(Call pCall, TCallStatus Status)
        {
            if (Status == TCallStatus.clsInProgress && pCall.PartnerHandle == SkypeID) { pCall.StartVideoSend(); }
        }
    }
like image 111
Matt Avatar answered Sep 27 '22 16:09

Matt