[Telepathy] how to start a audio (or video) the right way?

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Oct 19 03:33:41 PDT 2010

On Mon, 18 Oct 2010 at 21:45:50 -0400, Felipe Crochik wrote:
> After checking the documentation
> (http://telepathy.freedesktop.org/spec/org.freedesktop.Telepathy.Channel.Typ
> e.StreamedMedia.html#org.freedesktop.Telepathy.Channel.Type.StreamedMedia.In
> itialAudio) he found that "InitialAudio" and "InitialVideo" SHOULD be
> ignored by the connection manager if passed to ensureChannel.

Sorry, the wording in the spec might not be the clearest possible. The
intention is this:

* At the D-Bus level, there are two ways to make a channel: Create and Ensure.

  If you call CreateChannel("…TargetID": "smcv at example.com", ...), that means
  "I don't care if I'm already on a call to Simon - I want a brand new call,
  or if you can't achieve that, fail".
  If you call EnsureChannel("…TargetID": "smcv at example.com", ...), that means
  "Call Simon - but if I'm already on a call to Simon, just bring that window
  to the foreground instead".

  This works for all channel types, including Text and StreamedMedia (just
  replace "call" as appropriate). For some channel types (like file transfer)
  it doesn't really make sense to use Ensure, but to be consistent, you're
  still allowed to do the wrong thing :-)

  I suspect the Nokia UIs always use Ensure for Text and StreamedMedia
  channels - it's often what you want, in practice.

  If you don't have any "similar enough" channels open (for calls, a channel is
  "similar enough" if it's to the same contact on the same connection), Create
  is equivalent to Ensure.

* InitialAudio and InitialVideo let you initiate an audio or video call.
  If you CreateChannel with InitialAudio=TRUE, that means it initially has
  an audio stream; if you also set InitialVideo=TRUE, that means it initially
  has a video stream too.

* When you use EnsureChannel, the "ensure" part is considered to be more
  important than the values of InitialAudio and InitialVideo. So, if you're
  on an audio-only call to me, and your dialer calls EnsureChannel with
  InitialVideo=TRUE, the audio call UI will pop up, but it won't magically
  add a video stream. On the other hand, if you're not on a call to me at the
  moment, and you make the same EnsureChannel call, your new channel will
  initially have video (as if you'd used CreateChannel).

For historical backwards-compatibility, it is possible to make a StreamedMedia
channel with neither audio nor video. If you do that, the call UI will recover
by adding an audio stream, on the basis that a call with no streams is pretty
useless :-) (indeed, in most protocols you can't really start the call until
the first stream has been added).

(For your information, the D-Bus method the call UI will use to do that is

In Telepathy 1.0, StreamedMedia channels will be replaced by Call channels
(currently under development), and we'll avoid this sort of ambiguity by
requiring that every request for a Call has InitialAudio or InitialVideo or
both, and making requests that don't have either of those just fail.

> They are not ignored by spirit/skype at all and oddly enough they seem to
> affect how the channel was created just as one would expect/hope
> (initialvideo=video) - but after apparently starting as expected it fails! 

If you don't already have a "similar" channel open, they shouldn't be ignored;
they're only ignored if you do have a "similar" channel.

The spec says:
"SHOULD ignore these properties when checking whether it can return an
existing channel"
"these properties only become significant when the connection manager has
decided to create a new channel"

which is too subtle, but is the best I could come up with at the time.
I'll see if I can think of better wording.

> When InitialAudio is included the call to a skype account (e.g. fcrochik)
> works fine; a call to a phone number (e.g. +155511223344) will fail with
> "unable to establish connection" message after apparently starting to dial.
> When InitialVideo is included we get the skype video call window to show up
> but it fails before the connection is completed. It is clear that
> InitialVideo and InitialAudio are not ignored at all. 

I can't check, because the Spirit source code isn't public, but it
sounds as though Spirit might not deal with InitialAudio correctly when
calling a phone number. When you don't set InitialAudio, the call UI will
add audio by calling RequestStreams, which Spirit apparently supports

> In order to start an audio call should I just remove the "InitialAudio"
> line? It seems to work for every case.. 

It sounds as though that'd be a reasonable workaround on the N900, unless/until
you can get Spirit fixed.

> How should I proceed to start a video call? Can I do that using
> ensureChannel? (I have not tried to remove InitialAudio but leave
> InitialVideo. it would not make sense according to the documentation but
> would not surprise me if it works).

You should set both InitialAudio=TRUE and InitialVideo=TRUE. It'll
only work for protocols/contacts that can actually do video calls.
XMPP/Jabber/Google Talk is the protocol we usually use for development;
SIP and Skype should also work (but as you've noticed, Skype's harder to
debug, because you can't see the source code or the protocol stream).

In theory, setting only InitialVideo will start a video-only call (no audio!).
In practice, video-only calls make very little sense (unless you have a very
strange setup, like a security camera that can be accessed via XMPP),
and I suspect the call UI will add an audio stream as soon as it gets a chance.

> I would imagine that spirit/skype NOT ignoring the InitialAudio and
> InitialVideo is considered a bug but don't have any idea where to report.
> Should I report anywhere?

Spirit is Nokia-proprietary, so I assume it's part of the Maemo bug tracker?
I think the bug to report is that it fails to connect to phone numbers if
you say InitialAudio=TRUE, though.


More information about the telepathy mailing list