diff --git a/README.md b/README.md index 3b21fdc..c0af557 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Currently implemented Features: * get call status (`call-status`) * get call stats (`call-stats`) * unregister an account (`unregister`) +* get daemon version (`version`) Features supported by the unix socket (linphone deamon): diff --git a/pylinphone.py b/pylinphone.py index a33eac7..ddf4d61 100644 --- a/pylinphone.py +++ b/pylinphone.py @@ -24,6 +24,14 @@ class LinphoneCommunicationSocket(): self.socket.send(command.encode("ascii")) return self._await_answer() + def version(self): + answer = self.send_command("version") + + if answer["status"]: + return answer["data"][0].split(":", 1)[1].strip() + else: + raise RuntimeError(answer["error"]) + def register(self, identity, proxy_address, password = "NULL", userid = "NULL", realm = "NULL", parameters = None): answer = self.send_command(("register {identity} {proxy_address} {password} {userid} {realm} {parameters}".format(identity=identity, proxy_address=proxy_address, password=password, userid=userid, realm=realm, parameters="" if parameters else parameters))) return int(answer["data"][0].split(":", 1)[1].strip()) #id of newly registered account