Reputation: 28808
I would like to run a program when a Skype call ends, is there any way to detect such an action using C#.NET? Are there any libraries that can help me? I cannot find any!
Ideally, I would like to detect any VOIP type call starting/ending. Is this possible?
Upvotes: 1
Views: 637
Reputation: 4215
I guess so. You can use Skype4COM with the following code as a start point:
using System;
using System.Windows.Forms;
using SKYPE4COMLib;
namespace SkypeCall
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
InitializeSkype();
}
private void InitializeSkype()
{
s = new Skype();
_ISkypeEvents_Event events = s;
events.AttachmentStatus += OnAttachementStatusChanged;
events.CallStatus += OnCallStatusChanged;
s.Attach();
}
private void OnCallStatusChanged(Call call, TCallStatus status)
{
switch (status)
{
case TCallStatus.clsInProgress: break;
case TCallStatus.clsCancelled: break;
case TCallStatus.clsFinished: break;
case TCallStatus.clsRinging: break;
//.
//.
//.
}
// call.PstnNumber;
// call.PstnStatus;
}
private void OnAttachementStatusChanged(TAttachmentStatus status)
{
if (status == TAttachmentStatus.apiAttachSuccess)
{
attached = true;
}
}
private Skype s;
private bool attached;
}
}
and implement your logic inside OnCallStatusChanged method.
Upvotes: 0