Add version function

This commit is contained in:
sqozz 2021-02-25 10:33:54 +01:00
parent 81f2b1695f
commit dc9d61acfb
2 changed files with 9 additions and 0 deletions

View File

@ -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):

View File

@ -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