Methods
SetRinging | () | → | nothing | |
Accept | () | → | nothing | |
Hangup | (u: Reason, s: Detailed_Hangup_Reason, s: Message) | → | nothing | |
AddContent | (s: Content_Name, u: Content_Type) | → | o: Content |
Signals
ContentAdded | (o: Content) | |
ContentRemoved | (o: Content) | |
CallStateChanged | (u: Call_State, u: Call_Flags, (uus): Call_State_Reason, a{sv}: Call_State_Details) | |
CallMembersChanged | (a{uu}: Flags_Changed, au: Removed) |
Properties
Contents | ao | Read only | ||
CallStateDetails | a{sv} | Read only | ||
CallState | u (Call_State) | Read only | ||
CallFlags | u (Call_Flags) | Read only | ||
CallStateReason | (uus) (Call_State_Reason) | Read only | ||
HardwareStreaming | b | Read only | Immutable | |
CallMembers | a{uu} (Call_Member_Map) | Read only | ||
InitialTransport | s | Read only | Immutable, Requestable | |
InitialAudio | b | Read only | Immutable, Requestable | |
InitialVideo | b | Read only | Immutable, Requestable | |
InitialAudioName | s | Read only | Immutable, Requestable | |
InitialVideoName | s | Read only | Immutable, Requestable | |
MutableContents | b | Read only | Immutable |
Handler Capability Tokens
Types
Call_State | Enum | u | |
Call_State_Change_Reason | Enum | u | |
Call_Flags | Flags | u | |
Call_Member_Flags | Flags | u | |
Call_Member_Map | Mapping | a{uu} | |
Call_State_Reason | Struct | (uus) |
Description
A channel type for making audio and video calls. Call channels supersede the old StreamedMedia channel type. Call channels are much more flexible than its predecessor and allow more than two participants.
Handlers are advised against executing all the media signalling, codec and candidate negotiation themselves but instead use a helper library such as telepathy-farsight which when given a new Call channel will set up the transports and codecs and create GStreamer pads which can be added to the handler UI. This is useful as it means the handler does not have to worry how exactly the connection between the call participants is being made.
The TargetHandle and TargetID properties in a Call channel refer to the contact that the user initially called, or which contact initially called the user. Even in a conference call, where there are multiple contacts in the call, these properties refer to the initial contact, who might have left the conference since then. As a result, handlers should not rely on these properties.
Contents
Content.DRAFT objects represent the actual media that forms the Call (for example an audio content and a video content). Calls always have one or more Content objects associated with them.
Content.DRAFT objects have one or more stream associated with them. More information on these streams and how to maniuplate them can be found on the Content.DRAFT interface page.
Outgoing calls
To make an audio-only call to a contact foo@example.com handlers should call:
CreateChannel({ ...ChannelType: ...Call.DRAFT, ...TargetHandleType: Contact, ...TargetID: 'foo@example.com', ...InitialAudio: True, })
As always, TargetHandle may be used
in place of
TargetID
if the contact's handle is already known. To make an audio
and video call, the handler should also specify
InitialVideo The
connection manager SHOULD return a channel whose immutable
properties contain the local user as the InitiatorHandle, the
remote contact as the TargetHandle,
Requested =
True
(indicating the call is outgoing).
After a new Call channel is requested, the CallState property will be Call_State_Pending_Initiator. As the local user is the initiator, the call must be accepted by the handler by calling the Accept method. At this point, CallState changes to Call_State_Pending_Receiver which signifies that the call is ringing, waiting for the remote contact to accept the call. All changes to CallState property are signalled using the CallStateChanged signal.
When the call is accepted by the remote contact, the CallStateChanged signal fires again to show that CallState = Call_State_Accepted.
At this point telepathy-farsight will signal that a pad is available for the handler to show in the user interface.
Missed calls
If the remote contact does not accept the call in time, then the call can be terminated by the server. Note that this only happens in some protocols. Most XMPP clients, for example, do not do this and rely on the call initiator terminating the call. A missed call is shown in a Call channel by the CallState property changing to Call_State_Ended, and the CallStateReason property changing to (remote contact, Call_State_Change_Reason_No_Answer, "").
Rejected calls
If the remote contact decides he or she does not feel like talking to the local user, he or she can reject his or her incoming call. This will be shown in the Call channel by CallState changing to Call_State_Ended and the CallStateReason property changing to (remote contact, Call_State_Change_Reason_User_Requested, "org.freedesktop.Telepathy.Error.Rejected").
Incoming calls
When an incoming call occurs, something like the following NewChannels signal will occur:
NewChannels([ /org/freedesktop/Telepathy/Connection/foo/bar/foo_40bar_2ecom/CallChannel, { ...ChannelType: ...Call.DRAFT, ...TargetHandleType: Contact, ...TargetID: 'foo@example.com', ...TargetHandle: 42, ...Requested: False, ...InitialAudio: True, ...InitialVideo: True, ...InitialAudioName: "audio", ...InitialVideoName: "video", ...MutableContents: True, }])
The InitialAudio and InitialVideo properties show that the call has been started with two contents: one for audio streaming and one for video streaming. The InitialAudioName and InitialVideoName properties also show that the aforementioned audio and video contents have names "audio" and "video".
Once the handler has notified the local user that there is an incoming call waiting for acceptance, the handler should call SetRinging to let the CM know. The new channel should also be given to telepathy-farsight to work out how the two participants will connect together. telepathy-farsight will call the appropriate methods on the call's Content.DRAFTs to negotiate codecs and transports.
To pick up the call, the handler should call Accept. The CallState property changes to Call_State_Accepted and once media is being transferred, telepathy-farsight will notify the handler of a new pad to be shown to the local user in the UI
To reject the call, the handler should call the Hangup method. The CallState property will change to Call_State_Ended and the CallStateReason property will change to (self handle, Call_State_Change_Reason_User_Requested, "org.freedesktop.Telepathy.Error.Rejected").
Ongoing calls
Adding and removing contents
When a call is open, new contents can be added as long as the CM supports it. The MutableContents property will let the handler know whether further contents can be added or existing contents removed. An example of this is starting a voice call between a contact and then adding a video content. To do this, the should call AddContent like this:
AddContent("video", Media_Stream_Type_Video)
Assuming no errors, the new video content will be added to the call. telepathy-farsight will pick up the new content and perform the transport and codec negotiation automatically. telpathy-farsight will signal when the video is ready to show in the handler's user interface.
A similar method is used for removing contents from a call, except that the Remove method is on the Content.DRAFT object.
Ending the call
To end the call, the handler should call the Hangup method. The CallState property will change to Call_State_Ended and CallStateReason will change to (self handle, Call_State_Change_Reason_User_Requested, "org.freedesktop.Telepathy.Error.Cancelled").
If the other participant hangs up first then the CallState property will change to Call_State_Ended and CallStateReason will change to (remote contact, Call_State_Change_Reason_User_Requested, "org.freedesktop.Telepathy.Error.Terminated").
Multi-party calls
[TODO]Call states
There are many combinations of the CallState and CallStateReason properties which mean different things. Here is a table to try to make these meanings clearer:
Requested | CallState | CallStateReason | Meaning | ||
---|---|---|---|---|---|
Actor | Reason | DBus_Reason | |||
True | Call_State_Pending_Initiator | Self handle | Call_State_Change_Reason_User_Requested | "" | The outgoing call channel is waiting for the local user to call Accept. |
True | Call_State_Pending_Receiver | Self handle | Call_State_Change_Reason_User_Requested | "" | The outgoing call is waiting for the remote contact to pick up the call. |
False | Call_State_Pending_Receiver | 0 | Call_State_Change_Reason_Unknown | "" | The incoming call is waiting for the local user to call Accept on the call. |
True | Call_State_Accepted | Remote contact handle | Call_State_Change_Reason_User_Requested | "" | The remote contact accepted the outgoing call. |
False | Call_State_Accepted | Self handle | Call_State_Change_Reason_User_Requested | "" | The local user accepted the incoming call. |
True or False | Call_State_Ended | Self handle | Call_State_Change_Reason_User_Requested | Cancelled | The local user hung up the incoming or outgoing call. |
True or False | Call_State_Ended | Remote contact handle | Call_State_Change_Reason_User_Requested | Terminated | The remote contact hung up the incoming or outgoing call. |
True | Call_State_Ended | Remote contact handle | Call_State_Change_Reason_No_Answer | "" | The outgoing call was not picked up and the call ended. |
False | Call_State_Ended | Remote contact handle | Call_State_Change_Reason_User_Requested | PickedUpElsewhere | The incoming call was ended because it was picked up elsewhere. |
Requestable channel classes
The RequestableChannelClasses for Call.DRAFT channels can be:
[( Fixed = { ...ChannelType: ...Call.DRAFT, ...TargetHandleType: Contact, ...InitialVideo: True }, Allowed = [ ...InitialVideoName, ...InitialAudio, ...InitialAudioName ] ), ( Fixed = { ...ChannelType: ...Call.DRAFT, ...TargetHandleType: Contact, ...InitialAudio: True }, Allowed = [ ...InitialAudioName, ...InitialVideo, ...InitialVideoName ] )]
Clients aren't allowed to make outgoing calls that have neither initial audio nor initial video. Clearly, CMs which don't support video should leave out the first class and omit InitialVideo from the second class, and vice versa for CMs without audio support.
Handlers should not close Call.DRAFT channels without first calling Hangup on the channel. If a Call handler crashes, the ChannelDispatcher will call Close on the channel which SHOULD also imply a call to Hangup(Call_State_Change_Reason_User_Requested, "org.freedesktop.Telepathy.Error.Terminated", "") before actually closing the channel.
Methods
SetRinging () → nothing
Indicate that the local user has been alerted about the incoming call.
This method is only useful if the channel's Requested property is False, and the CallState is Call_State_Pending_Receiver (an incoming call waiting on the local user to pick up). While this is the case, this method SHOULD change the CallFlags to include Call_Flags_Locally_Ringing, and notify the remote contact that the local user has been alerted (if the protocol implements this); repeated calls to this method SHOULD succeed, but have no further effect.
In all other states, this method SHOULD fail with the error NotAvailable.
Possible Errors
- Invalid Argument
- Not Available
Accept () → nothing
For incoming calls in state Call_State_Pending_Receiver, accept the incoming call; this changes the CallState to Call_State_Accepted.
For outgoing calls in state Call_State_Pending_Initiator, actually call the remote contact; this changes the CallState to Call_State_Pending_Receiver.
Otherwise, this method SHOULD fail with the error NotAvailable.
This method should be called exactly once per Call, by whatever client (user interface) is handling the channel.
When this method is called, for each Content.DRAFT whose Disposition is Call_Content_Disposition_Initial, any streams where the LocalSendingState is Sending_State_Pending_Send will be moved to Sending_State_Sending as if SetSending(True) had been called.
Possible Errors
- Not Available
Hangup (u: Reason, s: Detailed_Hangup_Reason, s: Message) → nothing
Parameters
- Reason — u (Call_State_Change_Reason)
- Detailed_Hangup_Reason — s (DBus_Error_Name)
- Message — s
Rationale:
Possible Errors
- Not Available
AddContent (s: Content_Name, u: Content_Type) → o: Content
Parameters
- Content_Name — s
- Content_Type — u (Media_Stream_Type)
The suggested name of the content to add.
Rationale:
If there is already a content with the same name as this property then a sensible suffix should be added. For example, if this argument is "audio" but a content of the same name already exists, a sensible suffix such as " (1)" is appended to name the new content "audio (1)". A further content with the name "audio" would then be named "audio (2)".
Returns
- Content — o
Possible Errors
- Invalid Argument
- Not Implemented
- Not Capable
Signals
ContentAdded (o: Content)
Parameters
- Content — o
Emitted when a new Content.DRAFT is added to the call.
ContentRemoved (o: Content)
Parameters
- Content — o
Emitted when a Content.DRAFT is removed from the call.
CallStateChanged (u: Call_State, u: Call_Flags, (uus): Call_State_Reason, a{sv}: Call_State_Details)
Parameters
- Call_State — u (Call_State)
- Call_Flags — u (Call_Flags)
- Call_State_Reason — (uus) (Call_State_Reason)
- Call_State_Details — a{sv}
Emitted when the state of the call as a whole changes.
This signal is emitted for any change in the properties corresponding to its arguments, even if the other properties referenced remain unchanged.
CallMembersChanged (a{uu}: Flags_Changed, au: Removed)
Parameters
- Flags_Changed — a{uu} (Call_Member_Map)
- Removed — au (Contact_Handle_List)
Properties
Contents — ao
The list of Content.DRAFT objects that are part of this call. Change notification is via the ContentAdded and ContentRemoved signals.
CallStateDetails — a{sv}
A map used to provide optional extensible details for the CallState, CallFlags and/or CallStateReason.
Well-known keys and their corresponding value types include:
- hangup-message - s
- An optional human-readable message sent when the call was ended,
corresponding to the Message argument to the
Hangup method. This is only
applicable when the call state is Call_State_Ended.
Rationale:
XMPP Jingle can send such messages. - queue-message - s
- An optional human-readable message sent when the local contact
is being held in a queue. This is only applicable when
Call_Flags_Queued is in the call flags.
Rationale:
SIP 182 notifications can have human-readable messages attached. - debug-message - s
- A message giving further details of any error indicated by the CallStateReason. This will not normally be localized or suitable for display to users, and is only applicable when the call state is Call_State_Ended.
CallState — u (Call_State)
The current high-level state of this call. The CallFlags provide additional information, and the CallStateReason and CallStateDetails explain the reason for the current values for those properties.
Note that when in a conference call, this property is purely to show your state in joining the call. The receiver (or remote contact) in this context is the conference server itself. The property does not change when other call members' states change.
Clients MAY consider unknown values in this property to be an error.
CallFlags — u (Call_Flags)
Flags representing the status of the call as a whole, providing more specific information than the CallState.
Clients are expected to ignore unknown flags in this property, without error.
When an ongoing call is active and not on hold or has any other problems, this property will be 0.
CallStateReason — (uus) (Call_State_Reason)
The reason for the last change to the CallState and/or CallFlags. The CallStateDetails MAY provide additional information.
HardwareStreaming — b
If this property is True, all of the media streaming is done by some mechanism outside the scope of Telepathy.
Rationale:
A connection manager might be intended for a specialized hardware device, which will take care of the audio streaming (e.g. telepathy-yafono, which uses GSM hardware which does the actual audio streaming for the call).
If this is False, the handler is responsible for doing the actual media streaming for at least some contents itself. Those contents will have the Media.DRAFT interface, to communicate the necessary information to a streaming implementation. Connection managers SHOULD operate like this, if possible.
Rationale:
Many connection managers (such as telepathy-gabble) only do the call signalling, and expect the client to do the actual streaming using something like Farsight, to improve latency and allow better UI integration.
CallMembers — a{uu} (Call_Member_Map)
A mapping from the remote contacts that are part of this call to flags describing their status. This mapping never has the local user's handle as a key.
When the call ends, this property should be an empty list, and notified with CallMembersChanged
If the Call implements Group and the Group members are channel-specific handles, then this call SHOULD also use channel-specific handles.
Anonymous members are exposed as channel-specific handles with no owner.
InitialTransport — s
If set on a requested channel, this indicates the transport that should be used for this call. Where not applicable, this property is defined to be the empty string, in particular, on CMs with hardware streaming.
Rationale:
InitialAudio — b
If set to True in a channel request that will create a new channel, the connection manager should immediately attempt to establish an audio stream to the remote contact, making it unnecessary for the client to call AddContent.
If this property, or InitialVideo, is passed to EnsureChannel (as opposed to CreateChannel), the connection manager SHOULD ignore these properties when checking whether it can return an existing channel as suitable; these properties only become significant when the connection manager has decided to create a new channel.
If True on a requested channel, this indicates that the audio stream has already been requested and the client does not need to call RequestStreams, although it MAY still do so.
If True on an unrequested (incoming) channel, this indicates that the remote contact initially requested an audio stream; this does not imply that that audio stream is still active (as indicated by Contents).
The name of this new content can be decided by using the InitialAudioName property.
Connection managers that support the ContactCapabilities interface SHOULD represent the capabilities of receiving audio and/or video calls by including a channel class in a contact's capabilities with ChannelType = Call in the fixed properties dictionary, and InitialAudio and/or InitialVideo in the allowed properties list. Clients wishing to discover whether a particular contact is likely to be able to receive audio and/or video calls SHOULD use this information.
Rationale:
Not all clients support video calls, and it would also be possible (although unlikely) to have a client which could only stream video, not audio.
Clients that are willing to receive audio and/or video calls SHOULD include the following among their channel classes if calling UpdateCapabilities (clients of a ChannelDispatcher SHOULD instead arrange for the ChannelDispatcher to do this, by including the filters in their HandlerChannelFilter properties):
- { ChannelType = Call }
- { ChannelType = Call, InitialAudio = True } if receiving calls with audio is supported
- { ChannelType = Call, InitialVideo = True } if receiving calls with video is supported
Rationale:
Connection managers for protocols with capability discovery, like XMPP, need this information to advertise the appropriate capabilities for their protocol.
InitialVideo — b
The same as InitialAudio, but for a video stream. This property is immutable (cannot change).
In particular, note that if this property is False, this does not imply that an active video stream has not been added, only that no video stream was active at the time the channel appeared.
This property is the correct way to discover whether connection managers, contacts etc. support video calls; it appears in capabilities structures in the same way as InitialAudio.
InitialAudioName — s
If InitialAudio is set to True, then this property will name the intial audio content with the value of this property.
Rationale:
Content names are meant to be significant, but if no name can be given to initial audio content, then its name cannot be meaningful or even localized.
If this property is empty or missing from the channel request and InitialAudio is True, then the CM must come up with a sensible for the content, such as "audio".
If the protocol has no concept of stream names then this property will not show up in the allowed properties list of the Requestable Channel Classes for call channels.
InitialVideoName — s
The same as InitialAudioName, but for a video stream created by setting InitialVideo to True. This property is immutable and so cannot change.
MutableContents — b
If True, a stream of a different content type can be added after the Channel has been requested
If this property is missing, clients SHOULD assume that it is False, and thus that the channel's streams cannot be changed once the call has started.
If this property isn't present in the "allowed" set in any of the Call entries contact capabilities, then user interfaces MAY choose to show a separate "call" option for each class of call.
Rationale:
For example, once an audio-only Google Talk call has started, it is not possible to add a video stream; both audio and video must be requested at the start of the call if video is desired. User interfaces may use this pseudo-capability as a hint to display separate "Audio call" and "Video call" buttons, rather than a single "Call" button with the option to add and remove video once the call has started for contacts without this flag.
Handler Capability Tokens
org.freedesktop.Telepathy.Channel.Type.Call.DRAFT/audio
This client supports audio calls.
org.freedesktop.Telepathy.Channel.Type.Call.DRAFT/video
This client supports video calls.
org.freedesktop.Telepathy.Channel.Type.Call.DRAFT/gtalk-p2p
The client can implement streaming for streams whose Transport property is Stream_Transport_Type_GTalk_P2P.
org.freedesktop.Telepathy.Channel.Type.Call.DRAFT/ice
The client can implement streaming for streams whose Transport property is Stream_Transport_Type_ICE.
org.freedesktop.Telepathy.Channel.Type.Call.DRAFT/wlm-2009
The client can implement streaming for streams whose Transport property is Stream_Transport_Type_WLM_2009.
org.freedesktop.Telepathy.Channel.Type.Call.DRAFT/shm
The client can implement streaming for streams whose Transport property is Stream_Transport_Type_SHM.
org.freedesktop.Telepathy.Channel.Type.Call.DRAFT/video/h264 (etc.)
The client supports media streaming with H264 (etc.).
This handler capability token is a one of a family of similar tokens: for any other audio or video codec whose MIME type is audio/subtype or video/subtype, a handler capability token of this form may exist (the subtype MUST appear in lower case in this context). Clients MAY support more codecs than they explicitly advertise support for; clients SHOULD explicitly advertise support for their preferred codec(s), and for codecs like H264 that are, in practice, significant in codec negotiation.
Rationale:
For instance, the XMPP capability used by the Google Video
Chat web client to determine whether a client is compatible
with it requires support for H264 video, so an XMPP
connection manager that supports this version of Jingle should
not advertise the Google Video Chat capability unless there
is at least one installed client that declares that it supports
video/h264
on Call channels.
For example, a client could advertise support for audio and video calls using Speex, Theora and H264 by having five handler capability tokens in its Capabilities property:
org.freedesktop.Telepathy.Channel.Type.Call.DRAFT/audio
org.freedesktop.Telepathy.Channel.Type.Call.DRAFT/audio/speex
org.freedesktop.Telepathy.Channel.Type.Call.DRAFT/video
org.freedesktop.Telepathy.Channel.Type.Call.DRAFT/video/theora
org.freedesktop.Telepathy.Channel.Type.Call.DRAFT/video/h264
Clients MAY have media signalling abilities without explicitly supporting any particular codec, and connection managers SHOULD support this usage.
Rationale:
This is necessary to support gatewaying between two Telepathy connections, in which case the available codecs might not be known to the gatewaying process.
Types
Call_State — u
The state of a call, as a whole.
The allowed transitions are:
- Pending_Initiator → Pending_Receiver (for outgoing calls, when Accept is called)
- Pending_Receiver → Accepted (for incoming calls, when Accept is called; for outgoing calls to a contact, when the remote contact accepts the call; for joining a conference call, when the local user successfully joins the conference)
- Accepted → Pending_Receiver (when transferred to another contact)
- any state → Ended (when the call is terminated normally, or when an error occurs)
Clients MAY consider unknown values from this enum to be an error - additional values will not be defined after the Call specification is declared to be stable.
- Unknown (0)
- Pending_Initiator (1)
- Pending_Receiver (2)
- Accepted (3)
- Ended (4)
Call_State_Change_Reason — u
- Unknown (0)
- User_Requested (1)
- Forwarded (2)
- No_Answer (3)
The change was requested by the contact indicated by the Actor member of a Call_State_Reason struct.
If the Actor is the local user, the DBus_Reason SHOULD be the empty string.
If the Actor is a remote user, the DBus_Reason SHOULD be the empty string if the call was terminated normally, but MAY be a non-empty error name to indicate error-like call termination reasons (call rejected as busy, kicked from a conference by a moderator, etc.).
The call was forwarded. If known, the handle of the contact the call was forwarded to will be indicated by the Actor member of a Call_State_Reason struct.
The CallState changed from Call_State_Pending_Receiver to Call_State_Ended because the initiator ended the call before the receiver accepted it. With an incoming call this state change reason signifies a missed call.
Call_Flags — u
- Locally_Ringing (1)
- Queued (2)
- Locally_Held (4)
- Forwarded (8)
- In_Progress (16)
- Clearing (32)
- Muted (64)
Rationale:
Rationale:
Call_Member_Flags — u
A set of flags representing the status of a remote contact in a call.
It is protocol- and client-specific whether a particular contact will ever have a particular flag set on them, and Telepathy clients SHOULD NOT assume that a flag will ever be set.
Rationale:
180 Ringing in SIP, and its equivalent in XMPP, are optional informational messages, and implementations are not required to send them. The same applies to the messages used to indicate hold state.
- Ringing (1)
- Held (2)
- Conference_Host (4)
The remote contact's client has told us that the contact has been alerted about the call but has not responded.
Rationale:
This is a flag per member, not a flag for the call as a whole, because in Muji conference calls, you could invite someone and have their state be "ringing" for a while.
The call member has put this call on hold.
Rationale:
This is a flag per member, not a flag for the call as a whole, because in conference calls, any member could put the conference on hold.
Call_Member_Map — a{uu}
- key — u (Handle)
- Flag — u (Call_Member_Flags)
Call_State_Reason — (uus)
- Actor — u (Contact_Handle)
- Reason — u (Call_State_Change_Reason)
- DBus_Reason — s (DBus_Error_Name)
A specific reason for the change, which may be a D-Bus error in the Telepathy namespace, a D-Bus error in any other namespace (for implementation-specific errors), or the empty string to indicate that the state change was not an error.
This SHOULD be an empty string for changes to any state other than Ended.
The errors Cancelled and Terminated SHOULD NOT be used here; an empty string SHOULD be used instead.
Rationale:
Those error names are used to indicate normal call termination by the local user or another user, respectively, in contexts where a D-Bus error name must appear.