Further slight placation

This commit is contained in:
Maff 2019-05-03 19:44:43 +01:00
parent c53aa77758
commit 92c3fe8c72
1 changed files with 13 additions and 17 deletions

View File

@ -25,10 +25,18 @@ from random import shuffle
## ##
## If you can get this working using PJSUA2, a pull request would be greatly appreciated. ## If you can get this working using PJSUA2, a pull request would be greatly appreciated.
state=None # Utility classes, used basically as enums or generics
class State(object):
# Application scaffolding running=False
# logger functions class PJStates:
init=0
deinit=1
class SIPStates:
ringing=180
answer=200
#Utility and state definitions
state=State()
# Logging
def PJLog(level, line, length): def PJLog(level, line, length):
Log(level+1, "pjsip", line) Log(level+1, "pjsip", line)
def Log(level, source, line, error=False): def Log(level, source, line, error=False):
@ -37,7 +45,7 @@ def Log(level, source, line, error=False):
pfx='!' pfx='!'
print("%s %s: %s" % (pfx*level, source, line)) print("%s %s: %s" % (pfx*level, source, line))
sys.stdout.flush() sys.stdout.flush()
#Generic signal handler # Signal handling
def sighandle(_signo, _stack_frame): def sighandle(_signo, _stack_frame):
global state global state
Log(1, "sighandler", "caught signal %s" % _signo) Log(1, "sighandler", "caught signal %s" % _signo)
@ -55,18 +63,6 @@ def sighandle(_signo, _stack_frame):
state.running=False state.running=False
pass pass
# Utility classes, used basically as enums or generics
class State(object):
running=False
class PJStates:
init=0
deinit=1
class SIPStates:
ringing=180
answer=200
state=State()
# Classes # Classes
# Account Callback class # Account Callback class
class AccountCb(pj.AccountCallback): class AccountCb(pj.AccountCallback):