Add unregister function
This commit is contained in:
parent
beb544b3b6
commit
81f2b1695f
|
@ -13,6 +13,7 @@ Currently implemented Features:
|
||||||
* play dtmf tones (`dtmf`)
|
* play dtmf tones (`dtmf`)
|
||||||
* get call status (`call-status`)
|
* get call status (`call-status`)
|
||||||
* get call stats (`call-stats`)
|
* get call stats (`call-stats`)
|
||||||
|
* unregister an account (`unregister`)
|
||||||
|
|
||||||
|
|
||||||
Features supported by the unix socket (linphone deamon):
|
Features supported by the unix socket (linphone deamon):
|
||||||
|
|
|
@ -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)))
|
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
|
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):
|
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)))
|
answer = self.send_command(("register-status {account_id}".format(account_id="ALL" if account_id == None else account_id)))
|
||||||
accounts = []
|
accounts = []
|
||||||
|
|
Loading…
Reference in a new issue