+ # @todo distinguish between preferred CMs
+ attemptPickup = AutoAcceptCall(bus, conn, chan, self._on_inbound_call, self._on_inbound_call_error)
+
+ @gtk_toolbox.log_exception(_moduleLogger)
+ def _on_inbound_call(self, autoAcceptCall):
+ # @todo Add a comparison for picking up for only certain contacts
+ print autoAcceptCall.initiator, autoAcceptCall.target
+ if autoAcceptCall.is_inbound():
+ autoAcceptCall.accept_call(self._on_call_pickedup, self._on_pickup_error)
+ else:
+ _moduleLogger.debug(
+ "Not an inbound call (initiator=%r, target=%r)" % (autoAcceptCall.initiator, autoAcceptCall.target)
+ )
+
+ @gtk_toolbox.log_exception(_moduleLogger)
+ def _on_inbound_call_error(self, *args):
+ _moduleLogger.info("Inbound call error")
+
+ @gtk_toolbox.log_exception(_moduleLogger)
+ def _on_call_pickedup(self, autoAcceptCall):
+ _moduleLogger.info("Call picked up")
+
+ @gtk_toolbox.log_exception(_moduleLogger)
+ def _on_pickup_error(self, autoAcceptCall, *args):
+ _moduleLogger.info("Call failed to pick up (%r)" % (args, ))
+
+
+class MissedManager(object):
+
+ def __init__(self):
+ self._newChannelSignaller = NewChannelSignaller(self._on_new_channel)
+
+ def start(self):
+ self._newChannelSignaller.start()
+
+ @gtk_toolbox.log_exception(_moduleLogger)
+ def _on_new_channel(self, bus, conn, chan, channelType):
+ pprint.pprint((bus, conn, chan, channelType))
+ if channelType != telepathy.interfaces.CHANNEL_TYPE_STREAMED_MEDIA:
+ return
+
+ missDetection = WasMissedCall(
+ bus, conn, chan, self._on_missed_call, self._on_error_for_missed
+ )
+
+ @gtk_toolbox.log_exception(_moduleLogger)
+ def _on_missed_call(self, missDetection):
+ _moduleLogger.info("Missed a call")
+
+ @gtk_toolbox.log_exception(_moduleLogger)
+ def _on_error_for_missed(self, missDetection, reason):
+ _moduleLogger.info("Error: %r claims %r" % (missDetection, reason))