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)
28 telepathy.server.ChannelTypeStreamedMedia.Close(self)
29 self.remove_from_connection()
30 self._prop_getters = None # HACK to get around python-telepathy memory leaks
32 @gtk_toolbox.log_exception(_moduleLogger)
33 def ListStreams(self):
35 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
39 @gtk_toolbox.log_exception(_moduleLogger)
40 def RemoveStreams(self, streams):
42 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
44 raise telepathy.errors.NotImplemented("Cannot remove a stream")
46 @gtk_toolbox.log_exception(_moduleLogger)
47 def RequestStreamDirection(self, stream, streamDirection):
49 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
51 @note Since streams are short lived, not bothering to implement this
53 _moduleLogger.info("A request was made to change the stream direction")
54 raise telepathy.errors.NotImplemented("Cannot change directions")
56 @gtk_toolbox.log_exception(_moduleLogger)
57 def RequestStreams(self, contactId, streamTypes):
59 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
61 @returns [(Stream ID, contact, stream type, stream state, stream direction, pending send flags)]
63 for streamType in streamTypes:
64 if streamType != telepathy.constants.MEDIA_STREAM_TYPE_AUDIO:
65 raise telepathy.errors.NotImplemented("Audio is the only stream type supported")
67 contact = self._conn.handle(telepathy.constants.HANDLE_TYPE_CONTACT, contactId)
68 assert self._contactHandle == contact, "%r != %r" % (self._contactHandle, contact)
69 contactId, contactNumber = handle.ContactHandle.from_handle_name(contact.name)
71 self._conn.session.backend.call(contactNumber)
74 streamState = telepathy.constants.MEDIA_STREAM_STATE_DISCONNECTED
75 streamDirection = telepathy.constants.MEDIA_STREAM_DIRECTION_BIDIRECTIONAL
76 pendingSendFlags = telepathy.constants.MEDIA_STREAM_PENDING_REMOTE_SEND
77 return [(streamId, contact, streamTypes[0], streamState, streamDirection, pendingSendFlags)]
79 @gtk_toolbox.log_exception(_moduleLogger)
80 def GetCallStates(self):
82 For org.freedesktop.Telepathy.Channel.Interface.CallState
84 Get the current call states for all contacts involved in this call.
85 @returns {Contact: telepathy.constants.CHANNEL_CALL_STATE_*}