|
|
|
@ -41,7 +41,7 @@ class PhoneEvent(object):
@@ -41,7 +41,7 @@ class PhoneEvent(object):
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
def string(cls, val): |
|
|
|
|
for k, v in vars(cls).items(): |
|
|
|
|
for k, v in vars(cls).iteritems(): |
|
|
|
|
if v == val: |
|
|
|
|
return k |
|
|
|
|
|
|
|
|
@ -87,12 +87,12 @@ class PhoneInterface(object):
@@ -87,12 +87,12 @@ class PhoneInterface(object):
|
|
|
|
|
#self.__core.video_display_enabled = False |
|
|
|
|
|
|
|
|
|
def __global_state_changed(self, core, state, msg): |
|
|
|
|
print('Global state changed:', state, msg) |
|
|
|
|
print 'Global state changed:', state, msg |
|
|
|
|
# TODO: Do we need events emitted here? |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
def __registration_state_changed(self, core, proxyconf, state, msg): |
|
|
|
|
print('Registration state changed:', proxyconf, state, msg) |
|
|
|
|
print 'Registration state changed:', proxyconf, state, msg |
|
|
|
|
evt = None |
|
|
|
|
if state == linphone.RegistrationState.Progress: |
|
|
|
|
evt = PhoneEvent.RegInProgress |
|
|
|
@ -105,10 +105,10 @@ class PhoneInterface(object):
@@ -105,10 +105,10 @@ class PhoneInterface(object):
|
|
|
|
|
for cb in self.__event_cbs: |
|
|
|
|
cb(evt) |
|
|
|
|
else: |
|
|
|
|
print('Unhandled registration state:', linphone.RegistrationState.string(state)) |
|
|
|
|
print 'Unhandled registration state:', linphone.RegistrationState.string(state) |
|
|
|
|
|
|
|
|
|
def __call_state_changed(self, core, call, state, msg): |
|
|
|
|
print('Call state changed:', call, state, msg) |
|
|
|
|
print 'Call state changed:', call, state, msg |
|
|
|
|
evt = None |
|
|
|
|
if state == linphone.CallState.IncomingReceived: |
|
|
|
|
evt = PhoneEvent.CallIncoming |
|
|
|
@ -131,7 +131,7 @@ class PhoneInterface(object):
@@ -131,7 +131,7 @@ class PhoneInterface(object):
|
|
|
|
|
for cb in self.__event_cbs: |
|
|
|
|
cb(evt) |
|
|
|
|
else: |
|
|
|
|
print('Unhandled call state:', linphone.CallState.string(state)) |
|
|
|
|
print 'Unhandled call state:', linphone.CallState.string(state) |
|
|
|
|
|
|
|
|
|
def __pollthread(self): |
|
|
|
|
while self.__running: |
|
|
|
@ -199,7 +199,7 @@ class PhoneInterface(object):
@@ -199,7 +199,7 @@ class PhoneInterface(object):
|
|
|
|
|
self.__audioproc.terminate() |
|
|
|
|
|
|
|
|
|
def read_text(self, text): |
|
|
|
|
self.__ttsproc.stdin.write(text.encode('utf8') + b'\n') |
|
|
|
|
self.__ttsproc.stdin.write(text + '\n') |
|
|
|
|
self.__ttsproc.stdin.flush() |
|
|
|
|
|
|
|
|
|
def get_remote_number(self): |
|
|
|
@ -207,7 +207,7 @@ class PhoneInterface(object):
@@ -207,7 +207,7 @@ class PhoneInterface(object):
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
def event_cb(evt): |
|
|
|
|
print('Got event:', PhoneEvent.string(evt)) |
|
|
|
|
print 'Got event:', PhoneEvent.string(evt) |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
phone = PhoneInterface('.linphonerc-foo', '.linphonerc') |
|
|
|
|