9 _moduleLogger = logging.getLogger("channel.call")
14 telepathy.server.ChannelTypeStreamedMedia,
15 telepathy.server.ChannelInterfaceCallState,
18 def __init__(self, connection, contactHandle):
19 telepathy.server.ChannelTypeStreamedMedia.__init__(self, connection, None)
20 telepathy.server.ChannelInterfaceCallState.__init__(self)
21 self._contactHandle = contactHandle
23 @gtk_toolbox.log_exception(_moduleLogger)
24 def ListStreams(self):
26 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
30 @gtk_toolbox.log_exception(_moduleLogger)
31 def RemoveStreams(self, streams):
33 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
35 raise telepathy.errors.NotImplemented("Cannot remove a stream")
37 @gtk_toolbox.log_exception(_moduleLogger)
38 def RequestStreamDirection(self, stream, streamDirection):
40 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
42 @note Since streams are short lived, not bothering to implement this
44 _moduleLogger.info("A request was made to change the stream direction")
45 raise telepathy.errors.NotImplemented("Cannot change directions")
47 @gtk_toolbox.log_exception(_moduleLogger)
48 def RequestStreams(self, contact, streamTypes):
50 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
52 @returns [(Stream ID, contact, stream type, stream state, stream direction, pending send flags)]
54 for streamType in streamTypes:
55 if streamType != telepathy.constants.MEDIA_STREAM_TYPE_AUDIO:
56 raise telepathy.errors.NotImplemented("Audio is the only stream type supported")
58 print self._contactHandle, contact
59 contactId, contactNumber = handle.ContactHandle.from_handle_name(contact.name)
61 self._conn.session.backend.call(contactNumber)
64 streamState = telepathy.constants.MEDIA_STREAM_STATE_DISCONNECTED
65 streamDirection = telepathy.constants.MEDIA_STREAM_DIRECTION_BIDIRECTIONAL
66 pendingSendFlags = telepathy.constants.MEDIA_STREAM_PENDING_REMOTE_SEND
67 return [(streamId, contact, streamTypes[0], streamState, streamDirection, pendingSendFlags)]
69 @gtk_toolbox.log_exception(_moduleLogger)
70 def GetCallStates(self):
72 For org.freedesktop.Telepathy.Channel.Interface.CallState
74 Get the current call states for all contacts involved in this call.
75 @returns {Contact: telepathy.constants.CHANNEL_CALL_STATE_*}