Skip to content

Commit

Permalink
bugfixes: tunnel stop & SIP regs & updates
Browse files Browse the repository at this point in the history
  • Loading branch information
isra67 committed Sep 25, 2017
1 parent 2857db1 commit 1c7446b
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 23 deletions.
12 changes: 6 additions & 6 deletions indoor.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion my_lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -91,6 +91,7 @@
LOG_LEVEL = 3 #5 # basic SIP log level
current_call = None
acc = None
sipRegStatus = False

# ### variables & constatnts: ###
main_state = 0
Expand Down
Binary file modified my_lib/constants.pyc
Binary file not shown.
19 changes: 13 additions & 6 deletions pjindoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


# ##############################################################################
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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


# ###############################################################
Expand Down Expand Up @@ -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())


# ###############################################################
Expand Down Expand Up @@ -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)


# ###############################################################
Expand Down
21 changes: 13 additions & 8 deletions share/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:[email protected]/isra67/indoorpy.git master
# git fetch https://isra67:[email protected]/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:[email protected]/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
Expand Down
4 changes: 2 additions & 2 deletions tunnel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tunnel_task() {

tunnel_stop() {
pkill -9 -f "ssh -N"
pkill -9 tunnel.sh
pkill -9 "/root/indoorpy/tunnel.sh"
}


Expand All @@ -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
Expand Down

0 comments on commit 1c7446b

Please sign in to comment.