Home > Uncategorized > Skype Attach protocol 8

Skype Attach protocol 8

This is an update to my previous post about getting Skype to attach from the C# API, the problem is, that you should attach asynchronously, and handle the attachement event

((_ISkypeEvents_Event)skype).

AttachmentStatus += OurAttachmentStatus;
skype.Attach(8, false);
Where OutAttachementStatus can be as follows:
void OurAttachmentStatus(

TAttachmentStatus status)
{
Attached = false;

try
{
Debug.WriteLine(DateTime.Now.ToLocalTime() + ” Attachment Status: ” + skype.Convert.AttachmentStatusToText(status));
}
catch (Exception ex)
{
Debug.WriteLine(DateTime.Now.ToLocalTime() + ” Error: ” + ex.Message + ” Unable to write Skype attach status change”);
}

if (status == TAttachmentStatus.apiAttachAvailable)
{
try
{
skype.Attach(8, true);
}
catch (Exception ex)
{
Debug.WriteLine(DateTime.Now.ToLocalTime() + ” Error: ” + ex.Message + ” Unable to send Skype API Attach Request Message”);
}
}
else
if (status == TAttachmentStatus.apiAttachSuccess)
{
Attached = true;
WasAttached = true;
}
}

On first attach, it asks for permission from the locally running Skype Client, if granted, then it’s not asked for again,
and the attachment works alot faster.
You can then do cool stuff, like search for users:
foreach (User user in skype.SearchForUsers(“bob”))
I’ve found that “user” has the following ‘interesting’ properties:
Handle – banzigof
FullName – fiach
Country – France
City – strasbourg
CountryCode – fr
I’ve put together a skype contact browser, running off a MySQL database
The list is semi-random, so it’ll always show cities with over 500 users, but can randomly push smaller cities into the list.

select city,count(*) as count from skypeUsers group by city order by count(*) + rand()*500 desc
limit 50

Advertisement
Categories: Uncategorized
  1. May 6, 2011 at 4:13 am

    Here is an open source example of a “IVR for Skype” More Here

    Like

  2. Gags
    December 27, 2011 at 10:54 am

    Hi thanks for the above description.

    Actually i did this but still i am not able to attach.
    Problem:

    1) I have created on console Application – Working fine
    2) Created on windows service – Not able to attach (wait timeout exception)

    Is it like some port communication issue which occurs between the skype client and the windows service.

    Not able to figure out the exact behavior.

    regards

    Like

  3. appa
    May 27, 2015 at 1:48 pm

    Because the service runs under a different user than the desktop

    Like

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: