From 4a92f613d9abb6df2815244a881e2c7fa7c703db Mon Sep 17 00:00:00 2001 From: -g Date: Fri, 13 Oct 2023 12:03:21 +0000 Subject: [PATCH] Speaker Toggle Fix --- TelnyxWebRTCDemo/Extensions/ViewControllerVoIPExtension.swift | 3 +++ TelnyxWebRTCDemo/ViewController.swift | 2 ++ 2 files changed, 5 insertions(+) diff --git a/TelnyxWebRTCDemo/Extensions/ViewControllerVoIPExtension.swift b/TelnyxWebRTCDemo/Extensions/ViewControllerVoIPExtension.swift index a31cfb6e..06af1b89 100644 --- a/TelnyxWebRTCDemo/Extensions/ViewControllerVoIPExtension.swift +++ b/TelnyxWebRTCDemo/Extensions/ViewControllerVoIPExtension.swift @@ -106,6 +106,9 @@ extension ViewController : VoIPDelegate { if(self.isCallOutGoing()){ self.appDelegate.executeOutGoingCall() } + if(self.isSpeakerActive){ + self.telnyxClient?.setSpeaker() + } break case .DONE: self.resetCallStates() diff --git a/TelnyxWebRTCDemo/ViewController.swift b/TelnyxWebRTCDemo/ViewController.swift index 596ea144..c2f9def4 100644 --- a/TelnyxWebRTCDemo/ViewController.swift +++ b/TelnyxWebRTCDemo/ViewController.swift @@ -17,6 +17,7 @@ class ViewController: UIViewController { var userDefaults: UserDefaults = UserDefaults.init() var telnyxClient: TxClient? var incomingCall: Bool = false + var isSpeakerActive : Bool = false var loadingView: UIAlertController? @@ -245,6 +246,7 @@ extension ViewController : UICallScreenDelegate { } func onToggleSpeaker(isSpeakerActive: Bool) { + self.isSpeakerActive = isSpeakerActive if (isSpeakerActive) { self.telnyxClient?.setSpeaker() } else {