Implement outgoing calls

This commit is contained in:
sqozz 2020-09-01 10:36:48 +02:00
parent 5abaaa5353
commit 712f56abcc
2 changed files with 21 additions and 0 deletions

View file

@ -4,6 +4,7 @@ Currently implemented Features:
* register a new account (`register`)
* check status for an registered account (`register-status` and `register-info`)
* event-queue polling and onEvent functions (`pop-event`)
* create an outgoing call (`call`)
* answer an incoming call (`accept`)
* terminate a running call (`terminate`)

View file

@ -69,6 +69,14 @@ class LinphoneCommunicationSocket():
else:
raise RuntimeError(answer["error"])
def call(self, sip_address):
self.socket.send("call {sip_address}".format(sip_address=sip_address).encode("ascii"))
answer = self._await_answer()
if answer["status"]:
return answer["data"][0].split(":", 1)[1].strip()
else:
raise RuntimeError(answer["error"])
def process_event(self):
self.socket.send("pop-event".encode("ascii"))
answer = self._await_answer()
@ -150,3 +158,15 @@ class LinphoneCommunicationSocket():
print("dummy onLinphoneCallStreamsRunning")
pass
def onLinphoneCallOutgoingInit(self, event):
print("dummy onLinphoneCallOutgoingInit")
pass
def onLinphoneCallOutgoingProgress(self, event):
print("dummy onLinphoneCallOutgoingProgress")
pass
def onLinphoneCallOutgoingRinging(self, event):
print("dummy onLinphoneCallOutgoingRinging")
pass