| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2023-10-10 21:12:47 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2023-10-10 21:12:47 UTC |
| parent | 83a9af963752326303c14a041301aacf0b0f2c83 |
| xmpp/Chat.hx | +9 | -0 |
| xmpp/jingle/PeerConnection.js.hx | +1 | -0 |
| xmpp/jingle/Session.hx | +16 | -0 |
diff --git a/xmpp/Chat.hx b/xmpp/Chat.hx index 123a8cd..8458fb5 100644 --- a/xmpp/Chat.hx +++ b/xmpp/Chat.hx @@ -114,6 +114,15 @@ abstract class Chat { return "none"; } + public function dtmf() { + for (session in jingleSessions) { + final dtmf = session.dtmf(); + if (dtmf != null) return dtmf; + } + + return null; + } + public function videoTracks() { return jingleSessions.flatMap((session) -> session.videoTracks()); } diff --git a/xmpp/jingle/PeerConnection.js.hx b/xmpp/jingle/PeerConnection.js.hx index 1480ec8..8d4b4b1 100644 --- a/xmpp/jingle/PeerConnection.js.hx +++ b/xmpp/jingle/PeerConnection.js.hx @@ -7,3 +7,4 @@ typedef SdpType = js.html.rtc.SdpType; typedef Promise<T> = js.lib.Promise<T>; typedef MediaStream = js.html.MediaStream; typedef MediaStreamTrack = js.html.MediaStreamTrack; +typedef DTMFSender = js.html.rtc.DTMFSender; diff --git a/xmpp/jingle/Session.hx b/xmpp/jingle/Session.hx index 1276d5e..ab55b54 100644 --- a/xmpp/jingle/Session.hx +++ b/xmpp/jingle/Session.hx @@ -18,6 +18,7 @@ interface Session { public function addMedia(streams: Array<MediaStream>): Void; public function callStatus():String; public function videoTracks():Array<MediaStreamTrack>; + public function dtmf():Null<DTMFSender>; } class IncomingProposedSession implements Session { @@ -98,6 +99,10 @@ class IncomingProposedSession implements Session { return []; } + public function dtmf() { + return null; + } + private function get_sid() { return this._sid; } @@ -193,6 +198,10 @@ class OutgoingProposedSession implements Session { return []; } + public function dtmf() { + return null; + } + private function get_sid() { return this._sid; } @@ -371,6 +380,13 @@ class InitiatedSession implements Session { .map((t) -> t.receiver.track); } + public function dtmf() { + if (pc == null) return null; + final transceiver = pc.getTransceivers().find((t) -> t.sender != null && t.sender.track != null && t.sender.track.kind == "audio" && !t.sender.track.muted); + if (transceiver == null) return null; + return transceiver.sender.dtmf; + } + private function sendIceCandidate(candidate: { candidate: String, sdpMid: String, usernameFragment: String }) { if (candidate == null) return; // All candidates received now if (candidate.candidate == "") return; // All candidates received now