_moduleLogger = logging.getLogger("channel.call")
+# @todo Test Calls
class CallChannel(
telepathy.server.ChannelTypeStreamedMedia,
telepathy.server.ChannelInterfaceCallState,
):
- def __init__(self, connection):
+ def __init__(self, connection, contactHandle):
telepathy.server.ChannelTypeStreamedMedia.__init__(self, connection, None)
- telepathy.server.ChannelInterfaceGroup.__init__(self)
- telepathy.server.ChannelInterfaceChatState.__init__(self)
+ telepathy.server.ChannelInterfaceCallState.__init__(self)
+ self._contactHandle = contactHandle
+
+ @gtk_toolbox.log_exception(_moduleLogger)
+ def Close(self):
+ self.close()
+
+ def close(self):
+ telepathy.server.ChannelTypeStreamedMedia.Close(self)
+ self.remove_from_connection()
+ self._prop_getters = None # HACK to get around python-telepathy memory leaks
@gtk_toolbox.log_exception(_moduleLogger)
def ListStreams(self):
"""
For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
"""
- raise telepathy.NotImplemented("Cannot remove a stream")
+ raise telepathy.errors.NotImplemented("Cannot remove a stream")
@gtk_toolbox.log_exception(_moduleLogger)
def RequestStreamDirection(self, stream, streamDirection):
@note Since streams are short lived, not bothering to implement this
"""
_moduleLogger.info("A request was made to change the stream direction")
- raise telepathy.NotImplemented("Cannot change directions")
+ raise telepathy.errors.NotImplemented("Cannot change directions")
@gtk_toolbox.log_exception(_moduleLogger)
- def RequestStreams(self, contact, streamTypes):
+ def RequestStreams(self, contactId, streamTypes):
"""
For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
"""
for streamType in streamTypes:
if streamType != telepathy.constants.MEDIA_STREAM_TYPE_AUDIO:
- raise telepathy.NotImplemented("Audio is the only stream type supported")
+ raise telepathy.errors.NotImplemented("Audio is the only stream type supported")
+ contact = self._conn.handle(telepathy.constants.HANDLE_TYPE_CONTACT, contactId)
+ assert self._contactHandle == contact, "%r != %r" % (self._contactHandle, contact)
contactId, contactNumber = handle.ContactHandle.from_handle_name(contact.name)
- self._conn.session.backend.dial(contactNumber)
+ self._conn.session.backend.call(contactNumber)
streamId = 0
streamState = telepathy.constants.MEDIA_STREAM_STATE_DISCONNECTED