For a consulting project, I’ve been playing around with getting the Skype public API to work with Microsoft Robotics Developer Studio (RDS) by building a DSS service that communicates with Skype.
I’ve gotten this working and wanted to use the Visual Programming Language to wire up a simple test of sending datagrams through Skype. So I just set up Skype on two machines, and one of them is running my RDS app to drive Skype through the API to send a datagram. I figured I didn’t really care what the other side did with the datagram, I just wanted to see if I could send it.
I found, though, a problem that is alluded to but not really explicitly stated in the Skype API documentation.
For an app-to-app connection to work, both sides have to establish the Application (in Skype terminology). In other words, both sides of the conversation have to have done a
CREATE APPLICATION Xyzzy
using the Skype API to create the “Xyzzy” application (note: application is Skype’s name for an app-to-app channel).
Once both sides have created the channel, one side (typically the originating caller) has to do a:
ALTER APPLICATION Xyzzy CONNECT otheruser
where Xyzzy is the application created and otheruser is the user you’re calling.
If one side creates the channel and the other (e.g. the recipient of the call) hasn’t, the channel doesn’t work. That’s because you’ll never get a response from the Skype API on the side that does create the channel giving the stream to use, i.e. you’ll never get:
OnReply to Command 0(): APPLICATION Xyzzy STREAMS otheruser:1
which tells you that “otheruser” can now receive communications through the app-to-app channel.
Like a lot of things in programming, this is obvious once you realize it – you can’t send through a channel unless both sides have established the channel. I was hoping I could test one side, but no go.
So I just had to write a bit of code to use the Skype public API on the other side (the machine I was calling) to create the channel. Note that it doesn’t appear that the guy receiving the call has to do the ALTER APPLICATION … CONNECT thing – it happens automatically when the other side does.