|
|
@ -7,9 +7,10 @@ import configreader |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DialConfiguration(object): |
|
|
|
class DialConfiguration(object): |
|
|
|
def __init__(self, dial_timeout, shortcuts): |
|
|
|
def __init__(self, dial_timeout, shortcuts, blacklist): |
|
|
|
self.dial_timeout = dial_timeout |
|
|
|
self.dial_timeout = dial_timeout |
|
|
|
self.shortcuts = shortcuts |
|
|
|
self.shortcuts = shortcuts |
|
|
|
|
|
|
|
self.blacklist = blacklist |
|
|
|
|
|
|
|
|
|
|
|
class IllegalEventError(Exception): |
|
|
|
class IllegalEventError(Exception): |
|
|
|
pass |
|
|
|
pass |
|
|
@ -117,7 +118,14 @@ class RegisteringState(BaseState): |
|
|
|
class IdleState(BaseState): |
|
|
|
class IdleState(BaseState): |
|
|
|
def on_incoming_call(self): |
|
|
|
def on_incoming_call(self): |
|
|
|
print('incomfing call') |
|
|
|
print('incomfing call') |
|
|
|
return SchelltState |
|
|
|
caller = self._controller.phone.get_remote_number() |
|
|
|
|
|
|
|
print('From: %s' % caller) |
|
|
|
|
|
|
|
if caller in self._controller.dialconfig.blacklist: |
|
|
|
|
|
|
|
print('Caller on blacklist - declining') |
|
|
|
|
|
|
|
self._controller.phone.decline_call() |
|
|
|
|
|
|
|
return CallTerminatingState |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
return SchelltState |
|
|
|
|
|
|
|
|
|
|
|
def on_gabelschalter_up(self): |
|
|
|
def on_gabelschalter_up(self): |
|
|
|
print('gabel up') |
|
|
|
print('gabel up') |
|
|
|