@voipsdk/react-native-voipcloud 0.2.1 → 1.0.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.
- package/CHANGELOG.md +44 -0
- package/README.md +182 -117
- package/android/build.gradle +7 -7
- package/android/src/main/java/com/voipcloud/sdk/rn/VoipCloudModule.java +307 -208
- package/android/src/main/java/com/voipcloud/sdk/rn/internal/BridgeGuard.java +74 -0
- package/android/src/main/java/com/voipcloud/sdk/rn/internal/Events.java +7 -2
- package/android/src/main/java/com/voipcloud/sdk/rn/internal/ManagedAccount.java +49 -5
- package/android/src/main/java/com/voipcloud/sdk/rn/internal/ManagedCall.java +58 -2
- package/android/src/main/java/com/voipcloud/sdk/rn/internal/ManagedCallRegistry.java +4 -0
- package/android/src/main/libs/voipcloud-release.aar +0 -0
- package/ios/VoipCloud.mm +8 -8
- package/lib/commonjs/VoipCloud.js +33 -48
- package/lib/commonjs/VoipCloud.js.map +1 -1
- package/lib/commonjs/events.js +13 -7
- package/lib/commonjs/events.js.map +1 -1
- package/lib/commonjs/index.js +2 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/nativeModule.js +18 -0
- package/lib/commonjs/nativeModule.js.map +1 -0
- package/lib/module/VoipCloud.js +34 -48
- package/lib/module/VoipCloud.js.map +1 -1
- package/lib/module/events.js +9 -8
- package/lib/module/events.js.map +1 -1
- package/lib/module/index.js +1 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/nativeModule.js +13 -0
- package/lib/module/nativeModule.js.map +1 -0
- package/lib/typescript/VoipCloud.d.ts +7 -31
- package/lib/typescript/events.d.ts +6 -2
- package/lib/typescript/index.d.ts +2 -3
- package/lib/typescript/nativeModule.d.ts +7 -0
- package/lib/typescript/types.d.ts +5 -17
- package/package.json +7 -5
- package/react-native-voipcloud.podspec +7 -5
- package/src/VoipCloud.ts +42 -49
- package/src/events.ts +9 -8
- package/src/index.ts +1 -3
- package/src/nativeModule.ts +17 -0
- package/src/types.ts +5 -18
- package/lib/commonjs/License.js +0 -51
- package/lib/commonjs/License.js.map +0 -1
- package/lib/module/License.js +0 -45
- package/lib/module/License.js.map +0 -1
- package/lib/typescript/License.d.ts +0 -31
- package/src/License.ts +0 -52
package/src/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Public types for react-native-voipcloud.
|
|
2
|
+
* Public types for @voipsdk/react-native-voipcloud.
|
|
3
3
|
* Keep these stable across versions — they form the API contract.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -36,23 +36,6 @@ export interface AccountConfig {
|
|
|
36
36
|
transport: Transport;
|
|
37
37
|
}
|
|
38
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
39
|
export interface RegistrationStateEvent {
|
|
57
40
|
accountId: number;
|
|
58
41
|
/** SIP response code (200 = registered, 401/407 = auth, etc.). */
|
|
@@ -68,6 +51,8 @@ export interface IncomingCallEvent {
|
|
|
68
51
|
from: string;
|
|
69
52
|
/** Local AOR. */
|
|
70
53
|
to: string;
|
|
54
|
+
/** SIP Call-ID header of the dialog (stable across systems). */
|
|
55
|
+
sipCallId?: string;
|
|
71
56
|
}
|
|
72
57
|
|
|
73
58
|
export type CallState =
|
|
@@ -84,6 +69,8 @@ export interface CallStateEvent {
|
|
|
84
69
|
state: CallState;
|
|
85
70
|
code: number;
|
|
86
71
|
reason: string;
|
|
72
|
+
/** SIP Call-ID header of the dialog (stable across systems). */
|
|
73
|
+
sipCallId?: string;
|
|
87
74
|
}
|
|
88
75
|
|
|
89
76
|
export interface CallMediaStateEvent {
|
package/lib/commonjs/License.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.License = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
const Native = _reactNative.NativeModules.VoipCloud;
|
|
9
|
-
if (!Native) {
|
|
10
|
-
// Defer the error: only thrown if the consumer actually calls a
|
|
11
|
-
// method, so importing the package never crashes at load time.
|
|
12
|
-
console.warn('[react-native-voipcloud] Native module not linked. ' + 'Did you rebuild the Android app after adding the package?');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* License management — all SDK functionality is gated behind a valid
|
|
17
|
-
* token. Customers paste their token (issued by your server) into the
|
|
18
|
-
* app; the app calls {@link set} once at startup and the SDK handles
|
|
19
|
-
* everything else, including periodic refresh.
|
|
20
|
-
*/
|
|
21
|
-
const License = exports.License = {
|
|
22
|
-
/**
|
|
23
|
-
* Apply a license token. Resolves on success, rejects with one of
|
|
24
|
-
* the granular `VC_*` codes if the token is malformed, signed by
|
|
25
|
-
* the wrong key, expired, suspended, or for a different app bundle.
|
|
26
|
-
*
|
|
27
|
-
* Side-effect: if the token's payload includes a `ref` field, the
|
|
28
|
-
* background refresher is started (or restarted with the new URL)
|
|
29
|
-
* automatically — the consumer never types a refresh URL.
|
|
30
|
-
*/
|
|
31
|
-
set(token) {
|
|
32
|
-
return Native.setLicense(token);
|
|
33
|
-
},
|
|
34
|
-
/**
|
|
35
|
-
* Query the current license state. Safe to call before `set`
|
|
36
|
-
* (returns valid=false, status="unset").
|
|
37
|
-
*/
|
|
38
|
-
status() {
|
|
39
|
-
return Native.getLicenseStatus();
|
|
40
|
-
},
|
|
41
|
-
/**
|
|
42
|
-
* Cancel the background refresher. Optional: most apps will
|
|
43
|
-
* never call this. Useful when the user logs out or the SDK is
|
|
44
|
-
* being torn down and you do not want a long-running daemon
|
|
45
|
-
* thread sitting in the process.
|
|
46
|
-
*/
|
|
47
|
-
stopRefresh() {
|
|
48
|
-
return Native.stopLicenseRefresh();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=License.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","Native","NativeModules","VoipCloud","console","warn","License","exports","set","token","setLicense","status","getLicenseStatus","stopRefresh","stopLicenseRefresh"],"sourceRoot":"../../src","sources":["License.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA,MAAMC,MAAM,GAAGC,0BAAa,CAACC,SAAS;AAEtC,IAAI,CAACF,MAAM,EAAE;EACT;EACA;EACAG,OAAO,CAACC,IAAI,CACR,qDAAqD,GACrD,2DACJ,CAAC;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG;EACnB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACIE,GAAGA,CAACC,KAAa,EAAiB;IAC9B,OAAOR,MAAM,CAACS,UAAU,CAACD,KAAK,CAAC;EACnC,CAAC;EAED;AACJ;AACA;AACA;EACIE,MAAMA,CAAA,EAA2B;IAC7B,OAAOV,MAAM,CAACW,gBAAgB,CAAC,CAAC;EACpC,CAAC;EAED;AACJ;AACA;AACA;AACA;AACA;EACIC,WAAWA,CAAA,EAAkB;IACzB,OAAOZ,MAAM,CAACa,kBAAkB,CAAC,CAAC;EACtC;AACJ,CAAC","ignoreList":[]}
|
package/lib/module/License.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
2
|
-
const Native = NativeModules.VoipCloud;
|
|
3
|
-
if (!Native) {
|
|
4
|
-
// Defer the error: only thrown if the consumer actually calls a
|
|
5
|
-
// method, so importing the package never crashes at load time.
|
|
6
|
-
console.warn('[react-native-voipcloud] Native module not linked. ' + 'Did you rebuild the Android app after adding the package?');
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* License management — all SDK functionality is gated behind a valid
|
|
11
|
-
* token. Customers paste their token (issued by your server) into the
|
|
12
|
-
* app; the app calls {@link set} once at startup and the SDK handles
|
|
13
|
-
* everything else, including periodic refresh.
|
|
14
|
-
*/
|
|
15
|
-
export const License = {
|
|
16
|
-
/**
|
|
17
|
-
* Apply a license token. Resolves on success, rejects with one of
|
|
18
|
-
* the granular `VC_*` codes if the token is malformed, signed by
|
|
19
|
-
* the wrong key, expired, suspended, or for a different app bundle.
|
|
20
|
-
*
|
|
21
|
-
* Side-effect: if the token's payload includes a `ref` field, the
|
|
22
|
-
* background refresher is started (or restarted with the new URL)
|
|
23
|
-
* automatically — the consumer never types a refresh URL.
|
|
24
|
-
*/
|
|
25
|
-
set(token) {
|
|
26
|
-
return Native.setLicense(token);
|
|
27
|
-
},
|
|
28
|
-
/**
|
|
29
|
-
* Query the current license state. Safe to call before `set`
|
|
30
|
-
* (returns valid=false, status="unset").
|
|
31
|
-
*/
|
|
32
|
-
status() {
|
|
33
|
-
return Native.getLicenseStatus();
|
|
34
|
-
},
|
|
35
|
-
/**
|
|
36
|
-
* Cancel the background refresher. Optional: most apps will
|
|
37
|
-
* never call this. Useful when the user logs out or the SDK is
|
|
38
|
-
* being torn down and you do not want a long-running daemon
|
|
39
|
-
* thread sitting in the process.
|
|
40
|
-
*/
|
|
41
|
-
stopRefresh() {
|
|
42
|
-
return Native.stopLicenseRefresh();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
//# sourceMappingURL=License.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Native","VoipCloud","console","warn","License","set","token","setLicense","status","getLicenseStatus","stopRefresh","stopLicenseRefresh"],"sourceRoot":"../../src","sources":["License.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAG5C,MAAMC,MAAM,GAAGD,aAAa,CAACE,SAAS;AAEtC,IAAI,CAACD,MAAM,EAAE;EACT;EACA;EACAE,OAAO,CAACC,IAAI,CACR,qDAAqD,GACrD,2DACJ,CAAC;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,GAAG;EACnB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACIC,GAAGA,CAACC,KAAa,EAAiB;IAC9B,OAAON,MAAM,CAACO,UAAU,CAACD,KAAK,CAAC;EACnC,CAAC;EAED;AACJ;AACA;AACA;EACIE,MAAMA,CAAA,EAA2B;IAC7B,OAAOR,MAAM,CAACS,gBAAgB,CAAC,CAAC;EACpC,CAAC;EAED;AACJ;AACA;AACA;AACA;AACA;EACIC,WAAWA,CAAA,EAAkB;IACzB,OAAOV,MAAM,CAACW,kBAAkB,CAAC,CAAC;EACtC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { LicenseStatus } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* License management — all SDK functionality is gated behind a valid
|
|
4
|
-
* token. Customers paste their token (issued by your server) into the
|
|
5
|
-
* app; the app calls {@link set} once at startup and the SDK handles
|
|
6
|
-
* everything else, including periodic refresh.
|
|
7
|
-
*/
|
|
8
|
-
export declare const License: {
|
|
9
|
-
/**
|
|
10
|
-
* Apply a license token. Resolves on success, rejects with one of
|
|
11
|
-
* the granular `VC_*` codes if the token is malformed, signed by
|
|
12
|
-
* the wrong key, expired, suspended, or for a different app bundle.
|
|
13
|
-
*
|
|
14
|
-
* Side-effect: if the token's payload includes a `ref` field, the
|
|
15
|
-
* background refresher is started (or restarted with the new URL)
|
|
16
|
-
* automatically — the consumer never types a refresh URL.
|
|
17
|
-
*/
|
|
18
|
-
set(token: string): Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* Query the current license state. Safe to call before `set`
|
|
21
|
-
* (returns valid=false, status="unset").
|
|
22
|
-
*/
|
|
23
|
-
status(): Promise<LicenseStatus>;
|
|
24
|
-
/**
|
|
25
|
-
* Cancel the background refresher. Optional: most apps will
|
|
26
|
-
* never call this. Useful when the user logs out or the SDK is
|
|
27
|
-
* being torn down and you do not want a long-running daemon
|
|
28
|
-
* thread sitting in the process.
|
|
29
|
-
*/
|
|
30
|
-
stopRefresh(): Promise<void>;
|
|
31
|
-
};
|
package/src/License.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { NativeModules } from 'react-native';
|
|
2
|
-
import type { LicenseStatus } from './types';
|
|
3
|
-
|
|
4
|
-
const Native = NativeModules.VoipCloud;
|
|
5
|
-
|
|
6
|
-
if (!Native) {
|
|
7
|
-
// Defer the error: only thrown if the consumer actually calls a
|
|
8
|
-
// method, so importing the package never crashes at load time.
|
|
9
|
-
console.warn(
|
|
10
|
-
'[react-native-voipcloud] Native module not linked. ' +
|
|
11
|
-
'Did you rebuild the Android app after adding the package?',
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* License management — all SDK functionality is gated behind a valid
|
|
17
|
-
* token. Customers paste their token (issued by your server) into the
|
|
18
|
-
* app; the app calls {@link set} once at startup and the SDK handles
|
|
19
|
-
* everything else, including periodic refresh.
|
|
20
|
-
*/
|
|
21
|
-
export const License = {
|
|
22
|
-
/**
|
|
23
|
-
* Apply a license token. Resolves on success, rejects with one of
|
|
24
|
-
* the granular `VC_*` codes if the token is malformed, signed by
|
|
25
|
-
* the wrong key, expired, suspended, or for a different app bundle.
|
|
26
|
-
*
|
|
27
|
-
* Side-effect: if the token's payload includes a `ref` field, the
|
|
28
|
-
* background refresher is started (or restarted with the new URL)
|
|
29
|
-
* automatically — the consumer never types a refresh URL.
|
|
30
|
-
*/
|
|
31
|
-
set(token: string): Promise<void> {
|
|
32
|
-
return Native.setLicense(token);
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Query the current license state. Safe to call before `set`
|
|
37
|
-
* (returns valid=false, status="unset").
|
|
38
|
-
*/
|
|
39
|
-
status(): Promise<LicenseStatus> {
|
|
40
|
-
return Native.getLicenseStatus();
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Cancel the background refresher. Optional: most apps will
|
|
45
|
-
* never call this. Useful when the user logs out or the SDK is
|
|
46
|
-
* being torn down and you do not want a long-running daemon
|
|
47
|
-
* thread sitting in the process.
|
|
48
|
-
*/
|
|
49
|
-
stopRefresh(): Promise<void> {
|
|
50
|
-
return Native.stopLicenseRefresh();
|
|
51
|
-
},
|
|
52
|
-
};
|