@telnyx/react-voice-commons-sdk 0.1.2 → 0.1.4
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.
- package/CHANGELOG.md +60 -0
- package/README.md +469 -483
- package/ios/CallKitBridge.swift +2 -7
- package/lib/callkit/callkit-coordinator.d.ts +110 -117
- package/lib/callkit/callkit-coordinator.js +664 -727
- package/lib/callkit/callkit.d.ts +41 -41
- package/lib/callkit/callkit.js +252 -242
- package/lib/callkit/index.js +15 -47
- package/lib/callkit/use-callkit.d.ts +19 -19
- package/lib/callkit/use-callkit.js +270 -310
- package/lib/context/TelnyxVoiceContext.d.ts +9 -9
- package/lib/context/TelnyxVoiceContext.js +10 -13
- package/lib/hooks/use-callkit-coordinator.d.ts +9 -17
- package/lib/hooks/use-callkit-coordinator.js +45 -50
- package/lib/hooks/useAppReadyNotifier.js +13 -15
- package/lib/hooks/useAppStateHandler.d.ts +6 -11
- package/lib/hooks/useAppStateHandler.js +95 -110
- package/lib/hooks/useNetworkStateHandler.d.ts +0 -0
- package/lib/hooks/useNetworkStateHandler.js +0 -0
- package/lib/index.d.ts +3 -21
- package/lib/index.js +50 -201
- package/lib/internal/CallKitHandler.d.ts +6 -6
- package/lib/internal/CallKitHandler.js +96 -104
- package/lib/internal/callkit-manager.d.ts +57 -57
- package/lib/internal/callkit-manager.js +299 -316
- package/lib/internal/calls/call-state-controller.d.ts +73 -86
- package/lib/internal/calls/call-state-controller.js +263 -307
- package/lib/internal/session/session-manager.d.ts +71 -75
- package/lib/internal/session/session-manager.js +360 -424
- package/lib/internal/user-defaults-helpers.js +49 -39
- package/lib/internal/voice-pn-bridge.d.ts +114 -12
- package/lib/internal/voice-pn-bridge.js +212 -5
- package/lib/models/call-state.d.ts +46 -44
- package/lib/models/call-state.js +70 -68
- package/lib/models/call.d.ts +161 -133
- package/lib/models/call.js +454 -382
- package/lib/models/config.d.ts +11 -18
- package/lib/models/config.js +37 -35
- package/lib/models/connection-state.d.ts +10 -10
- package/lib/models/connection-state.js +16 -16
- package/lib/telnyx-voice-app.d.ts +28 -28
- package/lib/telnyx-voice-app.js +513 -480
- package/lib/telnyx-voip-client.d.ts +167 -167
- package/lib/telnyx-voip-client.js +385 -390
- package/package.json +115 -104
- package/src/callkit/callkit-coordinator.ts +830 -846
- package/src/hooks/useNetworkStateHandler.ts +0 -0
- package/src/internal/calls/call-state-controller.ts +407 -384
- package/src/internal/session/session-manager.ts +483 -467
- package/src/internal/voice-pn-bridge.ts +266 -18
- package/src/models/call-state.ts +105 -98
- package/src/models/call.ts +502 -388
- package/src/telnyx-voice-app.tsx +788 -690
- package/src/telnyx-voip-client.ts +551 -539
- package/src/types/telnyx-sdk.d.ts +93 -79
package/ios/CallKitBridge.swift
CHANGED
|
@@ -563,14 +563,9 @@ import React
|
|
|
563
563
|
NSLog(
|
|
564
564
|
"🎧🎧🎧 TelnyxVoice: AUDIO SESSION ACTIVATED BY CALLKIT - USER ANSWERED THE CALL! 🎧🎧🎧")
|
|
565
565
|
NSLog("🎧 Provider: \(provider)")
|
|
566
|
-
NSLog(
|
|
567
|
-
"🎧 Audio session details: active=\(audioSession.isOtherAudioPlaying), category=\(audioSession.category.rawValue), mode=\(audioSession.mode.rawValue)"
|
|
568
|
-
)
|
|
569
|
-
NSLog(
|
|
570
|
-
"🎧 Current RTCAudioSession state - useManualAudio=\(RTCAudioSession.sharedInstance().useManualAudio), isAudioEnabled=\(RTCAudioSession.sharedInstance().isAudioEnabled)"
|
|
571
|
-
)
|
|
572
566
|
|
|
573
|
-
|
|
567
|
+
|
|
568
|
+
// CRITICAL: Activate WebRTC audio session
|
|
574
569
|
RTCAudioSession.sharedInstance().audioSessionDidActivate(audioSession)
|
|
575
570
|
RTCAudioSession.sharedInstance().isAudioEnabled = true
|
|
576
571
|
NSLog("🎧 TelnyxVoice: WebRTC RTCAudioSession activated and audio enabled")
|
|
@@ -8,123 +8,116 @@ import { TelnyxVoipClient } from '../telnyx-voip-client';
|
|
|
8
8
|
* guidelines for proper CallKit integration.
|
|
9
9
|
*/
|
|
10
10
|
declare class CallKitCoordinator {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
call: Call,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
* This helps prevent disconnection during push call handling
|
|
122
|
-
*/
|
|
123
|
-
getIsCallFromPush(): boolean;
|
|
124
|
-
/**
|
|
125
|
-
* Check if CallKit is available and coordinator is active
|
|
126
|
-
*/
|
|
127
|
-
isAvailable(): boolean;
|
|
11
|
+
private static instance;
|
|
12
|
+
private callMap;
|
|
13
|
+
private processingCalls;
|
|
14
|
+
private endedCalls;
|
|
15
|
+
private connectedCalls;
|
|
16
|
+
private isCallFromPush;
|
|
17
|
+
private shouldAutoAnswerNextCall;
|
|
18
|
+
private voipClient;
|
|
19
|
+
static getInstance(): CallKitCoordinator;
|
|
20
|
+
private constructor();
|
|
21
|
+
private setupCallKitListeners;
|
|
22
|
+
/**
|
|
23
|
+
* Report an incoming call to CallKit (from push notification or socket)
|
|
24
|
+
* For push notifications, the call is already reported - we just need to map it
|
|
25
|
+
*/
|
|
26
|
+
reportIncomingCall(call: Call, callerName: string, callerNumber: string): Promise<string | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Start an outgoing call through CallKit
|
|
29
|
+
*/
|
|
30
|
+
startOutgoingCall(call: Call, destinationNumber: string, displayName?: string): Promise<string | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Answer a call from the app UI (CallKit-first approach)
|
|
33
|
+
*/
|
|
34
|
+
answerCallFromUI(call: Call): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* End a call from the app UI (CallKit-first approach)
|
|
37
|
+
*/
|
|
38
|
+
endCallFromUI(call: Call): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Handle CallKit answer action (triggered by CallKit)
|
|
41
|
+
*/
|
|
42
|
+
handleCallKitAnswer(callKitUUID: string, event?: any): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Handle CallKit end action (triggered by CallKit)
|
|
45
|
+
*/
|
|
46
|
+
private handleCallKitEnd;
|
|
47
|
+
/**
|
|
48
|
+
* Handle CallKit start action (triggered by CallKit for outgoing calls)
|
|
49
|
+
*/
|
|
50
|
+
private handleCallKitStart;
|
|
51
|
+
/**
|
|
52
|
+
* Handle CallKit push received event
|
|
53
|
+
* This allows us to coordinate between the push notification and any subsequent WebRTC calls
|
|
54
|
+
*/
|
|
55
|
+
handleCallKitPushReceived(callKitUUID: string, event?: any): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Handle push notification answer - when user answers from CallKit but we don't have a WebRTC call yet
|
|
58
|
+
* This is the iOS equivalent of the Android FCM handler
|
|
59
|
+
*/
|
|
60
|
+
private handlePushNotificationAnswer;
|
|
61
|
+
/**
|
|
62
|
+
* Handle push notification reject - when user rejects from CallKit but we don't have a WebRTC call yet
|
|
63
|
+
* This is the iOS equivalent of the Android FCM handler reject
|
|
64
|
+
*/
|
|
65
|
+
private handlePushNotificationReject;
|
|
66
|
+
/**
|
|
67
|
+
* Set up listeners for WebRTC call state changes
|
|
68
|
+
*/
|
|
69
|
+
private setupWebRTCCallListeners;
|
|
70
|
+
/**
|
|
71
|
+
* Clean up call mappings and listeners
|
|
72
|
+
*/
|
|
73
|
+
private cleanupCall;
|
|
74
|
+
/**
|
|
75
|
+
* Get CallKit UUID for a WebRTC call
|
|
76
|
+
*/
|
|
77
|
+
getCallKitUUID(call: Call): string | null;
|
|
78
|
+
/**
|
|
79
|
+
* Get WebRTC call for a CallKit UUID
|
|
80
|
+
*/
|
|
81
|
+
getWebRTCCall(callKitUUID: string): Call | null;
|
|
82
|
+
/**
|
|
83
|
+
* Link an existing CallKit call (from push notification) with a WebRTC call
|
|
84
|
+
* This should be called when a WebRTC call arrives that corresponds to an existing CallKit call
|
|
85
|
+
*/
|
|
86
|
+
linkExistingCallKitCall(call: Call, callKitUUID: string): void;
|
|
87
|
+
/**
|
|
88
|
+
* Set the VoIP client reference for triggering reconnection
|
|
89
|
+
*/
|
|
90
|
+
setVoipClient(voipClient: TelnyxVoipClient): void;
|
|
91
|
+
/**
|
|
92
|
+
* Helper method to clean up push notification state
|
|
93
|
+
*/
|
|
94
|
+
private cleanupPushNotificationState;
|
|
95
|
+
/**
|
|
96
|
+
* Get reference to the SDK client (for queuing actions when call doesn't exist yet)
|
|
97
|
+
*/
|
|
98
|
+
private getSDKClient;
|
|
99
|
+
/**
|
|
100
|
+
* Check if app is in background and disconnect client if no active calls
|
|
101
|
+
*/
|
|
102
|
+
private checkBackgroundDisconnection;
|
|
103
|
+
/**
|
|
104
|
+
* Reset only flags (keeping active call mappings intact)
|
|
105
|
+
*/
|
|
106
|
+
resetFlags(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Check if there are any calls currently being processed by CallKit
|
|
109
|
+
* This helps prevent premature flag resets during CallKit operations
|
|
110
|
+
*/
|
|
111
|
+
hasProcessingCalls(): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Check if there's currently a call from push notification being processed
|
|
114
|
+
* This helps prevent disconnection during push call handling
|
|
115
|
+
*/
|
|
116
|
+
getIsCallFromPush(): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Check if CallKit is available and coordinator is active
|
|
119
|
+
*/
|
|
120
|
+
isAvailable(): boolean;
|
|
128
121
|
}
|
|
129
122
|
export declare const callKitCoordinator: CallKitCoordinator;
|
|
130
123
|
export default callKitCoordinator;
|