omikit-plugin 4.1.4 → 4.1.6
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/LICENSE
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
OMICALL SDK License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2022 ViHAT Group
|
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
-
in the Software without restriction, including without limitation the rights
|
|
7
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
-
furnished to do so, subject to the following conditions:
|
|
3
|
+
Copyright (c) 2022-2026 ViHAT Group (VIHAT JSC). All rights reserved.
|
|
10
4
|
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
This SDK is provided exclusively for customers of the OMICALL platform
|
|
6
|
+
(https://omicall.com). By using this SDK, you agree to the following terms:
|
|
7
|
+
|
|
8
|
+
PERMITTED:
|
|
9
|
+
- Use the SDK to integrate OMICALL services into your applications
|
|
10
|
+
- Include the SDK in applications distributed to your end users
|
|
11
|
+
|
|
12
|
+
PROHIBITED:
|
|
13
|
+
- Use the SDK without an active OMICALL account or subscription
|
|
14
|
+
- Redistribute, sublicense, or sell the SDK as a standalone product
|
|
15
|
+
- Use the SDK to build competing communication platforms
|
|
16
|
+
- Reverse engineer, decompile, or disassemble the SDK
|
|
13
17
|
|
|
14
18
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
-
IMPLIED
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
-
SOFTWARE.
|
|
19
|
+
IMPLIED. IN NO EVENT SHALL VIHAT GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY ARISING FROM THE USE OF THIS SOFTWARE.
|
|
21
|
+
|
|
22
|
+
Contact: support@omicall.com
|
package/README.md
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
# OMICALL SDK for React Native
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/omikit-plugin)
|
|
4
|
+
[](https://www.npmjs.com/package/omikit-plugin)
|
|
5
|
+
[](./LICENSE)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install omikit-plugin
|
|
9
|
+
```
|
|
10
|
+
|
|
3
11
|
The [omikit-plugin](https://www.npmjs.com/package/omikit-plugin) enables VoIP/SIP calling via the OMICALL platform with support for both Old and **New Architecture** (TurboModules + Fabric).
|
|
4
12
|
|
|
5
|
-
|
|
13
|
+
> **⚠️ Expo is not supported.** This SDK requires native modules (SIP/VoIP, CallKit, PushKit) that are not compatible with Expo managed workflow. Please use React Native CLI.
|
|
6
14
|
|
|
7
15
|
---
|
|
8
16
|
|
|
@@ -33,8 +41,8 @@ The [omikit-plugin](https://www.npmjs.com/package/omikit-plugin) enables VoIP/SI
|
|
|
33
41
|
|
|
34
42
|
| omikit-plugin | React Native | Architecture | Installation |
|
|
35
43
|
|---------------|--------------|--------------|--------------|
|
|
36
|
-
| **4.
|
|
37
|
-
| 3.3.x | 0.60 – 0.73 | Old Architecture only | `npm install omikit-plugin@3.3.29` |
|
|
44
|
+
| **4.x** (latest) | 0.74+ | Old + New (auto-detect) | `npm install omikit-plugin` |
|
|
45
|
+
| 3.3.x (legacy) | 0.60 – 0.73 | Old Architecture only | `npm install omikit-plugin@3.3.29` |
|
|
38
46
|
|
|
39
47
|
**v4.0.x highlights:**
|
|
40
48
|
- **TurboModules (JSI)** — 4-10x faster native method calls via direct C++ bridge
|
|
@@ -1154,88 +1154,57 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
1154
1154
|
@ReactMethod
|
|
1155
1155
|
fun getCurrentUser(promise: Promise) {
|
|
1156
1156
|
mainScope.launch {
|
|
1157
|
-
|
|
1158
|
-
withContext(Dispatchers.Default) {
|
|
1157
|
+
val callResult = withContext(Dispatchers.Default) {
|
|
1159
1158
|
try {
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
Log.e("OmikitPlugin", "❌ getCurrentUser error: ${e.message}", e)
|
|
1159
|
+
OmiClient.getInstance(reactApplicationContext!!).getCurrentUser()
|
|
1160
|
+
} catch (_: Throwable) {
|
|
1161
|
+
null
|
|
1164
1162
|
}
|
|
1165
1163
|
}
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
map.putString("extension", call["extension"] as String?)
|
|
1170
|
-
map.putString("uuid", call["uuid"] as String?)
|
|
1171
|
-
map.putString("full_name", call["full_name"] as String?)
|
|
1172
|
-
map.putString("avatar_url", call["avatar_url"] as String?)
|
|
1173
|
-
|
|
1174
|
-
map.putString("fullName", call["full_name"] as String?)
|
|
1175
|
-
map.putString("avatarUrl", call["avatar_url"] as String?)
|
|
1164
|
+
resolveUserResult(callResult, promise)
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1176
1167
|
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1168
|
+
private fun resolveUserResult(callResult: Any?, promise: Promise) {
|
|
1169
|
+
if (callResult is Map<*, *>) {
|
|
1170
|
+
val map: WritableMap = WritableNativeMap()
|
|
1171
|
+
map.putString("extension", callResult["extension"] as String?)
|
|
1172
|
+
map.putString("uuid", callResult["uuid"] as String?)
|
|
1173
|
+
map.putString("full_name", callResult["full_name"] as String?)
|
|
1174
|
+
map.putString("avatar_url", callResult["avatar_url"] as String?)
|
|
1175
|
+
map.putString("fullName", callResult["full_name"] as String?)
|
|
1176
|
+
map.putString("avatarUrl", callResult["avatar_url"] as String?)
|
|
1177
|
+
promise.resolve(map)
|
|
1178
|
+
} else {
|
|
1179
|
+
promise.resolve(null)
|
|
1183
1180
|
}
|
|
1184
1181
|
}
|
|
1185
1182
|
|
|
1186
1183
|
@ReactMethod
|
|
1187
1184
|
fun getGuestUser(promise: Promise) {
|
|
1188
1185
|
mainScope.launch {
|
|
1189
|
-
|
|
1190
|
-
withContext(Dispatchers.Default) {
|
|
1186
|
+
val callResult = withContext(Dispatchers.Default) {
|
|
1191
1187
|
try {
|
|
1192
|
-
|
|
1188
|
+
OmiClient.getInstance(reactApplicationContext!!).getIncomingCallUser()
|
|
1193
1189
|
} catch (_: Throwable) {
|
|
1194
|
-
|
|
1190
|
+
null
|
|
1195
1191
|
}
|
|
1196
1192
|
}
|
|
1197
|
-
|
|
1198
|
-
val call = callResult as Map<*, *>
|
|
1199
|
-
val map: WritableMap = WritableNativeMap()
|
|
1200
|
-
map.putString("extension", call["extension"] as String?)
|
|
1201
|
-
map.putString("uuid", call["uuid"] as String?)
|
|
1202
|
-
map.putString("full_name", call["full_name"] as String?)
|
|
1203
|
-
map.putString("avatar_url", call["avatar_url"] as String?)
|
|
1204
|
-
|
|
1205
|
-
map.putString("fullName", call["full_name"] as String?)
|
|
1206
|
-
map.putString("avatarUrl", call["avatar_url"] as String?)
|
|
1207
|
-
|
|
1208
|
-
promise.resolve(map)
|
|
1209
|
-
} else {
|
|
1210
|
-
promise.resolve(null);
|
|
1211
|
-
}
|
|
1193
|
+
resolveUserResult(callResult, promise)
|
|
1212
1194
|
}
|
|
1213
1195
|
}
|
|
1214
1196
|
|
|
1215
1197
|
@ReactMethod
|
|
1216
1198
|
fun getUserInfo(phone: String, promise: Promise) {
|
|
1217
1199
|
mainScope.launch {
|
|
1218
|
-
|
|
1219
|
-
withContext(Dispatchers.Default) {
|
|
1200
|
+
val callResult = withContext(Dispatchers.Default) {
|
|
1220
1201
|
try {
|
|
1221
|
-
|
|
1202
|
+
OmiClient.getInstance(reactApplicationContext!!).getUserInfo(phone)
|
|
1222
1203
|
} catch (_: Throwable) {
|
|
1204
|
+
null
|
|
1223
1205
|
}
|
|
1224
1206
|
}
|
|
1225
|
-
|
|
1226
|
-
val call = callResult as Map<*, *>
|
|
1227
|
-
val map: WritableMap = WritableNativeMap()
|
|
1228
|
-
map.putString("extension", call["extension"] as String?)
|
|
1229
|
-
map.putString("uuid", call["uuid"] as String?)
|
|
1230
|
-
map.putString("full_name", call["full_name"] as String?)
|
|
1231
|
-
map.putString("avatar_url", call["avatar_url"] as String?)
|
|
1232
|
-
|
|
1233
|
-
map.putString("fullName", call["full_name"] as String?)
|
|
1234
|
-
map.putString("avatarUrl", call["avatar_url"] as String?)
|
|
1235
|
-
promise.resolve(map)
|
|
1236
|
-
} else {
|
|
1237
|
-
promise.resolve(null)
|
|
1238
|
-
}
|
|
1207
|
+
resolveUserResult(callResult, promise)
|
|
1239
1208
|
}
|
|
1240
1209
|
}
|
|
1241
1210
|
|
|
@@ -394,9 +394,27 @@ class CallManager {
|
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
@objc func callDealloc(_ notification: NSNotification) {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
397
|
+
// Extract endCause from OMICallDealloc notification — this is the reliable source
|
|
398
|
+
// for the SIP end code (486=busy, 603=decline, 408=timeout, etc.)
|
|
399
|
+
let endCause = notification.userInfo?[OMINotificationEndCauseKey] as? Int
|
|
400
|
+
|
|
401
|
+
if var info = tempCallInfo, !info.isEmpty {
|
|
402
|
+
info["status"] = OMICallState.disconnected.rawValue
|
|
403
|
+
if let endCause = endCause {
|
|
404
|
+
info["code_end_call"] = endCause
|
|
405
|
+
info["codeEndCall"] = endCause
|
|
406
|
+
}
|
|
407
|
+
OmikitPlugin.instance?.sendEvent(withName: CALL_STATE_CHANGED, body: info)
|
|
408
|
+
tempCallInfo = [:]
|
|
409
|
+
} else if let endCause = endCause {
|
|
410
|
+
// No tempCallInfo (callStateChanged fired first and cleared it),
|
|
411
|
+
// but we still have an endCause — send minimal event so JS gets the code
|
|
412
|
+
let fallback: [String: Any] = [
|
|
413
|
+
"status": OMICallState.disconnected.rawValue,
|
|
414
|
+
"code_end_call": endCause,
|
|
415
|
+
"codeEndCall": endCause
|
|
416
|
+
]
|
|
417
|
+
OmikitPlugin.instance?.sendEvent(withName: CALL_STATE_CHANGED, body: fallback)
|
|
400
418
|
}
|
|
401
419
|
}
|
|
402
420
|
|
|
@@ -457,7 +475,7 @@ class CallManager {
|
|
|
457
475
|
}
|
|
458
476
|
OmikitPlugin.instance?.sendEvent(withName: CALL_STATE_CHANGED, body: combinedDictionary )
|
|
459
477
|
lastTimeCall = Date()
|
|
460
|
-
tempCallInfo
|
|
478
|
+
// Keep tempCallInfo for callDealloc — it will clear after use
|
|
461
479
|
break
|
|
462
480
|
default:
|
|
463
481
|
break
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omikit-plugin",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.6",
|
|
4
4
|
"description": "Omikit Plugin by ViHAT",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"url": "git+https://github.com/VIHATTeam/OMICALL-React-Native-SDK"
|
|
47
47
|
},
|
|
48
48
|
"author": "ViHAT Group <tranhoaihung05@gmail.com>",
|
|
49
|
-
"license": "
|
|
49
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/VIHATTeam/OMICALL-React-Native-SDK/issues"
|
|
52
52
|
},
|