9 _moduleLogger = logging.getLogger("channel.call")
13 telepathy.server.ChannelTypeStreamedMedia,
14 telepathy.server.ChannelInterfaceCallState,
15 telepathy.server.ChannelInterfaceGroup,
18 def __init__(self, connection, contactHandle):
19 telepathy.server.ChannelTypeStreamedMedia.__init__(self, connection, None)
20 telepathy.server.ChannelInterfaceCallState.__init__(self)
21 telepathy.server.ChannelInterfaceGroup.__init__(self)
22 self._contactHandle = contactHandle
23 self._implement_property_get(
24 telepathy.interfaces.CHANNEL_TYPE_STREAMED_MEDIA,
26 "InitialAudio": self.initial_audio,
27 "InitialVideo": self.initial_video,
31 def initial_audio(self):
34 def initial_video(self):
37 @gtk_toolbox.log_exception(_moduleLogger)
42 telepathy.server.ChannelTypeStreamedMedia.Close(self)
43 self.remove_from_connection()
44 self._prop_getters = None # HACK to get around python-telepathy memory leaks
46 @gtk_toolbox.log_exception(_moduleLogger)
47 def ListStreams(self):
49 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
53 @gtk_toolbox.log_exception(_moduleLogger)
54 def RemoveStreams(self, streams):
56 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
58 raise telepathy.errors.NotImplemented("Cannot remove a stream")
60 @gtk_toolbox.log_exception(_moduleLogger)
61 def RequestStreamDirection(self, stream, streamDirection):
63 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
65 @note Since streams are short lived, not bothering to implement this
67 _moduleLogger.info("A request was made to change the stream direction")
68 raise telepathy.errors.NotImplemented("Cannot change directions")
70 @gtk_toolbox.log_exception(_moduleLogger)
71 def RequestStreams(self, contactId, streamTypes):
73 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
75 @returns [(Stream ID, contact, stream type, stream state, stream direction, pending send flags)]
77 contact = self._conn.handle(telepathy.constants.HANDLE_TYPE_CONTACT, contactId)
78 assert self._contactHandle == contact, "%r != %r" % (self._contactHandle, contact)
79 contactId, contactNumber = handle.ContactHandle.from_handle_name(contact.name)
81 self.CallStateChanged(self._contactHandle, telepathy.constants.CHANNEL_CALL_STATE_RINGING)
82 self._conn.session.backend.call(contactNumber)
83 self.CallStateChanged(self._contactHandle, telepathy.constants.CHANNEL_CALL_STATE_FORWARDED)
86 streamState = telepathy.constants.MEDIA_STREAM_STATE_DISCONNECTED
87 streamDirection = telepathy.constants.MEDIA_STREAM_DIRECTION_BIDIRECTIONAL
88 pendingSendFlags = telepathy.constants.MEDIA_STREAM_PENDING_REMOTE_SEND
89 return [(streamId, contact, streamTypes[0], streamState, streamDirection, pendingSendFlags)]
91 @gtk_toolbox.log_exception(_moduleLogger)
92 def GetCallStates(self):
94 For org.freedesktop.Telepathy.Channel.Interface.CallState
96 Get the current call states for all contacts involved in this call.
97 @returns {Contact: telepathy.constants.CHANNEL_CALL_STATE_*}
99 return {self._contactHandle: telepathy.constants.CHANNEL_CALL_STATE_FORWARDED}