@voipsdk/react-native-voipcloud 0.2.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.
Files changed (43) hide show
  1. package/README.md +172 -0
  2. package/android/build.gradle +61 -0
  3. package/android/src/main/AndroidManifest.xml +2 -0
  4. package/android/src/main/java/com/voipcloud/sdk/rn/VoipCloudModule.java +428 -0
  5. package/android/src/main/java/com/voipcloud/sdk/rn/VoipCloudPackage.java +21 -0
  6. package/android/src/main/java/com/voipcloud/sdk/rn/internal/Events.java +38 -0
  7. package/android/src/main/java/com/voipcloud/sdk/rn/internal/ManagedAccount.java +63 -0
  8. package/android/src/main/java/com/voipcloud/sdk/rn/internal/ManagedCall.java +179 -0
  9. package/android/src/main/java/com/voipcloud/sdk/rn/internal/ManagedCallRegistry.java +26 -0
  10. package/android/src/main/libs/voipcloud-release.aar +0 -0
  11. package/ios/VoipCloud.mm +40 -0
  12. package/lib/commonjs/License.js +51 -0
  13. package/lib/commonjs/License.js.map +1 -0
  14. package/lib/commonjs/VoipCloud.js +89 -0
  15. package/lib/commonjs/VoipCloud.js.map +1 -0
  16. package/lib/commonjs/events.js +29 -0
  17. package/lib/commonjs/events.js.map +1 -0
  18. package/lib/commonjs/index.js +27 -0
  19. package/lib/commonjs/index.js.map +1 -0
  20. package/lib/commonjs/types.js +2 -0
  21. package/lib/commonjs/types.js.map +1 -0
  22. package/lib/module/License.js +45 -0
  23. package/lib/module/License.js.map +1 -0
  24. package/lib/module/VoipCloud.js +83 -0
  25. package/lib/module/VoipCloud.js.map +1 -0
  26. package/lib/module/events.js +23 -0
  27. package/lib/module/events.js.map +1 -0
  28. package/lib/module/index.js +4 -0
  29. package/lib/module/index.js.map +1 -0
  30. package/lib/module/types.js +2 -0
  31. package/lib/module/types.js.map +1 -0
  32. package/lib/typescript/License.d.ts +31 -0
  33. package/lib/typescript/VoipCloud.d.ts +52 -0
  34. package/lib/typescript/events.d.ts +6 -0
  35. package/lib/typescript/index.d.ts +4 -0
  36. package/lib/typescript/types.d.ts +136 -0
  37. package/package.json +76 -0
  38. package/react-native-voipcloud.podspec +16 -0
  39. package/src/License.ts +52 -0
  40. package/src/VoipCloud.ts +98 -0
  41. package/src/events.ts +23 -0
  42. package/src/index.ts +23 -0
  43. package/src/types.ts +144 -0
package/src/types.ts ADDED
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Public types for react-native-voipcloud.
3
+ * Keep these stable across versions — they form the API contract.
4
+ */
5
+
6
+ export type Transport = 'UDP' | 'TCP' | 'TLS';
7
+
8
+ export interface InitConfig {
9
+ /** STUN server hostname, e.g. "stun.l.google.com:19302". Optional. */
10
+ stunServer?: string;
11
+ /** User-Agent header value advertised to the SIP server. */
12
+ userAgent?: string;
13
+ /** Default log level 0–6 (PJSIP convention; 4 = info). */
14
+ logLevel?: number;
15
+ }
16
+
17
+ export interface AccountConfig {
18
+ /** AOR — e.g. "sip:alice@example.com". */
19
+ uri: string;
20
+ /**
21
+ * Registrar URI — e.g. "sip:example.com" or
22
+ * "sip:example.com:5061;transport=tls". The transport is taken from
23
+ * the `;transport=` parameter on this URI; if absent, PJSIP defaults
24
+ * to UDP.
25
+ */
26
+ registrar: string;
27
+ /** Auth username (often the same as the local part of `uri`). */
28
+ username: string;
29
+ /** Auth password (will be sent only in challenge response, never logged). */
30
+ password: string;
31
+ /**
32
+ * Hint for the transport you intend to use. Informational only —
33
+ * the actual transport is resolved from the `registrar` URI. Keep
34
+ * the two in sync to avoid surprises.
35
+ */
36
+ transport: Transport;
37
+ }
38
+
39
+ export interface LicenseStatus {
40
+ /** True if voipcloud_license_is_valid() returned 1 at call time. */
41
+ valid: boolean;
42
+ /** Server-side label: "active" | "trial" | "suspended" | "expired" | "unset". */
43
+ status: string;
44
+ /** Customer identifier embedded in the token. */
45
+ customerId: string;
46
+ /** Concurrent-call ceiling allowed by the license. */
47
+ ccu: number;
48
+ /** Current count of active calls held by the gate. */
49
+ currentCalls: number;
50
+ /** Token expiry (unix seconds). 0 if unbounded. */
51
+ expiry: number;
52
+ /** Last clock-skew anchor pushed by the refresher (unix seconds). 0 if none yet. */
53
+ serverTime: number;
54
+ }
55
+
56
+ export interface RegistrationStateEvent {
57
+ accountId: number;
58
+ /** SIP response code (200 = registered, 401/407 = auth, etc.). */
59
+ code: number;
60
+ /** Free-form reason string. */
61
+ reason: string;
62
+ }
63
+
64
+ export interface IncomingCallEvent {
65
+ accountId: number;
66
+ callId: number;
67
+ /** Remote-party display URI. */
68
+ from: string;
69
+ /** Local AOR. */
70
+ to: string;
71
+ }
72
+
73
+ export type CallState =
74
+ | 'NULL'
75
+ | 'CALLING'
76
+ | 'INCOMING'
77
+ | 'EARLY'
78
+ | 'CONNECTING'
79
+ | 'CONFIRMED'
80
+ | 'DISCONNECTED';
81
+
82
+ export interface CallStateEvent {
83
+ callId: number;
84
+ state: CallState;
85
+ code: number;
86
+ reason: string;
87
+ }
88
+
89
+ export interface CallMediaStateEvent {
90
+ callId: number;
91
+ hasAudio: boolean;
92
+ isHold: boolean;
93
+ isMuted: boolean;
94
+ }
95
+
96
+ /** Fired right after `hold(callId)` succeeds (re-INVITE sent). */
97
+ export interface CallHoldEvent { callId: number; }
98
+ /** Fired right after `unhold(callId)` succeeds. */
99
+ export interface CallUnholdEvent { callId: number; }
100
+ /** Fired right after `mute(callId, isMuted)` succeeds. */
101
+ export interface CallMuteEvent { callId: number; isMuted: boolean; }
102
+ /** Fired right after `sendDtmf(callId, digits)` succeeds. */
103
+ export interface CallDtmfSentEvent { callId: number; digits: string; }
104
+ /** Fired right after `transferCall(callId, destinationUri)` sends the REFER. */
105
+ export interface CallTransferEvent { callId: number; destinationUri: string; }
106
+
107
+ /**
108
+ * Multi-stage progress for a transfer we initiated. Fires once per
109
+ * NOTIFY received from the remote — final stage has `finalNotify=true`
110
+ * and a 2xx statusCode (success) or a 4xx-6xx (failure).
111
+ */
112
+ export interface CallTransferStatusEvent {
113
+ callId: number;
114
+ statusCode: number;
115
+ reason: string;
116
+ finalNotify: boolean;
117
+ }
118
+
119
+ /** RFC 2833 DTMF digit detected on the inbound RTP stream. */
120
+ export interface IncomingDtmfEvent {
121
+ callId: number;
122
+ digit: string;
123
+ /** Duration in PJSIP timer ticks (~ ms with default sampling). */
124
+ duration: number;
125
+ }
126
+
127
+ export interface EventMap {
128
+ registrationState: RegistrationStateEvent;
129
+ incomingCall: IncomingCallEvent;
130
+ callState: CallStateEvent;
131
+ callMediaState: CallMediaStateEvent;
132
+ callHold: CallHoldEvent;
133
+ callUnhold: CallUnholdEvent;
134
+ callMute: CallMuteEvent;
135
+ callDtmfSent: CallDtmfSentEvent;
136
+ callTransfer: CallTransferEvent;
137
+ callTransferStatus: CallTransferStatusEvent;
138
+ incomingDtmf: IncomingDtmfEvent;
139
+ }
140
+
141
+ /** Subscription handle returned by VoipCloud.on(...). */
142
+ export interface Subscription {
143
+ remove(): void;
144
+ }