diff --git a/README.md b/README.md index c44a554..3b21fdc 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Currently implemented Features: * play dtmf tones (`dtmf`) * get call status (`call-status`) * get call stats (`call-stats`) +* unregister an account (`unregister`) Features supported by the unix socket (linphone deamon): diff --git a/pylinphone.py b/pylinphone.py index 8bb86db..a33eac7 100644 --- a/pylinphone.py +++ b/pylinphone.py @@ -28,6 +28,14 @@ class LinphoneCommunicationSocket(): 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 + def unregister(self, register_id): + self.send_command("unregister {register_id}".format(register_id=register_id)) + + if answer["status"]: + return True + else: + raise RuntimeError(answer["error"]) + def register_status(self, account_id=None): answer = self.send_command(("register-status {account_id}".format(account_id="ALL" if account_id == None else account_id))) accounts = []