@capgo/capacitor-twilio-voice 8.1.0 → 8.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,7 +75,7 @@ import org.json.JSONObject;
75
75
  )
76
76
  public class CapacitorTwilioVoicePlugin extends Plugin {
77
77
 
78
- private final String pluginVersion = "8.1.0";
78
+ private final String pluginVersion = "8.1.1";
79
79
 
80
80
  private static final String TAG = "CapacitorTwilioVoice";
81
81
  private static final String PREF_ACCESS_TOKEN = "twilio_access_token";
@@ -134,6 +134,7 @@ public class VoiceCallService extends Service {
134
134
 
135
135
  // Clean up audio switch
136
136
  if (audioSwitch != null) {
137
+ deactivateAudioSwitch();
137
138
  audioSwitch.stop();
138
139
  audioSwitch = null;
139
140
  }
@@ -164,6 +165,30 @@ public class VoiceCallService extends Service {
164
165
  });
165
166
  }
166
167
 
168
+ private void activateAudioSwitch() {
169
+ if (audioSwitch == null) {
170
+ return;
171
+ }
172
+
173
+ try {
174
+ audioSwitch.activate();
175
+ } catch (Exception e) {
176
+ Log.e(TAG, "Failed to activate AudioSwitch", e);
177
+ }
178
+ }
179
+
180
+ private void deactivateAudioSwitch() {
181
+ if (audioSwitch == null) {
182
+ return;
183
+ }
184
+
185
+ try {
186
+ audioSwitch.deactivate();
187
+ } catch (Exception e) {
188
+ Log.e(TAG, "Failed to deactivate AudioSwitch", e);
189
+ }
190
+ }
191
+
167
192
  public void setServiceListener(VoiceCallServiceListener listener) {
168
193
  this.serviceListener = listener;
169
194
  }
@@ -250,6 +275,7 @@ public class VoiceCallService extends Service {
250
275
  boolean speakerEnabled = intent.getBooleanExtra(EXTRA_SPEAKER_ENABLED, false);
251
276
 
252
277
  if (audioSwitch != null) {
278
+ activateAudioSwitch();
253
279
  List<AudioDevice> audioDevices = audioSwitch.getAvailableAudioDevices();
254
280
  AudioDevice selectedDevice = null;
255
281
 
@@ -394,6 +420,8 @@ public class VoiceCallService extends Service {
394
420
  activeCall = call;
395
421
  currentCallSid = call.getSid();
396
422
 
423
+ activateAudioSwitch();
424
+
397
425
  // Update notification to show connected state with actions
398
426
  updateOngoingCallNotification();
399
427
 
@@ -445,6 +473,8 @@ public class VoiceCallService extends Service {
445
473
  isCallMuted = false;
446
474
  isSpeakerEnabled = false;
447
475
 
476
+ deactivateAudioSwitch();
477
+
448
478
  if (serviceListener != null) {
449
479
  serviceListener.onCallDisconnected(call, error);
450
480
  }
@@ -27,7 +27,7 @@ public protocol PushKitEventDelegate: AnyObject {
27
27
  */
28
28
  @objc(CapacitorTwilioVoicePlugin)
29
29
  public class CapacitorTwilioVoicePlugin: CAPPlugin, CAPBridgedPlugin, PushKitEventDelegate {
30
- private let pluginVersion: String = "8.1.0"
30
+ private let pluginVersion: String = "8.1.1"
31
31
 
32
32
  public let identifier = "CapacitorTwilioVoicePlugin"
33
33
  public let jsName = "CapacitorTwilioVoice"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/capacitor-twilio-voice",
3
- "version": "8.1.0",
3
+ "version": "8.1.1",
4
4
  "description": "Integrates the Twilio Voice SDK into Capacitor",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",