From 807735a8e3261af24842cb792be74bd8d759cd5b Mon Sep 17 00:00:00 2001 From: Frederic Date: Wed, 20 May 2015 01:11:00 +0200 Subject: [PATCH] added registration_lost event --- fetapdtest.py | 8 ++++++++ phoneinterface.py | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/fetapdtest.py b/fetapdtest.py index 10918d4..3c477e7 100644 --- a/fetapdtest.py +++ b/fetapdtest.py @@ -19,6 +19,9 @@ class AbstractState(object): def on_registration_successful(self): raise IllegalEventError() + def on_registration_lost(self): + raise IllegalEventError() + def on_gabelschalter_up(self): raise IllegalEventError() @@ -62,6 +65,9 @@ class BaseState(AbstractState): def __init__(self, controller): self._controller = controller + def on_registration_lost(self): + return InitState + def on_gabelschalter_up(self): return None @@ -310,6 +316,8 @@ def phone_cb(event): c.queue_event('registration_in_progress') elif event == PhoneEvent.RegSuccessfull: c.queue_event('registration_successful') + elif event == PhoneEvent.RegLost: + c.queue_event('registration_lost') elif event == PhoneEvent.CallIncoming: c.queue_event('incoming_call') elif event == PhoneEvent.CallAccepted: diff --git a/phoneinterface.py b/phoneinterface.py index 2627541..95be72a 100644 --- a/phoneinterface.py +++ b/phoneinterface.py @@ -11,7 +11,7 @@ RINGBACK_TONE = 'weckzeichen.wav' class PhoneEvent(object): RegInProgress,\ RegSuccessfull,\ - RegReset,\ + RegLost,\ CallIncoming,\ CallRinging,\ CallAccepted,\ @@ -60,7 +60,7 @@ class PhoneInterface(object): elif state == linphone.RegistrationState.Ok: evt = PhoneEvent.RegSuccessfull elif state == linphone.RegistrationState.None: - evt = PhoneEvent.RegReset + evt = PhoneEvent.RegLost if evt is not None: for cb in self.__event_cbs: