+class AutoAcceptCall(object):
+
+ def __init__(self):
+ self._sessionBus = dbus.SessionBus()
+ self._activeAttempts = []
+
+ def start(self):
+ self._sessionBus.add_signal_receiver(
+ self._on_new_channel,
+ "NewChannel",
+ "org.freedesktop.Telepathy.Connection",
+ None,
+ None
+ )
+
+ def _on_new_channel(self, channelObjectPath, channelType, handleType, handle, supressHandler):
+ if channelType != telepathy.interfaces.CHANNEL_TYPE_STREAMED_MEDIA:
+ return
+
+ serviceName = channelObjectPath.rsplit("/", 1)[0][1:].replace("/", ".")
+ chan = telepathy.client.Channel(serviceName, channelObjectPath)
+ # @bug does not distinguish between preferred CMs
+ # @todo Need a way to be notified on error, ignored, or if picked up
+ attemptPickup = AutoAcceptAttempt(self._sessionBus, chan)
+ self._activeAttempts.append(attemptPickup)
+
+ def _on_nothing(*args):
+ print "ERROR", args
+
+