# TODO: timeout should be removed when the Engine is fixed so that it never hangs. -Saul
try:
with api.timeout(15):
while True:
notification = self._channel.wait()
if notification.name == 'SIPEngineDidEnd':
break
except api.TimeoutError:
pass
# stop threads
thread_manager = ThreadManager()
thread_manager.stop()
# stop the reactor
reactor.stop()
@run_in_green_thread
def _detect_nat_type(self):
account_manager = AccountManager()
engine = Engine()
lookup = DNSLookup()
serial = 0
while True:
restart_detection = False
command = self._nat_detect_channel.wait()
if command.name != 'detect_nat':
continue
continue # disable NAT detection for now as it is not used anywhere -Dan
stun_locators = list(account.nat_traversal.stun_server_list or account.id.domain for account in account_manager.iter_accounts() if isinstance(account, Account))
if set(['audio.input_device', 'audio.output_device', 'audio.alert_device', 'audio.tail_length']).intersection(notification.data.modified):
input_device = settings.audio.input_device
if input_device not in (None, u'system_default') and input_device not in engine.input_devices:
input_device = u'system_default'
output_device = settings.audio.output_device
if output_device not in (None, u'system_default') and output_device not in engine.output_devices:
output_device = u'system_default'
if input_device != self.voice_audio_bridge.mixer.input_device or output_device != self.voice_audio_bridge.mixer.output_device or 'audio.tail_length' in notification.data.modified: