Interacting with Skype via DBus/GLib

Osmo Antero Maatta osmoma at gmail.com
Sat Dec 25 01:31:41 PST 2010


Hello and Merry Christmas.

I have created an audio-recording application in Linux. It can be 
automatically controlled by various MediaPlayers via the DBus. Now I 
want to add Skype interaction to that application.

But I have problems with setting the "Notify" signal right for Skype. 
The example code below (t1.c) never receives notifications from the Skype.

I have done a test code (t1.c) that uses GLib bindings to DBus.
The example is here: http://www.futuredesktop.com/tmp/t1.c

First, t1.c sends "NAME Audio-Recorder" string to the Skype. Skype will 
show a dialog box, and the user must accept the DBus connection. This is 
OK.
Then it sends "PROTOCOL 7" (or eg. PROTOCOL 2") string to the Skype and 
Skype accepts it.

But t1.c never receives notification signals/messages from the Skype!
This is how I set the notification signal. See the t1.c.

As far I know, the data from the Skype should be pure G_TYPE_STRING.

void skype_connect_dbus_signals() {
     DBusGConnection *dbus_conn = dbus_player_connect_to_dbus();

     proxy_receive = dbus_g_proxy_new_for_name(dbus_conn,
                                            "com.Skype.API",
                                            "/com/Skype/Client",
                                            "com.Skype.API.Client");

     dbus_g_proxy_add_signal(proxy_receive, "Notify", G_TYPE_STRING, 
G_TYPE_INVALID);

     dbus_g_proxy_connect_signal(proxy_receive, "Notify", 
G_CALLBACK(notify_handler), NULL, NULL);
}
--------------

I have found a Python scripts that works fine with Skype over DBus.
The script is here:  http://www.futuredesktop.com/tmp/py-test1.py

When running the Python test "py-test1.py",  the dbus_monitor shows this 
information. I can see correct data coming from the Skype.
$ dbus_monitor

  method call sender=:1.121 -> dest=:1.124 serial=20 
path=/com/Skype/Client; interface=com.Skype.API.Client; member=Notify
  string "CALL 64  XXX"

  method call sender=:1.121 -> dest=:1.124 serial=21 
path=/com/Skype/Client; interface=com.Skype.API.Client; member=Notify
  string "CALL 64 STATUS XXX"
--------------

How to setup the "Notify" signal in t1.c (using DBUs/Glib binding)?

The t1.c has instructions for how to compile and run it in Linux.  My 
system is Ubuntu Linux 10.10.
In Linux you will need libgtk2.0-dev, libdbus-1-dev and 
libdbus-glib-1-dev packages.

The t1.c also initiates the GDK threads library but that's nothing to do 
with this sample.

Thanks for all previous help.

Most kindly,
   Osmo Antero  (Moma)
   http://www.futuredesktop.org



More information about the dbus mailing list