From 1c7446bfdf0420274693773abbbe99f8ba1e031d Mon Sep 17 00:00:00 2001 From: isra67 Date: Mon, 25 Sep 2017 10:26:18 +0200 Subject: [PATCH] bugfixes: tunnel stop & SIP regs & updates --- indoor.ini | 12 ++++++------ my_lib/constants.py | 3 ++- my_lib/constants.pyc | Bin 2955 -> 2990 bytes pjindoor.py | 19 +++++++++++++------ share/update.sh | 21 +++++++++++++-------- tunnel.sh | 4 ++-- 6 files changed, 36 insertions(+), 23 deletions(-) diff --git a/indoor.ini b/indoor.ini index c3215bc..5aceb19 100644 --- a/indoor.ini +++ b/indoor.ini @@ -5,13 +5,13 @@ brightness = 110 dnd_mode = False [sip] -sip_mode = peer-to-peer -sip_username = 2000 -sip_server_addr = 192.168.1.165 -sip_p4ssw0rd = heslo2000 +sip_mode = SIP server +sip_username = alphatech +sip_server_addr = 192.168.1.166 +sip_p4ssw0rd = pks-team buttoncalllog = button_calllog sip_port = 5060 -sip_authentication_name = +sip_authentication_name = alphatech [devices] ringtone = tone2.wav @@ -52,7 +52,7 @@ netmask = 255.255.255.0 [about] serial = 0000000085a5ba7f app_name = Indoor 2.0 -app_ver = 2.0.0.1 +app_ver = 2.0.0.2 uptime = 22:00:30.530000 licencekey = 8685-dd0892-31e0-854a5a-9480 buttonregs = button_regs diff --git a/my_lib/constants.py b/my_lib/constants.py index 7578264..4b76256 100644 --- a/my_lib/constants.py +++ b/my_lib/constants.py @@ -21,7 +21,7 @@ KIVY_CONFIG_FILE = '/root/.kivy/config.ini' APP_NAME = '-Indoor-2.0-' -APP_VERSION_CODE = '2.0.0.1' +APP_VERSION_CODE = '2.0.0.2' SCREEN_SAVER = 0 WATCHES = 'analog' @@ -91,6 +91,7 @@ LOG_LEVEL = 3 #5 # basic SIP log level current_call = None acc = None +sipRegStatus = False # ### variables & constatnts: ### main_state = 0 diff --git a/my_lib/constants.pyc b/my_lib/constants.pyc index 34dc45f85b3b3d1d288993719718bb3d5b33eec3..87f1068838bef1c193bd482e0b945498a99b78dc 100644 GIT binary patch delta 182 zcmeAcUnefj{F#?)(y|kg$qZ1y0;C;)xcJ3J=|zk#sn!fpHVi533{kcWDMk!Yc3`$W zLy7@IIwM1r14D`-LzE*}$_Y$5gB7@d*{%%f3=C0jlYcW7G8%2pWol+-bl?1uRgOi9 z6=;K7Voq^t2@lAw%z~iQ^x%@jlG5VId|Y1{+a|Mcmxwa5F|#qUF|jdm0x^&Uf=mEt Ca3+BO delta 147 zcmZ1{-YqW8{F#?)&ej8w$qZ1y0;C;)xcJdV=|zloDeMeU)(j~|3{f@=Ahs<-iUC79 zBSVxOLy93ols#C=0ZclA6*z&}&J5`c3{ftV8JP+h4L27vH8V51ZvM_H$1>S~>kDJc XWL54GVP-Z)HYPSEP9O%dK#&OlATAvX diff --git a/pjindoor.py b/pjindoor.py index c418276..a9134c5 100644 --- a/pjindoor.py +++ b/pjindoor.py @@ -314,16 +314,18 @@ def make_call(uri): def log_cb(level, str, len): "pjSip logging callback" - global docall_button_global + global docall_button_global, sipRegStatus Logger.info('pjSip cb: (%d) %s' % (level, str)) if 'registration failed' in str: sendNodeInfo('[***]SIPREG: ERROR') docall_button_global.disabled = True + sipRegStatus = False elif 'registration success' in str: sendNodeInfo('[***]SIPREG: OK') docall_button_global.disabled = False + sipRegStatus = True # ############################################################################## @@ -1086,7 +1088,7 @@ def init_screen(self): # ############################################################### def init_myphone(self): "sip phone init" - global acc, config + global acc, config, sipRegStatus # Create library instance lib = pj.Lib() @@ -1137,6 +1139,7 @@ def init_myphone(self): self.sipServerAddr = '' # sendNodeInfo('[***]SIP:peer-to-peer') sendNodeInfo('[***]SIPREG: peer-to-peer') + sipRegStatus = True else: s = str(config.get('sip', 'sip_server_addr')).strip() u = str(config.get('sip', 'sip_username')).strip() @@ -1168,6 +1171,7 @@ def init_myphone(self): docall_button_global.btntext = "No Licence" docall_button_global.disabled = True docall_button_global.imgpath = NO_IMG + sipRegStatus = False # ############################################################### @@ -1402,14 +1406,16 @@ def my_reject_callback(self, arg): # ############################################################### def enable_btn_docall(self, param): "enable a call button" - global docall_button_global, current_call + global docall_button_global, current_call, sipRegStatus - Logger.debug('%s:' % whoami()) + olds = docall_button_global.disabled if self.outgoingCall or (current_call and current_call.is_valid()): docall_button_global.disabled = False else: - docall_button_global.disabled = self.outgoing_mode == False + docall_button_global.disabled = not self.outgoing_mode or not sipRegStatus + + if olds != docall_button_global.disabled: Logger.debug('%s:' % whoami()) # ############################################################### @@ -1914,7 +1920,8 @@ def setButtons(self, visible): # docall_button_global.disabled = self.outgoing_mode == False - Clock.schedule_once(self.enable_btn_docall) + if docall_button_global.disabled: + Clock.schedule_once(self.enable_btn_docall) # ############################################################### diff --git a/share/update.sh b/share/update.sh index a63bb8c..701cf95 100755 --- a/share/update.sh +++ b/share/update.sh @@ -20,18 +20,23 @@ cp -f indoor.ini backups cp -f sounds/ring_* backups ## synchronize +#if [ -z "$1" ]; then +## git fetch https://github.com/isra67/indoorpy.git master +# git fetch https://github.com/isra67/indoorpy.git +#else +## git fetch https://isra67:$1@github.com/isra67/indoorpy.git master +# git fetch https://isra67:$1@github.com/isra67/indoorpy.git +#fi +#git reset --hard ##gh/master +#git clean -dn if [ -z "$1" ]; then - git fetch https://github.com/isra67/indoorpy.git master +# git pull --rebase https://github.com/isra67/indoorpy.git master + git pull --rebase https://github.com/isra67/indoorpy.git else - git fetch https://isra67:$1@github.com/isra67/indoorpy.git master +# git pull --rebase https://isra67:$1@github.com/isra67/indoorpy.git master + git pull --rebase https://isra67:$1@github.com/isra67/indoorpy.git fi -git reset --hard ##gh/master git clean -dn -if [ -z "$1" ]; then - git pull --rebase https://github.com/isra67/indoorpy.git master -else - git pull --rebase https://isra67:$1@github.com/isra67/indoorpy.git master -fi ## remove unnecessary files rm -f my_lib/*.py diff --git a/tunnel.sh b/tunnel.sh index c509330..71c685a 100755 --- a/tunnel.sh +++ b/tunnel.sh @@ -26,7 +26,7 @@ tunnel_task() { tunnel_stop() { pkill -9 -f "ssh -N" - pkill -9 tunnel.sh + pkill -9 "/root/indoorpy/tunnel.sh" } @@ -35,7 +35,7 @@ case "$1" in tunnel_task >& /dev/null & ;; stop) - tunnel_stop + tunnel_stop >& /dev/null & ;; *) echo "Usage: tunnel.sh [start|stop] [PORT]" >&2