Browse Source

Implement outgoing calls

master
sqozz 4 years ago
parent
commit
712f56abcc
  1. 1
      README.md
  2. 20
      pylinphone.py

1
README.md

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

20
pylinphone.py

@ -69,6 +69,14 @@ class LinphoneCommunicationSocket():
else: else:
raise RuntimeError(answer["error"]) 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): def process_event(self):
self.socket.send("pop-event".encode("ascii")) self.socket.send("pop-event".encode("ascii"))
answer = self._await_answer() answer = self._await_answer()
@ -150,3 +158,15 @@ class LinphoneCommunicationSocket():
print("dummy onLinphoneCallStreamsRunning") print("dummy onLinphoneCallStreamsRunning")
pass 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

Loading…
Cancel
Save