From 7a4458c2e27479520294740ce38f1293ff37355e Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 11 Aug 2014 15:34:12 +0200 Subject: [PATCH] Set linphone core callbacks as instance methods in the Python example. --- tools/python/linphone-daemon.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/python/linphone-daemon.py b/tools/python/linphone-daemon.py index 8f4d0eab7..547aba918 100644 --- a/tools/python/linphone-daemon.py +++ b/tools/python/linphone-daemon.py @@ -387,6 +387,17 @@ class Daemon: TerminateCommand() ] + def global_state_changed(self, core, state, message): + logging.warning("[PYTHON] global_state_changed: " + str(state) + ", " + message) + if state == linphone.GlobalState.GlobalOn: + logging.warning("[PYTHON] core version: " + str(core.version)) + + def registration_state_changed(self, core, proxy_cfg, state, message): + logging.warning("[PYTHON] registration_state_changed: " + str(state) + ", " + message) + + def call_state_changed(self, core, call, state, message): + logging.warning("[PYTHON] call_state_changed: " + str(state) + ", " + message) + def send_response(self, response): print(response) @@ -414,21 +425,10 @@ class Daemon: while not daemon.quitting: daemon.interact() - def global_state_changed(core, state, message): - logging.warning("[PYTHON] global_state_changed: " + str(state) + ", " + message) - if state == linphone.GlobalState.GlobalOn: - logging.warning("[PYTHON] core version: " + str(core.version)) - - def registration_state_changed(core, proxy_cfg, state, message): - logging.warning("[PYTHON] registration_state_changed: " + str(state) + ", " + message) - - def call_state_changed(core, call, state, message): - logging.warning("[PYTHON] call_state_changed: " + str(state) + ", " + message) - callbacks = { - 'global_state_changed':global_state_changed, - 'registration_state_changed':registration_state_changed, - 'call_state_changed':call_state_changed + 'global_state_changed':self.global_state_changed, + 'registration_state_changed':self.registration_state_changed, + 'call_state_changed':self.call_state_changed } # Create a linphone core and iterate every 20 ms