Getting Skype API to work with PHP over COM

|

Adam asked how to get the Skype API to work with PHP over COM. Sounded like another fun project so I thought what the heck, let’s give it a whirl. And I got it to work. Sort of.

Prerequisites…

  • a recent version of Skype for Windows (I’m using a recent internal developer version, which from the API perspective should be pretty close to the latest 2.6 beta)
  • installed Skype4COM manually. It’s not bundled with Skype. I’m using Skype4COM 1.0.0.22. Just download the zip, unzip and run “regsvr32 skype4com.dll”. And there’s a handy CHM reference in the zip.
  • using PHP5 (I’m on 5.1.6)
  • I’m on Apache2 (although I didn’t get to work it through the webserver)

The example that Adam refers to is actually the PHP COM example code from our developer zone. Just copypaste the example to a file and run it. It works fine but there’s a security quirk, and namely…

I only got it to work when manually run with commandline PHP, so that it runs in the current user security/desktop context. I didn’t get it to work when run through webserver. It can instatiate the COM object, but at the first “real” function call (if you try to retrieve some property from the Skype object or call a method) It either stalls totally and hangs until the PHP script times out, or it reports that Skype API is “not available”. I tried running PHP both as server module and CGI. I tried to run the Apache service as local system user, with or without access to desktop, or as myself. No luck. It can instatiate the COM but not get through to the Skype client. Gotta check with the engineers what’s up with that and if there’s any way around…

So however, if you run it with commandline PHP, it works. I’m getting some trouble because the call is placed but for some reason terminates after a few seconds, before it manages to fire any DTMF events. But it initializes the API fine and starts the call and reports the statuses.

3 Comments

Thanks for the help! I never would have tried using it from the command line, but I tried it and it works for me.

However, I think I need to get it to work from the web server, but I guess that’s a security issue.

Hello, Did you find a way to make the script work through a webserver ? Thanx

I haven’t done further experiments with this, so I don’t have a working version on the web server.

Leave a comment