From 9e5c0a69ee89dad2999175da68c275b165e4b14f Mon Sep 17 00:00:00 2001 From: sqozz Date: Tue, 1 Sep 2020 17:52:51 +0200 Subject: [PATCH] Add dtmf tones --- README.md | 1 + pylinphone.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index ca29f39..d2c385c 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Currently implemented Features: * mute the call (`mute-call`) * pause the call (`call-pause`) * resume the call (`call-resume`) +* play dtmf tones (`dtmf`) Features supported by the unix socket (linphone deamon): diff --git a/pylinphone.py b/pylinphone.py index 26a43ee..c463a96 100644 --- a/pylinphone.py +++ b/pylinphone.py @@ -101,6 +101,14 @@ class LinphoneCommunicationSocket(): else: raise RuntimeError(answer["error"]) + def dtmf(self, digit): + self.socket.send("dtmf {digit}".format(digit=digit).encode("ascii")) + answer = self._await_answer() + if answer["status"]: + return True + else: + raise RuntimeError(answer["error"]) + def process_event(self): self.socket.send("pop-event".encode("ascii")) answer = self._await_answer()