Improve answer/terminate error handling
This commit is contained in:
parent
6415798162
commit
5abaaa5353
2 changed files with 14 additions and 1 deletions
|
@ -5,6 +5,7 @@ Currently implemented Features:
|
||||||
* check status for an registered account (`register-status` and `register-info`)
|
* check status for an registered account (`register-status` and `register-info`)
|
||||||
* event-queue polling and onEvent functions (`pop-event`)
|
* event-queue polling and onEvent functions (`pop-event`)
|
||||||
* answer an incoming call (`accept`)
|
* answer an incoming call (`accept`)
|
||||||
|
* terminate a running call (`terminate`)
|
||||||
|
|
||||||
|
|
||||||
Features supported by the unix socket (linphone deamon):
|
Features supported by the unix socket (linphone deamon):
|
||||||
|
@ -60,4 +61,4 @@ unregister <register_id>|ALL
|
||||||
version
|
version
|
||||||
video [call_id]
|
video [call_id]
|
||||||
videosource cam|dummy [<call_id>]
|
videosource cam|dummy [<call_id>]
|
||||||
```
|
```
|
||||||
|
|
|
@ -56,6 +56,18 @@ class LinphoneCommunicationSocket():
|
||||||
def answer(self, call_id=None):
|
def answer(self, call_id=None):
|
||||||
self.socket.send(("answer {call_id}".format(call_id="" if call_id == None else call_id)).encode("ascii"))
|
self.socket.send(("answer {call_id}".format(call_id="" if call_id == None else call_id)).encode("ascii"))
|
||||||
answer = self._await_answer()
|
answer = self._await_answer()
|
||||||
|
if answer["status"]:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
raise RuntimeError(answer["error"])
|
||||||
|
|
||||||
|
def terminate(self, call_id=None):
|
||||||
|
self.socket.send(("terminate {call_id}".format(call_id="" if call_id == None else call_id)).encode("ascii"))
|
||||||
|
answer = self._await_answer()
|
||||||
|
if answer["status"]:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
raise RuntimeError(answer["error"])
|
||||||
|
|
||||||
def process_event(self):
|
def process_event(self):
|
||||||
self.socket.send("pop-event".encode("ascii"))
|
self.socket.send("pop-event".encode("ascii"))
|
||||||
|
|
Loading…
Reference in a new issue