Version 0 of Skype and Tcl

Updated 2006-01-17 13:32:50

EF The purpose of this page is to discuss ways to use the Skype API [L1 ] from Tcl. Skype is a well-known IP telephony (and now video conferencing) application that runs on all major platforms. To make it short, the Skype API uses simple textual commands (initial keyword followed by (a number) of parameters to let external programs controlling Skype in various ways. How to send these commands is OS dependent, but uses the various message passing APIs that are offered by Windows, Linux and Mac OSX. This is explained further in the documentation linked above.


My first initial attempts have been on Windows. On Windows, external programs send commands to Skype through sending WM_COPYDATA messages to the Skype Window (and Skype will answer the same way). There are both synchronous and asynchronous commands and your program should be able to receive commands and information from Skype at any time. One good program for understanding the Skype API and running some example tests is SkypeTracer [L2 ].

I could not find any easy way to send (and receive) WM_COPYDATA messages from Tcl, so I went for using an external component for controlling Skype. ActiveS [L3 ] is an ActiveX layer around the Skype API that provides a higher level of abstraction. What I have succeeded in doing so far are simply a number of interactive proof-of-concept examples. ActiveS, once installed, makes available a COM object called SKYPEAPI. This object can easily be called from tcom. ActiveS comes with its own documentation, and most of its functionality is available through the Access class. The piece of code below, meant to be run line by line from a command prompt, will initiate connection to Skype, call me and hang up after a while.

 package require tcom
 # Get a reference to the Access class in the SKYPEAPI COM object installed by ActiveS
 set skype [::tcom::ref createobject "SKYPEAPI.Access"]
 # Connect to skype and wait for connection to succeed within 5 s.
 $skype ConnectAndWait 5000
 # Call a user (me but I'm off-line right now!)
 set call [$skype PlaceCall efrecon]
 # Hang up, when you don't want to talk to me anymore
 $call Status 7

Still, this relies on an external COM API and on an abstraction that perhaps is not suitable for Tcl. For example, ending a call through setting a call property to "7" feels a bit awkward. Perhaps is the raw API call through WM_COPYDATA messages a better approach anyhow.


Category Interprocess Communication Category Networking