Call1.Stream.I.Media — Telepathy D-Bus Interface Specification

# Interface Call1.Stream.Interface.Media

Interface Index (Compact) | Summary | Description | Methods | Signals | Properties | Types

### Methods

CompleteSendingStateChange | (u: State) | → | nothing |
ReportSendingFailure | (u: Reason, s: Error, s: Message) | → | nothing |
CompleteReceivingStateChange | (u: State) | → | nothing |
ReportReceivingFailure | (u: Reason, s: Error, s: Message) | → | nothing |
SetCredentials | (s: Username, s: Password) | → | nothing |
AddCandidates | (a(usua{sv}): Candidates) | → | nothing |
FinishInitialCandidates | () | → | nothing |
Fail | ((uuss): Reason) | → | nothing |

### Signals

SendingStateChanged | (u: State) |
ReceivingStateChanged | (u: State) |
LocalCandidatesAdded | (a(usua{sv}): Candidates) |
LocalCredentialsChanged | (s: Username, s: Password) |
RelayInfoChanged | (aa{sv}: Relay_Info) |
STUNServersChanged | (a(su): Servers) |
ServerInfoRetrieved | () |
EndpointsChanged | (ao: Endpoints_Added, ao: Endpoints_Removed) |
ICERestartRequested | () |

### Properties

SendingState | u (Stream_Flow_State) | Read only |  |
ReceivingState | u (Stream_Flow_State) | Read only |  |
Transport | u (Stream_Transport_Type) | Read only | Immutable |
LocalCandidates | a(usua{sv}) (Candidate_List) | Read only |  |
LocalCredentials | (ss) (Stream_Credentials) | Read only |  |
STUNServers | a(su) (Socket_Address_IP_List) | Read only |  |
RelayInfo | aa{sv} (String_Variant_Map_List) | Read only |  |
HasServerInfo | b | Read only |  |
Endpoints | ao | Read only |  |
ICERestartPending | b | Read only |  |

### Types

Stream_Flow_State | Enum | u |
Call_Stream_Candidate_Type | Enum | u |
Media_Stream_Base_Proto | Enum | u |
Stream_Component | Enum | u |
Stream_Transport_Type | Enum | u |
Candidate_Info | Mapping | a{sv} |
Candidate | Struct | (usua{sv}) |
Stream_Credentials | Struct | (ss) |

Added in 0.25.2. (as stable API)
Objects implementing this interface must also implement:

- im.telepathy.v1.Call1.Stream

### Description

This interface deals with how to connect a stream to an endpoint. It contains all that is required to describe the local endpoint, to succesfully establish a connection. While a call is established, one may try to connect to multiple remote endpoints at the same time. This is called forking in the SIP jargon. Informations related to the connections are on the Endpoint objects. Once the call is established, there MUST be a single endpoint left.

#### ICE restarts

If the CM wants to do an ICE restart, then the ICERestartPending property is set, and the ICERestartRequested signal is emitted. The streaming implementation should then call SetCredentials again. This will trigger the actual ICE restart, and cause LocalCandidates to be cleared.

For more information on ICE restarts see RFC 5245 section 9.1.1.1

# Methods

(Permalink)

## CompleteSendingStateChange (u: State) → nothing

### Parameters

- State — u (Stream_Flow_State)
The new (non-pending) value of SendingState.

Called in response to SendingStateChanged(Pending_*, *) to indicate that the media state has successfully progressed from Pending_{Start, Stop, Pause} to the corresponding non-pending state.

### Possible Errors

- Invalid Argument
The state change made no sense, and was ignored by the CM. The most likely cause for this is a race-condition between the CM emitting a new state change and the streaming implementation responding to the previous state change.

(Permalink)

## ReportSendingFailure (u: Reason, s: Error, s: Message) → nothing

### Parameters

- Reason — u (Call_State_Change_Reason)
- Error — s (DBus_Error_Name)
- Message — s

Can be called at any point to indicate a failure in the outgoing portion of the stream.
(Permalink)

## CompleteReceivingStateChange (u: State) → nothing

### Parameters

- State — u (Stream_Flow_State)
The new (non-pending) value of ReceivingState.

Called in response to ReceivingStateChanged(Pending_*, *) to indicate that the media state has successfully progressed from Pending_{Start, Stop, Pause} to the corresponding non-pending state.

### Possible Errors

- Invalid Argument
The state change made no sense, and was ignored by the CM. The most likely cause for this is a race-condition between the CM emitting a new state change and the streaming implementation responding to the previous state change.

(Permalink)

## ReportReceivingFailure (u: Reason, s: Error, s: Message) → nothing

### Parameters

- Reason — u (Call_State_Change_Reason)
- Error — s (DBus_Error_Name)
- Message — s

Can be called at any point to indicate a failure in the incoming portion of the stream.
(Permalink)

## SetCredentials (s: Username, s: Password) → nothing

### Parameters

- Username — s
The username to use when authenticating on the stream.
- Password — s
The password to use when authenticating on the stream.

Used to set the username fragment and password for streams that have global credentials.

(Permalink)

## AddCandidates (a(usua{sv}): Candidates) → nothing

### Parameters

- Candidates — a(usua{sv}) (Candidate_List)
The candidates to be added.

Add candidates to the LocalCandidates property and signal them to the remote contact(s). Note that connection managers MAY delay the sending of candidates until FinishInitialCandidates is called.
(Permalink)

## FinishInitialCandidates () → nothing

This indicates to the CM that the initial batch of candidates has been added, and should now be processed/sent to the remote side.

##### Rationale:

Protocols supporting Raw UDP SHOULD wait for FinishInitialCandidates, and then set the lowest priority candidate as the Raw UDP candidate.

### Possible Errors

- Not Available
The minimal required candidates have not been set. For example, for an RTP protocol, at least one candidate on the component 1 (RTP) must have been set.

(Permalink)

## Fail ((uuss): Reason) → nothing

### Parameters

- Reason — (uuss) (Call_State_Reason)
A structured reason for stream removal.

Signal an unrecoverable error for this stream, and remove it. If all streams are removed from a content, then it will also be removed.

# Signals

(Permalink)

## SendingStateChanged (u: State)

### Parameters

- State — u (Stream_Flow_State)
The new value of SendingState.

Change notification for SendingState. Note that this information is duplicated onto the Stream interface, so that UIs can ignore the Media interface, and streaming implementations can ignore everything but the media interface.
(Permalink)

## ReceivingStateChanged (u: State)

### Parameters

- State — u (Stream_Flow_State)
The new value of ReceivingState.

Change notification for ReceivingState.
(Permalink)

## LocalCandidatesAdded (a(usua{sv}): Candidates)

### Parameters

- Candidates — a(usua{sv}) (Candidate_List)
Candidates that have been added.

Emitted when local candidates are added to the LocalCandidates property.
(Permalink)

## LocalCredentialsChanged (s: Username, s: Password)

Changed in 0.21.2. renamed from LocalCredentailsSet

### Parameters

- Username — s
- Password — s

Emitted when the value of LocalCredentials changes to a non-empty value. This should only happen when the streaming implementation calls SetCredentials, so this signal is mostly useful for debugging.
(Permalink)

## RelayInfoChanged (aa{sv}: Relay_Info)

### Parameters

- Relay_Info — aa{sv} (String_Variant_Map_List)

Emitted when the value of RelayInfo changes.
(Permalink)

## STUNServersChanged (a(su): Servers)

### Parameters

- Servers — a(su) (Socket_Address_IP_List)

Emitted when the value of STUNServers changes.
(Permalink)

## ServerInfoRetrieved ()

Signals that the initial information about STUN and Relay servers has been retrieved, i.e. the HasServerInfo property is now true.

(Permalink)

## EndpointsChanged (ao: Endpoints_Added, ao: Endpoints_Removed)

### Parameters

- Endpoints_Added — ao
Endpoints that were added.
- Endpoints_Removed — ao
Endpoints that no longer exist.

Emitted when the Endpoints property changes.
(Permalink)

## ICERestartRequested ()

Emitted when the remote side requests an ICE restart (e.g. third party call control, when the remote endpoint changes). The streaming implementation should call SetCredentials again.

# Properties

Accessed using the org.freedesktop.DBus.Properties interface.
(Permalink)

## SendingState — u (Stream_Flow_State)

Read only
Indicates whether the streaming implementation is/should be sending media for this stream. The streaming implementation should be able to rely on reading this value and listening to SendingStateChanged to determine whether it should be sending media or not. It should not need to listen to the Hold interfaces on the Call/Content. Feedback on success should be given via CompleteSendingStateChange. Failures should be reported via ReportSendingFailure.
(Permalink)

## ReceivingState — u (Stream_Flow_State)

Read only
The counterpart of SendingState. Indicates whether the streaming implementation is/should be expecting to receive media for this stream. The CM should only tell the streaming implementation to stop receiving if it has been told to put the stream on hold, or the stream has been removed from the call.
(Permalink)

## Transport — u (Stream_Transport_Type)

Read only
This property is immutable which means that it can never change.
The transport for this stream.
(Permalink)

## LocalCandidates — a(usua{sv}) (Candidate_List)

Read only
[FIXME]. Change notification is via the LocalCandidatesAdded signal.
(Permalink)

## LocalCredentials — (ss) (Stream_Credentials)

Read only
The local credentials are sent to the remote site over the signalling protocol. They are used in ICE to make sure that the connectivity checks come from the right peer. Change notification is via the LocalCredentialsChanged signal. This property will be a pair of empty strings if ICE has not yet been started.
(Permalink)

## STUNServers — a(su) (Socket_Address_IP_List)

Read only

The IP addresses of possible STUN servers to use for NAT traversal, as dotted-quad IPv4 address literals or RFC2373 IPv6 address literals. Change notification is via the STUNServersChanged signal. The IP addresses MUST NOT be given as DNS hostnames.

##### Rationale:

High-quality connection managers already need an asynchronous DNS resolver, so they might as well resolve this name to an IP to make life easier for streaming implementations.
(Permalink)

## RelayInfo — aa{sv} (String_Variant_Map_List)

Read only

A list of mappings describing TURN or Google relay servers available for the client to use in its candidate gathering, as determined from the protocol. Well-known map keys are:

`ip` - s
  The IP address of the relay server as a dotted-quad IPv4 address literal or an RFC2373 IPv6 address literal. This MUST NOT be a DNS hostname.

  ##### Rationale:

  High-quality connection managers already need an asynchronous DNS resolver, so they might as well resolve this name to an IP and make life easier for streaming implementations.
`type` - s

  Either `udp` for UDP (UDP MUST be assumed if this key is omitted), `tcp` for TCP, or `tls`.

  The precise meaning of this key depends on the Transport property: if Transport is ICE, `tls` means TLS over TCP as referenced by ICE draft 19, and if Transport is GTalk_P2P, `tls` means a fake SSL session over TCP as implemented by libjingle.

`port` - q
  The UDP or TCP port of the relay server as an ASCII unsigned integer
`unique-id` - s
  A string identifying the relay server. If two RelayInfo entries have the same unique-id, but different `type`s, there is usually little point in connecting to both. Use `priority` to determine which version to prefer in this case. Can also be used by the streaming implementation to avoid connecting to the same relay multiple times if relaying is required for both audio and video.
`priority` - u
  A number determining which version of a server to prefer (if multiple are present with the same `unique-id`, the one with the highest priority should be used, or the streaming implementation should use the one whose `type` has the most desirable properties)
`username` - s
  The username to use
`password` - s
  The password to use
`component` - u
  The component number to use this relay server for, as an ASCII unsigned integer; if not included, this relay server may be used for any or all components.

  ##### Rationale:

  In ICE draft 6, as used by Google Talk, credentials are only valid once, so each component needs relaying separately.

##### Rationale:

An equivalent of the gtalk-p2p-relay-token property on MediaSignalling channels is not included here. The connection manager should be responsible for making the necessary HTTP requests to turn the token into a username and password.

The type of relay server that this represents depends on the value of the Transport property. If Transport is ICE, this is a TURN server; if Transport is GTalk_P2P, this is a Google relay server; otherwise, the meaning of RelayInfo is undefined.

If relaying is not possible for this stream, the list is empty.

Change notification is given via the RelayInfoChanged signal.

(Permalink)

## HasServerInfo — b

Read only

True if all the initial information about STUN servers and Relay servers has been retrieved. Change notification is via the ServerInfoRetrieved signal.

##### Rationale:

Streaming implementations that can't cope with STUN and relay servers being added later SHOULD wait for this property to become true before proceeding.
(Permalink)

## Endpoints — ao

Read only

The list of Endpoint objects that exist for this stream.

Change notification is via the EndpointsChanged signal.

(Permalink)

## ICERestartPending — b

Read only
State recovery for ICERestartRequested. Set when the signal is emitted, and unset when SetCredentials is called. Useful for debugging.

# Types

Enum (Permalink)

## Stream_Flow_State — u

The type of SendingState and ReceivingState.

- Stopped (0)
No data is flowing (or expected to be flowing) at this time.
- Pending_Start (1)
The streaming implementation has been told to start or receiving, but has not yet indicated that it is doing so.
- Pending_Stop (2)
The streaming implementation has been told to stop sending or receiving data, but it has not yet indicated that it has done so.
- Started (3)
The streaming implementation is successfully sending or receiving data, and everything is going swimmingly.

Enum (Permalink)

## Call_Stream_Candidate_Type — u

The network topology that an IP candidate represents. This can sometimes be used to infer what kind of performance characteristics (latency, bandwith, etc) can be expected of connections made to this candidate.

- None (0)
This is not an IP candidate. This is a reserved value, and should not be seen on the bus.
- Host (1)
This candidate represents a direct connection to the host, as its address is taken directly the host's IP stack.
- Server_Reflexive (2)
This candidate probably represents a connection to the host through a NAT device, as its address was discovered by sending a binding request to a STUN server or similar.
- Peer_Reflexive (3)
This candidate probably represents a good route between the host and its peer, as its address was discovered by sending a STUN binding request to one of the candidates advertised by the peer.
- Relay (4)
This candidate represents the address of a relay server (usually somewhere on the public internet). This candidate is the most likely to work, but all media will go via a relay server, so latency is likely to be higher than other types of candidate.
- Multicast (5)
This candidate represents a Multicast group. This value should only appear if the Stream's Transport is set to Multicast.

Enum (Permalink)

## Media_Stream_Base_Proto — u

- UDP (0)
UDP (User Datagram Protocol)
- TCP (1)
TCP (Transmission Control Protocol)

Enum (Permalink)

## Stream_Component — u

Media streams can use more than one UDP socket: one for RTP (data) and one for RTCP (control). Most of the time, they are adjacent to each other, but some protocols (xmpp) signal each port separately.

- Unknown (0)
The stream transport type is unknown or not applicable (should not appear over dbus).
- Data (1)
This is the high-traffic data socket, containing the audio/video data for the stream.
- Control (2)
This is the low-traffic control socket, usually containing feedback about packet loss etc.

Enum (Permalink)

## Stream_Transport_Type — u

Changed in 0.21.2. WLM_8_5 was removed
A transport that can be used for streaming.

- Unknown (0)
The stream transport type is unknown or not applicable (for streams that do not have a configurable transport).
- Raw_UDP (1)
Raw UDP, with or without STUN. All streaming clients are assumed to support this transport, so there is no handler capability token for it in the Call1 interface. [This corresponds to "none" or "stun" in the old Media.StreamHandler interface.]
- ICE (2)
Interactive Connectivity Establishment, as defined by RFC 5245. Note that this value covers ICE-UDP only. [This corresponds to "ice-udp" in the old Media.StreamHandler interface.]
- GTalk_P2P (3)
Google Talk peer-to-peer connectivity establishment, as implemented by libjingle 0.3. [This corresponds to "gtalk-p2p" in the old Media.StreamHandler interface.]
- WLM_2009 (4)
The transport used by Windows Live Messenger 2009 or later, which resembles ICE draft 19. [This corresponds to "wlm-2009" in the old Media.StreamHandler interface.]
- SHM (5)
Added in 0.21.2.
Shared memory transport, as implemented by the GStreamer shmsrc and shmsink plugins.
- Multicast (6)
Added in 0.21.5.
Multicast transport.

Mapping (Permalink)

## Candidate_Info — a{sv}

Extra information about the candidate. Allowed and mandatory keys depend on the transport protocol used. The following keys are commenly used:

`type` - u
  The type of candidate (Call_Stream_Candidate_Type)
`foundation` - s
  The foundation of this candidate
`protocol` - u
  Underlying protocol of the candidate (Media_Stream_Base_Proto)
`priority` - u
  Priority of the candidate (should be a number between 0 and 65535). Most ICE implementations will prefer the highest priority candidate pair that manages to connect. For backwards compatibility with non-ICE SIP clients, the lowest priority candidate may be sent as a raw UDP fallback candidate. It is recommended that a relay candidate is used as the lowest priority candidate if possible. If both IPv4 and IPv6 raw udp fallback candidates are available, they should be set to the same priority and advertised to the CM at the same time. The CM will decide which to advertise to the remote end.
`base-ip` - s
  The underlying Host address where media sent to this (non-host-type) candidate will eventually arrive.
`base-port` - u
  The underlying Host port where media sent to this (non-host-type) candidate will eventually arrive.
`username` - s
  Username of this candidate (only if credentials are per candidate)
`password` - s
  Password of this candidate (only if credentials are per candidate)
`ttl` - u
  The TTL mandated for RTP/RTCP packets sent to a multicast group (only valid for Multicast Streams)

- Key — s
One of the well-known keys documented here, or an implementation-specific key.
- Value — v
The value corresponding to that key.

Struct (Permalink)

## Candidate — (usua{sv})

A Stream Candidate.

- Component — u (Stream_Component)
The component number.
- IP — s
The IP address to use.
- Port — u
The port number to use.
- Info — a{sv} (Candidate_Info)
Additional information about the candidate.

Struct (Permalink)

## Stream_Credentials — (ss)

A username and password pair.

- Username — s
The username.
- Password — s
The password.