6 _moduleLogger = logging.getLogger("channel.call")
10 telepathy.server.ChannelTypeStreamedMedia,
11 telepathy.server.ChannelInterfaceCallState,
14 def __init__(self, connection):
15 telepathy.server.ChannelTypeStreamedMedia.__init__(self, connection, None)
16 telepathy.server.ChannelInterfaceGroup.__init__(self)
17 telepathy.server.ChannelInterfaceChatState.__init__(self)
19 def ListStreams(self):
21 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
25 def RemoveStreams(self, streams):
27 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
29 raise telepathy.NotImplemented("Cannot remove a stream")
31 def RequestStreamDirection(self, stream, streamDirection):
33 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
35 @note Since streams are short lived, not bothering to implement this
37 _moduleLogger.info("A request was made to change the stream direction")
38 raise telepathy.NotImplemented("Cannot change directions")
40 def RequestStreams(self, contact, streamTypes):
42 For org.freedesktop.Telepathy.Channel.Type.StreamedMedia
44 @returns [(Stream ID, contact, stream type, stream state, stream direction, pending send flags)]
46 for streamType in streamTypes:
47 if streamType != telepathy.constants.MEDIA_STREAM_TYPE_AUDIO:
48 raise telepathy.NotImplemented("Audio is the only stream type supported")
50 contactId = contact.name
52 addressbook = self._conn.session.addressbook
53 phones = addressbook.get_contact_details(contactId)
54 firstNumber = phones.next()
55 self._conn.session.backend.dial(firstNumber)
58 streamState = telepathy.constants.MEDIA_STREAM_STATE_DISCONNECTED
59 streamDirection = telepathy.constants.MEDIA_STREAM_DIRECTION_BIDIRECTIONAL
60 pendingSendFlags = telepathy.constants.MEDIA_STREAM_PENDING_REMOTE_SEND
61 return [(streamId, contact, streamTypes[0], streamState, streamDirection, pendingSendFlags)]
63 def GetCallStates(self):
65 For org.freedesktop.Telepathy.Channel.Interface.CallState
67 Get the current call states for all contacts involved in this call.
68 @returns {Contact: telepathy.constants.CHANNEL_CALL_STATE_*}