User:Magick777/Adventures with D-Bus

(New page: This page started because I'm trying to figure out D-BUS, as a relative newbie to Python and Telepathy, and the documentation is, shall we say, "fragmented". All the D-BUS recipes on the W...)
(Step 1: dbus-monitor)
Line 54: Line 54:
     uint64 1284595510
     uint64 1284595510
     string ""
     string ""
 +
 +
From this, we can deduce that:
 +
 +
# we need to make a method call over D-BUS to initiate the SIP call
 +
# we need to send it to dest=org.freedesktop.Telepathy.AccountManager
 +
# our path is /org/freedesktop/Telepathy/Account/ plus SofiaSIP account path
 +
## which can be found via "mc-tool list" (package libmissioncontrol-utils)
 +
# our interface is com.nokia.Account.Interface.ChannelRequests
 +
# the action we must take on that interface is to Create (a new channel)
 +
# for which we must supply an array of dicts, a number and an empty string
 +
## TargetHandleType is 1
 +
## ChannelType is StreamedMedia
 +
## Target ID contains our destination SIP address or phone number

Revision as of 00:22, 16 September 2010

This page started because I'm trying to figure out D-BUS, as a relative newbie to Python and Telepathy, and the documentation is, shall we say, "fragmented". All the D-BUS recipes on the Wiki don't seem to include a simple way to place a call via the sofiasip client. The Telepathy documentation speaks to a vague architecture, not to my N900's implementation of it, and seems better for someone who wants to write a whole new interface than someone who just wants to use an existing one. I've read more source code and more forum posts than you can shake a stick at and I'm still none the wiser.

So, this is a generic HOWTO for newbies (written by one) on how to track down an existing application's behaviour on D-BUS and replicate it. Work in progress September 2010.

Step 1: dbus-monitor

After some playing around with dbus-monitor, I've established that when I make a SIP call via the inbuilt Phone application, the first thing that happens on the session bus is:

method call sender=:1.121 ->
dest=org.freedesktop.Telepathy.AccountManager
serial=439
path=/org/freedesktop/Telepathy/Account/sofiasip/sip/_31030137_40sipgate_2eco_2euk0;
interface=com.nokia.Account.Interface.ChannelRequests;
member=Create
   array [
      dict entry(
         string "org.freedesktop.Telepathy.Channel.TargetHandleType"
         variant             uint32 1
      )
      dict entry(
         string "org.freedesktop.Telepathy.Channel.TargetID"
         variant             string "sip:50000@sipgate.co.uk"
      )
      dict entry(
         string "org.freedesktop.Telepathy.Channel.ChannelType"
         variant             string "org.freedesktop.Telepathy.Channel.Type.StreamedMedia"
      )
   ]
   uint64 14701758
   string ""

and, for a call to a PSTN number, via a different SIP account:

method call sender=:1.191 ->
dest=org.freedesktop.Telepathy.AccountManager
serial=500
path=/org/freedesktop/Telepathy/Account/sofiasip/sip/_330147398_40sip_2evoipfone_2eco_2euk0; 
interface=com.nokia.Account.Interface.ChannelRequests; 
member=Create
   array [
      dict entry(
         string "org.freedesktop.Telepathy.Channel.TargetHandleType"
         variant             uint32 1
      )
      dict entry(
         string "org.freedesktop.Telepathy.Channel.ChannelType"
         variant             string "org.freedesktop.Telepathy.Channel.Type.StreamedMedia"
      )
      dict entry(
         string "org.freedesktop.Telepathy.Channel.TargetID"
         variant             string "08081703703"
      )
   ]
   uint64 1284595510
   string ""

From this, we can deduce that:

  1. we need to make a method call over D-BUS to initiate the SIP call
  2. we need to send it to dest=org.freedesktop.Telepathy.AccountManager
  3. our path is /org/freedesktop/Telepathy/Account/ plus SofiaSIP account path
    1. which can be found via "mc-tool list" (package libmissioncontrol-utils)
  4. our interface is com.nokia.Account.Interface.ChannelRequests
  5. the action we must take on that interface is to Create (a new channel)
  6. for which we must supply an array of dicts, a number and an empty string
    1. TargetHandleType is 1
    2. ChannelType is StreamedMedia
    3. Target ID contains our destination SIP address or phone number