From 9d3c8b8a3076e9baa1985a62838cbc9aa4d5f96f Mon Sep 17 00:00:00 2001 From: klonfish Date: Sat, 1 Aug 2015 23:38:24 +0200 Subject: [PATCH 1/2] Cut prefix from dialed number before calling it --- phoneinterface.py | 1 + 1 file changed, 1 insertion(+) diff --git a/phoneinterface.py b/phoneinterface.py index 2b19688..9582b2a 100644 --- a/phoneinterface.py +++ b/phoneinterface.py @@ -159,6 +159,7 @@ class PhoneInterface(object): # Try to resolve prefix for p in self.__config.proxies: if number.startswith(p.prefix): + number = number[len(p.prefix):] number += '@' + p.realm break self.__core.invite(number) From ace97d56571a420cfe98be6a68758a540ced3d46 Mon Sep 17 00:00:00 2001 From: klonfish Date: Thu, 27 Aug 2015 00:49:34 +0200 Subject: [PATCH 2/2] Added config option to invert the Gabelschalter input --- configreader.py | 7 ++++++- fetap.ini.example | 1 + tuitest.py | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/configreader.py b/configreader.py index cefb826..199a388 100644 --- a/configreader.py +++ b/configreader.py @@ -15,6 +15,7 @@ class ConfigurationReader(object): 'pin_wecker_enable': '16', 'pin_wecker_a': '18', 'pin_wecker_b': '19', + 'invert_gs' : 'false', 'default_proxy': '' } @@ -35,6 +36,9 @@ class ConfigurationReader(object): def __get_global_val_int(self, option): return int(self.__cp.get('fetapd', option)) + def __get_global_val_bool(self, option): + return self.__cp.get('fetapd', option).lower() in ['true', 'yes', '1'] + def __get_proxy_val(self, proxyname, option): return self.__cp.get('proxy_'+proxyname, option) @@ -66,7 +70,8 @@ class ConfigurationReader(object): pin_schauzeichen = self.__get_global_val_int('pin_schauzeichen'), pin_wecker_enable = self.__get_global_val_int('pin_wecker_enable'), pin_wecker_a = self.__get_global_val_int('pin_wecker_a'), - pin_wecker_b = self.__get_global_val_int('pin_wecker_b') + pin_wecker_b = self.__get_global_val_int('pin_wecker_b'), + invert_gs = self.__get_global_val_bool('invert_gs'), ) self.__dialconfig = fetapdtest.DialConfiguration( diff --git a/fetap.ini.example b/fetap.ini.example index fc5f006..17a9dd7 100644 --- a/fetap.ini.example +++ b/fetap.ini.example @@ -10,6 +10,7 @@ pin_schauzeichen = 12 pin_wecker_enable = 16 pin_wecker_a = 18 pin_wecker_b = 19 +invert_gs = false ; Zeit bevor ein eingehender Anruf automatisch abgewiesen wird incoming_timeout = 60 diff --git a/tuitest.py b/tuitest.py index 250613c..4ed83ab 100644 --- a/tuitest.py +++ b/tuitest.py @@ -7,7 +7,7 @@ import threading class FeApPinConfiguration(object): def __init__(self, gpio_numbering, pin_nsa, pin_nsi, pin_gabelschalter, pin_schauzeichen, pin_wecker_enable, pin_wecker_a, - pin_wecker_b): + pin_wecker_b, invert_gs): if gpio_numbering == 'BOARD': gpio_numbering = gpio.BOARD elif gpio_numbering == 'BCM': @@ -23,6 +23,7 @@ class FeApPinConfiguration(object): self.pin_wecker_enable = pin_wecker_enable self.pin_wecker_a = pin_wecker_a self.pin_wecker_b = pin_wecker_b + self.invert_gs = invert_gs class FeApUserInterface(object): def __init__(self, pinconfig): @@ -69,6 +70,8 @@ class FeApUserInterface(object): def __on_gabelschalter_change(self, pin): gbstate = gpio.input(self.__pinconfig.pin_gabelschalter) + if self.__pinconfig.invert_gs: + gbstate = 1 - gbstate print 'gabelschalter:', gbstate for cb in self.__gabelschalter_callbacks: cb(gbstate)