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 {