omikit-plugin 3.2.66 β 3.2.68
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/README.md +471 -345
- package/android/build.gradle +1 -1
- package/android/gradle.properties +1 -1
- package/ios/CallProcess/CallManager.swift +4 -8
- package/omikit-plugin.podspec +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,44 +1,47 @@
|
|
|
1
|
-
# OMICALL SDK FOR React-Native
|
|
1
|
+
# π¦ OMICALL SDK FOR React-Native
|
|
2
2
|
|
|
3
|
-
The OmiKit exposes the <a href="https://www.npmjs.com/package/omikit-plugin">omikit-plugin</a>.
|
|
3
|
+
The OmiKit exposes the π¦ <a href="https://www.npmjs.com/package/omikit-plugin">omikit-plugin</a>.
|
|
4
4
|
|
|
5
5
|
The most important part of the framework is :
|
|
6
6
|
|
|
7
|
-
- Help to easy integrate with Omicall.
|
|
8
|
-
- Easy custom Call UI/UX.
|
|
9
|
-
- Optimize codec voip for you.
|
|
10
|
-
- Full inteface to interactive with core function like sound/ringtone/codec.
|
|
7
|
+
- β
Help to easy integrate with Omicall.
|
|
8
|
+
- β
Easy custom Call UI/UX.
|
|
9
|
+
- β
Optimize codec voip for you.
|
|
10
|
+
- β
Full inteface to interactive with core function like sound/ringtone/codec.
|
|
11
11
|
|
|
12
|
-
### Status
|
|
12
|
+
### π Status
|
|
13
13
|
|
|
14
|
-
Currently active maintenance and improve performance
|
|
14
|
+
Currently active maintenance and improve performance
|
|
15
|
+
<br>
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
## π οΈ Configuration
|
|
17
18
|
|
|
18
|
-
Install
|
|
19
|
+
### π οΈ Install
|
|
20
|
+
<br>
|
|
21
|
+
|
|
22
|
+
β
Install via npm:
|
|
19
23
|
|
|
20
24
|
```ruby
|
|
21
25
|
npm install omikit-plugin@latest
|
|
22
26
|
```
|
|
23
27
|
|
|
24
|
-
Install via yarn:
|
|
25
|
-
|
|
28
|
+
β
Install via yarn:
|
|
26
29
|
```ruby
|
|
27
30
|
yarn add omikit-plugin --latest
|
|
28
31
|
```
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
#### Android:
|
|
33
|
+
#### π οΈ Step 1: Config native file
|
|
33
34
|
|
|
35
|
+
##### π Android:
|
|
36
|
+
π **Config gradle file**
|
|
34
37
|
- Add these settings in `build.gradle`:
|
|
35
38
|
|
|
36
|
-
```
|
|
37
|
-
jcenter()
|
|
39
|
+
```gradle
|
|
40
|
+
jcenter() // This func will replace soon
|
|
38
41
|
maven {
|
|
39
42
|
url "https://maven.pkg.github.com/omicall/OMICall-SDK"
|
|
40
43
|
credentials {
|
|
41
|
-
username = project.findProperty("OMI_USER") ?: ""
|
|
44
|
+
username = project.findProperty("OMI_USER") ?: "" // Please connect with developer OMI for get information
|
|
42
45
|
password = project.findProperty("OMI_TOKEN") ?: ""
|
|
43
46
|
}
|
|
44
47
|
authentication {
|
|
@@ -47,6 +50,8 @@ maven {
|
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
```
|
|
53
|
+
|
|
54
|
+
|
|
50
55
|
```kotlin
|
|
51
56
|
// gradle.properties
|
|
52
57
|
OMI_USER=omicall
|
|
@@ -56,6 +61,7 @@ OMI_TOKEN=${OMI_TOKEN} // connect with dev off OMI for get token
|
|
|
56
61
|
```kotlin
|
|
57
62
|
// in dependencies
|
|
58
63
|
classpath 'com.google.gms:google-services:4.3.13'
|
|
64
|
+
// You can choose the version of google-services to suit your project
|
|
59
65
|
```
|
|
60
66
|
|
|
61
67
|
```kotlin
|
|
@@ -104,34 +110,35 @@ apply plugin: 'com.google.gms.google-services'
|
|
|
104
110
|
|
|
105
111
|
You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blob/main/example/android/app/build.gradle">android/app/build.gradle</a> to know more informations.
|
|
106
112
|
|
|
107
|
-
|
|
113
|
+
<br>
|
|
108
114
|
|
|
109
|
-
|
|
115
|
+
π **Config AndroidManifest.xml file**
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
```xml
|
|
110
120
|
<manifest
|
|
111
|
-
......
|
|
112
121
|
xmlns:tools="http://schemas.android.com/tools">
|
|
113
|
-
|
|
122
|
+
// ... your config
|
|
114
123
|
<uses-feature android:name="android.hardware.telephony" android:required="false" />
|
|
115
124
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
116
125
|
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
|
117
126
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
118
127
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
119
|
-
|
|
128
|
+
// ... your config
|
|
120
129
|
|
|
121
130
|
<application
|
|
122
131
|
android:name=".MainApplication"
|
|
123
|
-
...... // your config
|
|
124
132
|
android:alwaysRetainTaskState="true"
|
|
125
133
|
android:largeHeap="true"
|
|
126
134
|
android:exported="true"
|
|
127
135
|
android:supportsRtl="true"
|
|
128
136
|
android:allowBackup="false"
|
|
129
137
|
android:enableOnBackInvokedCallback="true"
|
|
130
|
-
|
|
138
|
+
// ... your config
|
|
131
139
|
>
|
|
132
140
|
<activity
|
|
133
141
|
android:name=".MainActivity"
|
|
134
|
-
..... // your config
|
|
135
142
|
android:windowSoftInputMode="adjustResize"
|
|
136
143
|
android:showOnLockScreen="true"
|
|
137
144
|
android:launchMode="singleTask"
|
|
@@ -141,9 +148,9 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
141
148
|
android:showWhenLocked="true"
|
|
142
149
|
android:turnScreenOn="true"
|
|
143
150
|
android:exported="true"
|
|
144
|
-
|
|
151
|
+
// ... your config
|
|
145
152
|
>
|
|
146
|
-
|
|
153
|
+
// ... your config
|
|
147
154
|
<intent-filter>
|
|
148
155
|
<action android:name="android.intent.action.MAIN" />
|
|
149
156
|
<category android:name="android.intent.category.LAUNCHER" />
|
|
@@ -155,9 +162,9 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
155
162
|
android:host="incoming_call"
|
|
156
163
|
android:scheme="omisdk" />
|
|
157
164
|
</intent-filter>
|
|
158
|
-
|
|
165
|
+
// ... your config
|
|
159
166
|
</activity>
|
|
160
|
-
|
|
167
|
+
// ... your config
|
|
161
168
|
<receiver
|
|
162
169
|
android:name="vn.vihat.omicall.omisdk.receiver.FirebaseMessageReceiver"
|
|
163
170
|
android:exported="true"
|
|
@@ -173,17 +180,19 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
173
180
|
android:enabled="true"
|
|
174
181
|
android:exported="false">
|
|
175
182
|
</service>
|
|
176
|
-
|
|
183
|
+
// ... your config
|
|
177
184
|
</application>
|
|
178
185
|
</manifest>
|
|
179
186
|
```
|
|
180
187
|
|
|
181
|
-
|
|
182
|
-
|
|
188
|
+
<br>
|
|
189
|
+
|
|
190
|
+
π **Config MainActivity file**
|
|
191
|
+
### β
For React Native < 0.74
|
|
183
192
|
|
|
184
193
|
```java
|
|
185
194
|
public class MainActivity extends ReactActivity {
|
|
186
|
-
|
|
195
|
+
// your config ...
|
|
187
196
|
|
|
188
197
|
|
|
189
198
|
@Override
|
|
@@ -208,16 +217,17 @@ public class MainActivity extends ReactActivity {
|
|
|
208
217
|
if (intent != null) {
|
|
209
218
|
OmikitPluginModule.Companion.onGetIntentFromNotification(reactApplicationContext, intent, this);
|
|
210
219
|
}
|
|
211
|
-
|
|
220
|
+
// your config ...
|
|
212
221
|
}
|
|
213
222
|
}
|
|
214
223
|
```
|
|
215
224
|
|
|
216
|
-
|
|
225
|
+
### β
For React Native > 0.74
|
|
226
|
+
|
|
217
227
|
|
|
218
228
|
```kotlin
|
|
219
229
|
class MainActivity : ReactActivity() {
|
|
220
|
-
|
|
230
|
+
// your config ....
|
|
221
231
|
private var reactApplicationContext: ReactApplicationContext? = null
|
|
222
232
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
223
233
|
super.onCreate(savedInstanceState)
|
|
@@ -261,27 +271,31 @@ class MainActivity : ReactActivity() {
|
|
|
261
271
|
} ?: Log.e("MainActivity", "ReactApplicationContext has not been initialized in onResume.")
|
|
262
272
|
}
|
|
263
273
|
|
|
264
|
-
|
|
274
|
+
// your config ....
|
|
265
275
|
}
|
|
266
276
|
```
|
|
267
277
|
|
|
268
278
|
|
|
269
|
-
- Setup remote push notification: Only support Firebase for remote push notification.
|
|
279
|
+
- β¨ Setup remote push notification: Only support Firebase for remote push notification.
|
|
270
280
|
|
|
271
|
-
- Add `google-service.json` in `android/app` (For more information, you can refer <a href="https://rnfirebase.io/app/usage">Core/App</a>)
|
|
272
|
-
- Add Firebase Messaging to receive `fcm_token` (You can refer <a href="https://rnfirebase.io/messaging/usage">Cloud Messaging</a> to setup notification for React native)
|
|
281
|
+
- β
Add `google-service.json` in `android/app` (For more information, you can refer <a href="https://rnfirebase.io/app/usage">Core/App</a>)
|
|
282
|
+
- β
Add Firebase Messaging to receive `fcm_token` (You can refer <a href="https://rnfirebase.io/messaging/usage">Cloud Messaging</a> to setup notification for React native)
|
|
273
283
|
|
|
274
|
-
- For more setting information, please refer <a href="https://api.omicall.com/web-sdk/mobile-sdk/android-sdk/cau-hinh-push-notification">Config Push for Android</a>
|
|
284
|
+
- β
For more setting information, please refer <a href="https://api.omicall.com/web-sdk/mobile-sdk/android-sdk/cau-hinh-push-notification">Config Push for Android</a>
|
|
275
285
|
|
|
276
|
-
|
|
286
|
+
<br>
|
|
277
287
|
|
|
278
|
-
|
|
288
|
+
*Now let's continue configuring iOS, let's go π*
|
|
279
289
|
|
|
280
|
-
|
|
290
|
+
##### π Config for IOS
|
|
281
291
|
|
|
282
|
-
|
|
292
|
+
##### π iOS(Object-C):
|
|
283
293
|
|
|
284
|
-
|
|
294
|
+
- β
Assets: Add `call_image` into assets folder to update callkit image. We only support png style. *(This will help show your application icon on iOS CallKit when a call comes in)*
|
|
295
|
+
|
|
296
|
+
- β
Add variables in **Appdelegate.h** for **Old Architecture**:
|
|
297
|
+
|
|
298
|
+
```objc
|
|
285
299
|
#import <UIKit/UIKit.h>
|
|
286
300
|
#import <UserNotifications/UserNotifications.h>
|
|
287
301
|
#import <OmiKit/OmiKit-umbrella.h>
|
|
@@ -297,9 +311,9 @@ class MainActivity : ReactActivity() {
|
|
|
297
311
|
@end
|
|
298
312
|
```
|
|
299
313
|
|
|
300
|
-
- Add variables in **Appdelegate.h** for **New Architecture**:
|
|
314
|
+
- β
Add variables in **Appdelegate.h** for **New Architecture**:
|
|
301
315
|
|
|
302
|
-
```
|
|
316
|
+
```objc
|
|
303
317
|
#import <UIKit/UIKit.h>
|
|
304
318
|
#import <UserNotifications/UserNotifications.h>
|
|
305
319
|
#import <OmiKit/OmiKit-umbrella.h>
|
|
@@ -316,11 +330,12 @@ class MainActivity : ReactActivity() {
|
|
|
316
330
|
|
|
317
331
|
```
|
|
318
332
|
|
|
319
|
-
-
|
|
333
|
+
- β
Update AppDelegate.m:
|
|
320
334
|
|
|
321
|
-
```
|
|
335
|
+
```objc
|
|
322
336
|
#import <OmiKit/OmiKit.h>
|
|
323
337
|
|
|
338
|
+
|
|
324
339
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
325
340
|
{
|
|
326
341
|
|
|
@@ -366,9 +381,10 @@ class MainActivity : ReactActivity() {
|
|
|
366
381
|
}
|
|
367
382
|
}
|
|
368
383
|
```
|
|
369
|
-
- Tips: Error Use of undeclared identifier 'OmikitNotification' at file `AppDelegate.m`, please import this line below
|
|
370
384
|
|
|
371
|
-
|
|
385
|
+
- π Tips: Error Use of undeclared identifier 'OmikitNotification' at file `AppDelegate.m`, please import this line below
|
|
386
|
+
|
|
387
|
+
```objc
|
|
372
388
|
#if __has_include("OmikitNotification.h")
|
|
373
389
|
#import "OmikitNotification.h"
|
|
374
390
|
#elif __has_include(<OmikitPlugin/OmikitPlugin-Swift.h>)
|
|
@@ -380,7 +396,7 @@ class MainActivity : ReactActivity() {
|
|
|
380
396
|
```
|
|
381
397
|
- Add these lines into `Info.plist`:
|
|
382
398
|
|
|
383
|
-
```
|
|
399
|
+
```xml
|
|
384
400
|
<key>NSMicrophoneUsageDescription</key>
|
|
385
401
|
<string>Need microphone access for make Call</string>
|
|
386
402
|
//If you implement video call
|
|
@@ -388,7 +404,7 @@ class MainActivity : ReactActivity() {
|
|
|
388
404
|
<string>Need camera access for video call functions</string>
|
|
389
405
|
```
|
|
390
406
|
|
|
391
|
-
- Save token for `OmiClient`: if You added `Cloud Messaging` in your project so you don't need add these lines.
|
|
407
|
+
- π‘ Save token for `OmiClient`: if You added `Cloud Messaging` in your project so you don't need add these lines.
|
|
392
408
|
|
|
393
409
|
```swift
|
|
394
410
|
- (void)application:(UIApplication*)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)devToken
|
|
@@ -409,16 +425,14 @@ class MainActivity : ReactActivity() {
|
|
|
409
425
|
|
|
410
426
|
```
|
|
411
427
|
|
|
412
|
-
|
|
428
|
+
**β¨ Only use under lines when added `Cloud Messaging` plugin in your project**
|
|
413
429
|
|
|
414
|
-
- Setup push notification: We only support Firebase for push notification.
|
|
430
|
+
- β
Setup push notification: We only support Firebase for push notification.
|
|
431
|
+
- β
Add `google-service.json` in `android/app` (For more information, you can refer <a href="https://rnfirebase.io/app/usage">Core/App</a>)
|
|
432
|
+
- β
Add Firebase Messaging to receive `fcm_token` (You can refer <a href="https://pub.dev/packages/firebase_messaging">Cloud Messaging</a> to setup notification for React Native)
|
|
433
|
+
- β
For more setting information, please refer <a href="https://api.omicall.com/web-sdk/mobile-sdk/ios-sdk/cau-hinh-push-notification">Config Push for iOS</a>
|
|
415
434
|
|
|
416
|
-
|
|
417
|
-
- Add Firebase Messaging to receive `fcm_token` (You can refer <a href="https://pub.dev/packages/firebase_messaging">Cloud Messaging</a> to setup notification for React Native)
|
|
418
|
-
|
|
419
|
-
- For more setting information, please refer <a href="https://api.omicall.com/web-sdk/mobile-sdk/ios-sdk/cau-hinh-push-notification">Config Push for iOS</a>
|
|
420
|
-
|
|
421
|
-
**_ Important release note _**
|
|
435
|
+
**β¨Important release note**
|
|
422
436
|
|
|
423
437
|
```
|
|
424
438
|
We support 2 environments. So you need set correct key in Appdelegate.
|
|
@@ -427,11 +441,15 @@ We support 2 environments. So you need set correct key in Appdelegate.
|
|
|
427
441
|
- Visit on web admin to select correct enviroment.
|
|
428
442
|
```
|
|
429
443
|
|
|
430
|
-
|
|
444
|
+
*πNote: At Tab Build Setting off Target Project, you need set: **_Enable Modules (C and Objective C)_** : YES*
|
|
445
|
+
|
|
446
|
+
#### β Currently, OMICALL does not support React Native new architect.
|
|
447
|
+
|
|
448
|
+
π Config turn Off for new architect
|
|
449
|
+
|
|
450
|
+
<br>
|
|
431
451
|
|
|
432
|
-
|
|
433
|
-
Config turn Off for new architect
|
|
434
|
-
For iOS
|
|
452
|
+
β
For iOS
|
|
435
453
|
```Ruby
|
|
436
454
|
use_react_native!(
|
|
437
455
|
:path => config[:reactNativePath],
|
|
@@ -440,17 +458,18 @@ use_react_native!(
|
|
|
440
458
|
)
|
|
441
459
|
```
|
|
442
460
|
|
|
443
|
-
For Android
|
|
444
|
-
|
|
461
|
+
β
For Android
|
|
462
|
+
|
|
463
|
+
- Open file **_android/gradle.properties_** and add line below:
|
|
445
464
|
```kotlin
|
|
446
|
-
#
|
|
465
|
+
# Turn off New Architecture
|
|
447
466
|
newArchEnabled=false
|
|
448
467
|
```
|
|
449
|
-
#### iOS(Swift):
|
|
468
|
+
#### π iOS(Swift):
|
|
450
469
|
|
|
451
|
-
|
|
470
|
+
π Notes: The configurations are similar to those for object C above, with only a slight difference in the syntax of the functions
|
|
452
471
|
|
|
453
|
-
- Add variables in Appdelegate.swift:
|
|
472
|
+
- β
Add variables in Appdelegate.swift:
|
|
454
473
|
|
|
455
474
|
```swift
|
|
456
475
|
import OmiKit
|
|
@@ -462,7 +481,7 @@ var provider: CallKitProviderDelegate?
|
|
|
462
481
|
var voipRegistry: PKPushRegistry?
|
|
463
482
|
```
|
|
464
483
|
|
|
465
|
-
- Add these lines into `didFinishLaunchingWithOptions`:
|
|
484
|
+
- β
Add these lines into `didFinishLaunchingWithOptions`:
|
|
466
485
|
|
|
467
486
|
```swift
|
|
468
487
|
OmiClient.setEnviroment(KEY_OMI_APP_ENVIROMENT_SANDBOX, userNameKey: "extension", maxCall: 1, callKitImage: "call_image")
|
|
@@ -471,16 +490,16 @@ voipRegistry = PKPushRegistry.init(queue: .main)
|
|
|
471
490
|
pushkitManager = PushKitManager.init(voipRegistry: voipRegistry)
|
|
472
491
|
```
|
|
473
492
|
|
|
474
|
-
- Add these lines into `Info.plist`:
|
|
493
|
+
- β
Add these lines into `Info.plist`:
|
|
475
494
|
|
|
476
|
-
```
|
|
495
|
+
```xml
|
|
477
496
|
<key>NSCameraUsageDescription</key>
|
|
478
497
|
<string>Need camera access for video call functions</string>
|
|
479
498
|
<key>NSMicrophoneUsageDescription</key>
|
|
480
499
|
<string>Need microphone access for make Call</string>
|
|
481
500
|
```
|
|
482
501
|
|
|
483
|
-
- Save token for `OmiClient`: if you added `firebase_messaging` in your project so you don't need add these lines.
|
|
502
|
+
- β
Save token for `OmiClient`: if you added `firebase_messaging` in your project so you don't need add these lines.
|
|
484
503
|
|
|
485
504
|
```swift
|
|
486
505
|
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
|
@@ -496,15 +515,15 @@ extension Data {
|
|
|
496
515
|
}
|
|
497
516
|
```
|
|
498
517
|
|
|
499
|
-
|
|
518
|
+
**β¨ Only use under lines when added `Cloud Messaging` plugin in your project**
|
|
500
519
|
|
|
501
|
-
- Setup push notification: We only support Firebase for push notification.
|
|
520
|
+
- β
Setup push notification: We only support Firebase for push notification.
|
|
521
|
+
- β
Add `google-service.json` in `android/app` (For more information, you can refer <a href="https://rnfirebase.io/app/usage">Core/App</a>)
|
|
522
|
+
- β
Add Firebase Messaging to receive `fcm_token` (You can refer <a href="https://pub.dev/packages/firebase_messaging">Cloud Messaging</a> to setup notification for React Native)
|
|
523
|
+
- β
For more setting information, please refer <a href="https://api.omicall.com/web-sdk/mobile-sdk/ios-sdk/cau-hinh-push-notification">Config Push for iOS</a>
|
|
524
|
+
-
|
|
502
525
|
|
|
503
|
-
|
|
504
|
-
- Add Firebase Messaging to receive `fcm_token` (You can refer <a href="https://pub.dev/packages/firebase_messaging">Cloud Messaging</a> to setup notification for React Native)
|
|
505
|
-
|
|
506
|
-
- For more setting information, please refer <a href="https://api.omicall.com/web-sdk/mobile-sdk/ios-sdk/cau-hinh-push-notification">Config Push for iOS</a>
|
|
507
|
-
**_ Important release note _**
|
|
526
|
+
**β Important release note**
|
|
508
527
|
|
|
509
528
|
```
|
|
510
529
|
We support 2 environments. So you need set correct key in Appdelegate.
|
|
@@ -513,13 +532,13 @@ We support 2 environments. So you need set correct key in Appdelegate.
|
|
|
513
532
|
- Visit on web admin to select correct enviroment.
|
|
514
533
|
```
|
|
515
534
|
|
|
516
|
-
##
|
|
535
|
+
## π οΈ Step 2: Integrate into React Native code
|
|
517
536
|
|
|
518
|
-
### Request permission
|
|
537
|
+
### π Request permission
|
|
519
538
|
|
|
520
|
-
We need you request permission about call before make call
|
|
539
|
+
**π We need you request permission about call before make call:**
|
|
521
540
|
|
|
522
|
-
- You can use <a href="https://github.com/zoontek/react-native-permissions">react-native-permissions</a> to do this
|
|
541
|
+
- β
You can use <a href="https://github.com/zoontek/react-native-permissions">react-native-permissions</a> to do this
|
|
523
542
|
|
|
524
543
|
```
|
|
525
544
|
-Android:
|
|
@@ -533,131 +552,174 @@ We need you request permission about call before make call:
|
|
|
533
552
|
|
|
534
553
|
```
|
|
535
554
|
|
|
536
|
-
- Set up <a href="https://rnfirebase.io/messaging/usage">Cloud Messaging</a> plugin:
|
|
555
|
+
- β
Set up <a href="https://rnfirebase.io/messaging/usage">Cloud Messaging</a> plugin:
|
|
537
556
|
|
|
538
557
|
```
|
|
539
558
|
//if you use only on Android. you only implement for Android.
|
|
540
559
|
//because we use APNS to push notification on iOS so you don't need add Firebase for iOS.
|
|
541
560
|
//But you can use firebase-messaging to get APNS token for iOS.
|
|
542
561
|
```
|
|
562
|
+
#### π OMIKIT-Plugin functions π
|
|
563
|
+
<br>
|
|
543
564
|
|
|
544
|
-
|
|
565
|
+
π **startServices()**
|
|
545
566
|
|
|
546
|
-
|
|
567
|
+
β
Description:
|
|
547
568
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
import { startServices } from 'omikit-plugin';
|
|
569
|
+
The `startServices()` function is used to initialize necessary services in `omikit-plugin`.
|
|
570
|
+
It should only be called once in the root file of your application.
|
|
551
571
|
|
|
552
|
-
|
|
553
|
-
|
|
572
|
+
- Usage:
|
|
573
|
+
```javascript
|
|
574
|
+
// Import startServices from omikit-plugin
|
|
575
|
+
import { startServices } from 'omikit-plugin';
|
|
554
576
|
|
|
555
|
-
|
|
577
|
+
// Call startServices() to initialize the required services
|
|
578
|
+
startServices();
|
|
579
|
+
```
|
|
580
|
+
- π Notes:<br>
|
|
581
|
+
β’ Do not call this function multiple times; it should be called only once when the application starts. <br>
|
|
582
|
+
β’ Ensure that `omikit-plugin` is installed before using this function.
|
|
556
583
|
|
|
557
|
-
|
|
558
|
-
Please contact for my sale:
|
|
559
|
-
In This step, we need partner provide me fcmToken of firebase Message.
|
|
584
|
+
*Add the following code to the root file of your application, such as `App.js` or `index.js`*
|
|
560
585
|
|
|
561
|
-
|
|
562
|
-
import { initCallWithApiKey } from 'omikit-plugin';
|
|
563
|
-
import messaging from '@react-native-firebase/messaging';
|
|
586
|
+
π **initCallWithApiKey()**
|
|
564
587
|
|
|
565
|
-
|
|
566
|
-
if(Platform.OS == "ios"){
|
|
567
|
-
token = await messaging.getAPNSToken()
|
|
568
|
-
} else {
|
|
569
|
-
token = await messaging.getToken()
|
|
570
|
-
}
|
|
588
|
+
π Notes: The information below is taken from the API, you should connect with our Technical team for support
|
|
571
589
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
590
|
+
β
Description: <br>
|
|
591
|
+
- The `initCallWithApiKey()` function is usually used for your client, who only has a certain function, calling a fixed number. For example, you can only call your hotline number
|
|
592
|
+
|
|
593
|
+
```javascript
|
|
594
|
+
import { initCallWithApiKey } from 'omikit-plugin';
|
|
595
|
+
import messaging from '@react-native-firebase/messaging';
|
|
596
|
+
|
|
597
|
+
let token: String;
|
|
598
|
+
|
|
599
|
+
// Retrieve the appropriate push notification token based on the platform
|
|
600
|
+
if (Platform.OS === "ios") {
|
|
601
|
+
token = await messaging.getAPNSToken(); // Get APNS token for iOS
|
|
602
|
+
} else {
|
|
603
|
+
token = await messaging.getToken(); // Get FCM token for Android
|
|
604
|
+
}
|
|
584
605
|
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
606
|
+
// Define the login information required for call initialization
|
|
607
|
+
const loginInfo = {
|
|
608
|
+
usrUuid: usrUuid, // Unique user identifier
|
|
609
|
+
fullName: fullName, // User's full name
|
|
610
|
+
apiKey: apiKey, // API key for authentication
|
|
611
|
+
phone: phone, // User's phone number
|
|
612
|
+
fcmToken: token, // FCM token for Android, APNS token for iOS
|
|
613
|
+
isVideo: isVideo, // Determines if video calls are enabled
|
|
614
|
+
projectId: projectId // Firebase project ID
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
// Initialize call functionality using the provided API key
|
|
618
|
+
const result = await initCallWithApiKey(loginInfo);
|
|
619
|
+
|
|
620
|
+
// If result is true, the user has successfully logged in.
|
|
621
|
+
```
|
|
588
622
|
|
|
623
|
+
π **initCallWithUserPassword()**
|
|
624
|
+
|
|
625
|
+
π Notes: The information below is taken from the API, you should connect with our Technical team for support
|
|
626
|
+
|
|
627
|
+
β
Description: <br>
|
|
628
|
+
- The `initCallWithUserPassword()` function is for employees. They can call any telecommunications number allowed in your business on the OMI system.
|
|
629
|
+
|
|
589
630
|
```javascript
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
let token: String
|
|
594
|
-
if(Platform.OS == "ios"){
|
|
595
|
-
token = await messaging.getAPNSToken()
|
|
596
|
-
} else {
|
|
597
|
-
token = await messaging.getToken()
|
|
598
|
-
}
|
|
631
|
+
import { initCallWithUserPassword } from 'omikit-plugin';
|
|
632
|
+
import messaging from '@react-native-firebase/messaging';
|
|
599
633
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
634
|
+
let token: String;
|
|
635
|
+
|
|
636
|
+
// Retrieve the appropriate push notification token based on the platform
|
|
637
|
+
if (Platform.OS === "ios") {
|
|
638
|
+
token = await messaging.getAPNSToken(); // Get APNS token for iOS
|
|
639
|
+
} else {
|
|
640
|
+
token = await messaging.getToken(); // Get FCM token for Android
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
// Define the login information required for call initialization
|
|
644
|
+
const loginInfo = {
|
|
645
|
+
userName: userName, // User's SIP username (string)
|
|
646
|
+
password: password, // User's SIP password (string)
|
|
647
|
+
realm: realm, // SIP server domain (string)
|
|
648
|
+
isVideo: isVideo, // Enables or disables video calls (boolean: true/false)
|
|
649
|
+
fcmToken: token, // FCM token for Android, APNS token for iOS
|
|
650
|
+
projectId: projectId // Firebase project ID
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
// Initialize call functionality using username and password authentication
|
|
654
|
+
const result = await initCallWithUserPassword(loginInfo);
|
|
655
|
+
// If result is true, the user has successfully logged in.
|
|
610
656
|
```
|
|
611
657
|
|
|
612
|
-
|
|
658
|
+
π **configPushNotification()**
|
|
659
|
+
|
|
660
|
+
β
Description: Config push notification: func is used to configure the incoming call popup UI on Android and the representative name for iOS
|
|
613
661
|
|
|
614
662
|
```javascript
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
663
|
+
import { configPushNotification } from 'omikit-plugin';
|
|
664
|
+
|
|
665
|
+
// Configure push notifications for incoming calls
|
|
666
|
+
configPushNotification({
|
|
667
|
+
notificationIcon: "calling_face", // Notification icon for Android (located in drawable folder)
|
|
668
|
+
prefix: "Cuα»c gα»i tα»i tα»«: ", // Prefix for incoming call notifications
|
|
669
|
+
incomingBackgroundColor: "#FFFFFFFF", // Background color for incoming call screen
|
|
670
|
+
incomingAcceptButtonImage: "join_call", // Image for the accept call button
|
|
671
|
+
incomingDeclineButtonImage: "hangup", // Image for the decline call button
|
|
672
|
+
backImage: "ic_back", // Image for the back button
|
|
673
|
+
userImage: "calling_face", // Default user image for incoming calls
|
|
674
|
+
prefixMissedCallMessage: "Cuα»c gα»i nhα»‘ tα»«", // Prefix message for missed call notifications
|
|
675
|
+
missedCallTitle: "Cuα»c gα»i nhα»‘", // Title for missed call notifications
|
|
676
|
+
userNameKey: "uuid", // User identification key: options are "uuid", "full_name", or "extension"
|
|
677
|
+
channelId: "com.channel.sample", // Custom notification channel ID for Android
|
|
678
|
+
audioNotificationDescription: "", // Description for audio call notifications
|
|
679
|
+
videoNotificationDescription: "", // Description for video call notifications
|
|
680
|
+
representName: "" // Representative name to display for all incoming calls (e.g., business name)
|
|
681
|
+
});
|
|
682
|
+
|
|
683
|
+
// Note: Ensure that the following images are added to `android/app/src/main/res/drawable`:
|
|
684
|
+
// - incomingAcceptButtonImage (join_call)
|
|
685
|
+
// - incomingDeclineButtonImage (hangup)
|
|
686
|
+
// - backImage (ic_back)
|
|
687
|
+
// - userImage (calling_face)
|
|
634
688
|
```
|
|
635
689
|
|
|
636
|
-
|
|
690
|
+
π **getInitialCall()**
|
|
637
691
|
|
|
638
|
-
|
|
639
|
-
import { getInitialCall } from 'omikit-plugin';
|
|
692
|
+
β
Description: Get call when user open application at first time
|
|
640
693
|
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
694
|
+
```javascript
|
|
695
|
+
import { getInitialCall } from 'omikit-plugin';
|
|
696
|
+
|
|
697
|
+
// Check if there is an ongoing call when the app initializes
|
|
698
|
+
const callingInfo = await getInitialCall();
|
|
699
|
+
|
|
700
|
+
if (callingInfo !== false) {
|
|
701
|
+
// If there is an active call, navigate to the call screen
|
|
702
|
+
navigation.navigate('DialCall' as never, callingInfo as never);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
// If callingInfo is not false, it means the user has an ongoing call.
|
|
646
706
|
```
|
|
647
707
|
|
|
648
|
-
|
|
708
|
+
π **startCall()**
|
|
649
709
|
|
|
650
|
-
|
|
710
|
+
β
Description: Used to initiate a call to a random number, telecommunication number, hotline or internal number
|
|
651
711
|
|
|
652
712
|
```javascript
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
713
|
+
import { startCall } from 'omikit-plugin';
|
|
714
|
+
|
|
715
|
+
// Start a call with the given phone number
|
|
716
|
+
const result = await startCall({
|
|
717
|
+
phoneNumber: phone, // The phone number to call
|
|
718
|
+
isVideo: false // Set to true for a video call, false for an audio call
|
|
719
|
+
});
|
|
658
720
|
```
|
|
659
721
|
|
|
660
|
-
|
|
722
|
+
β¨ The result returned by `startCall()` is an object with the following structure:
|
|
661
723
|
|
|
662
724
|
```javascript
|
|
663
725
|
result = {
|
|
@@ -667,56 +729,72 @@ We need you request permission about call before make call:
|
|
|
667
729
|
}
|
|
668
730
|
```
|
|
669
731
|
|
|
670
|
-
|
|
732
|
+
π Detailed Description of Possible Results
|
|
671
733
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
734
|
+
| **Message** | **Status** | **Description** |
|
|
735
|
+
|-------------------------------------------|------------|-------------------------------------------------------------------------|
|
|
736
|
+
| `"INVALID_UUID"` | 0 | uid is invalid (we can not find on my page) |
|
|
737
|
+
| `"INVALID_PHONE_NUMBER"` | 1 | sip user is invalid |
|
|
738
|
+
| `"SAME_PHONE_NUMBER_WITH_PHONE_REGISTER"` | 2 | Cannot call same phone number |
|
|
739
|
+
| `"MAX_RETRY"` | 3 | Call timeout exceeded, please try again later |
|
|
740
|
+
| `"PERMISSION_DENIED"` | 4 | The user has not granted MIC or audio permissions |
|
|
741
|
+
| `"COULD_NOT_FIND_END_POINT"` | 5 | Please login before making your call |
|
|
742
|
+
| `"REGISTER_ACCOUNT_FAIL"` | 6 | Can't log in to OMI (maybe wrong login information) |
|
|
743
|
+
| `"START_CALL_FAIL"` | 7 | Call failed, please try again |
|
|
744
|
+
| `"HAVE_ANOTHER_CALL"` | 9 | There is another call in progress; please wait for that call to end |
|
|
745
|
+
| `"START_CALL_SUCCESS"` | 8 | START CALL SUCCESSFULLY |
|
|
683
746
|
|
|
684
|
-
|
|
747
|
+
<br>
|
|
685
748
|
|
|
686
|
-
|
|
749
|
+
π **startCallWithUuid()**
|
|
687
750
|
|
|
688
|
-
|
|
689
|
-
import {startCallWithUuid} from 'omikit-plugin';
|
|
690
|
-
const result = await startCallWithUuid({
|
|
691
|
-
usrUuid: uuid, //phone number
|
|
692
|
-
isVideo: false //allow video call: true/false
|
|
693
|
-
});
|
|
694
|
-
// Result is the same with startCall
|
|
695
|
-
```
|
|
751
|
+
β
Description: Call with UUID (only support with Api key):
|
|
696
752
|
|
|
697
|
-
|
|
753
|
+
```javascript
|
|
754
|
+
import { startCallWithUuid } from 'omikit-plugin';
|
|
698
755
|
|
|
699
|
-
|
|
700
|
-
|
|
756
|
+
// Initiate a call using the user's UUID. This function works similarly to `startCall()`.
|
|
757
|
+
const result = await startCallWithUuid({
|
|
758
|
+
usrUuid: uuid, // The user's UUID (unique identifier)
|
|
759
|
+
isVideo: false // Set to true for a video call, false for an audio call
|
|
760
|
+
});
|
|
701
761
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
__Note__: When calling `joinCall`, sdk will check permission of microphone and camera. If have any permission denied, sdk will send a event `onRequestPermissionAndroid` with list permission you need to request. You need to request permission before calling `joinCall` again.
|
|
762
|
+
// The result returned has the same structure as that from `startCall()`.
|
|
763
|
+
```
|
|
705
764
|
|
|
765
|
+
<br>
|
|
706
766
|
|
|
707
|
-
|
|
708
|
-
```javascript
|
|
709
|
-
import {transferCall} from 'omikit-plugin';
|
|
767
|
+
π **joinCall()**
|
|
710
768
|
|
|
711
|
-
|
|
712
|
-
phoneNumber: 102 // employee's internal number
|
|
713
|
-
})
|
|
714
|
-
```
|
|
769
|
+
β
Description: Used to join (pick up) any incoming call
|
|
715
770
|
|
|
771
|
+
```javascript
|
|
772
|
+
import {joinCall} from 'omikit-plugin';
|
|
773
|
+
|
|
774
|
+
await joinCall();
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
π Note: When calling `joinCall`, sdk will check permission of microphone and camera. If have any permission denied, sdk will send a event `onRequestPermissionAndroid` with list permission you need to request. You need to request permission before calling `joinCall` again.
|
|
716
778
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
779
|
+
|
|
780
|
+
π **transferCall()**
|
|
781
|
+
|
|
782
|
+
β
Description: Used to forward the current ongoing call to any employee in your business
|
|
783
|
+
|
|
784
|
+
```javascript
|
|
785
|
+
import {transferCall} from 'omikit-plugin';
|
|
786
|
+
|
|
787
|
+
transferCall({
|
|
788
|
+
phoneNumber: 102 // employee's internal number
|
|
789
|
+
})
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
π **endCall()**
|
|
793
|
+
|
|
794
|
+
β
Description: We will push a event `endCall` for you.
|
|
795
|
+
|
|
796
|
+
```javascript
|
|
797
|
+
import {endCall} from 'omikit-plugin';
|
|
720
798
|
|
|
721
799
|
const value = await endCall();
|
|
722
800
|
//value is call information
|
|
@@ -731,124 +809,172 @@ We need you request permission about call before make call:
|
|
|
731
809
|
"sip_user":111,
|
|
732
810
|
"disposition":"answered"
|
|
733
811
|
}
|
|
734
|
-
|
|
812
|
+
```
|
|
735
813
|
|
|
736
|
-
|
|
814
|
+
π **toggleMute()**
|
|
737
815
|
|
|
738
|
-
|
|
739
|
-
import {toggleMute} from 'omikit-plugin';
|
|
816
|
+
β
Description: Toggle the audio, On/off audio a call
|
|
740
817
|
|
|
741
|
-
|
|
742
|
-
|
|
818
|
+
```javascript
|
|
819
|
+
import {toggleMute} from 'omikit-plugin';
|
|
820
|
+
|
|
821
|
+
toggleMute();
|
|
822
|
+
```
|
|
743
823
|
|
|
744
|
-
|
|
824
|
+
π **toggleSpeaker()**
|
|
745
825
|
|
|
746
|
-
|
|
747
|
-
import {toggleSpeaker} from 'omikit-plugin';
|
|
826
|
+
β
Description: Toggle the speaker, On/off the phone speaker
|
|
748
827
|
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
828
|
+
```javascript
|
|
829
|
+
import {toggleSpeaker} from 'omikit-plugin';
|
|
830
|
+
|
|
831
|
+
toggleSpeaker();
|
|
832
|
+
```
|
|
752
833
|
|
|
753
|
-
|
|
754
|
-
|
|
834
|
+
π **toggleHold()**
|
|
835
|
+
|
|
836
|
+
β
Description: hold current call
|
|
837
|
+
|
|
838
|
+
```javascript
|
|
839
|
+
import {toggleHold} from 'omikit-plugin';
|
|
840
|
+
|
|
841
|
+
toggleHold();
|
|
842
|
+
```
|
|
755
843
|
|
|
756
|
-
|
|
757
|
-
```
|
|
844
|
+
π **sendDTMF()**
|
|
758
845
|
|
|
759
|
-
|
|
846
|
+
β
Description: Send character: We only support `1 to 9` and `* #`.
|
|
760
847
|
|
|
761
|
-
|
|
848
|
+
```javascript
|
|
762
849
|
// FUNC IS USED when the user wants key interaction during a call. For example, press key 1, 2, 3.. to move to group
|
|
763
850
|
import {sendDTMF} from 'omikit-plugin';
|
|
764
851
|
|
|
765
852
|
sendDTMF({
|
|
766
853
|
character: text,
|
|
767
854
|
});
|
|
768
|
-
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
π **getCurrentUser()**
|
|
769
858
|
|
|
770
|
-
|
|
771
|
-
|
|
859
|
+
β
Description: Retrieves the current user's information.
|
|
860
|
+
|
|
861
|
+
```javascript
|
|
862
|
+
import {getCurrentUser} from 'omikit-plugin';
|
|
772
863
|
final user = await getCurrentUser();
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
864
|
+
```
|
|
865
|
+
|
|
866
|
+
β¨ Output Sample:
|
|
867
|
+
|
|
868
|
+
```javascript
|
|
869
|
+
{
|
|
870
|
+
"extension": "111",
|
|
871
|
+
"full_name": "chau1",
|
|
872
|
+
"avatar_url": "",
|
|
873
|
+
"uuid": "122aaa"
|
|
874
|
+
}
|
|
875
|
+
```
|
|
876
|
+
|
|
877
|
+
π **getGuestUser()**
|
|
878
|
+
|
|
879
|
+
β
Description: Get guest user information:
|
|
880
|
+
|
|
881
|
+
```javascript
|
|
882
|
+
import {getGuestUser} from 'omikit-plugin';
|
|
783
883
|
final user = await getGuestUser();
|
|
784
|
-
|
|
785
|
-
{
|
|
786
|
-
"extension": "111",
|
|
787
|
-
"full_name": "chau1",
|
|
788
|
-
"avatar_url": "",
|
|
789
|
-
"uuid": "122aaa"
|
|
790
|
-
}
|
|
791
|
-
```
|
|
792
|
-
- Get user information from sip:
|
|
884
|
+
```
|
|
793
885
|
|
|
794
|
-
|
|
795
|
-
final user = await getUserInfo("111");
|
|
796
|
-
Output Sample:
|
|
797
|
-
{
|
|
798
|
-
"extension": "111",
|
|
799
|
-
"full_name": "chau1",
|
|
800
|
-
"avatar_url": "",
|
|
801
|
-
"uuid": "122aaa"
|
|
802
|
-
}
|
|
803
|
-
```
|
|
804
|
-
- __endCall__: End a completed call (including rejecting a call).
|
|
886
|
+
β¨ Output Sample:
|
|
805
887
|
|
|
806
|
-
|
|
807
|
-
|
|
888
|
+
```javascript
|
|
889
|
+
{
|
|
890
|
+
"extension": "111",
|
|
891
|
+
"full_name": "chau1",
|
|
892
|
+
"avatar_url": "",
|
|
893
|
+
"uuid": "122aaa"
|
|
894
|
+
}
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
π **ggetUserInfo()**
|
|
898
|
+
|
|
899
|
+
β
Description: Get user information from internal number
|
|
900
|
+
|
|
901
|
+
```javascript
|
|
902
|
+
import {getUserInfo} from 'omikit-plugin';
|
|
903
|
+
final user = await ggetUserInfo("111");
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
β¨ Output Sample:
|
|
808
907
|
|
|
908
|
+
```javascript
|
|
909
|
+
{
|
|
910
|
+
"extension": "111",
|
|
911
|
+
"full_name": "chau1",
|
|
912
|
+
"avatar_url": "",
|
|
913
|
+
"uuid": "122aaa"
|
|
914
|
+
}
|
|
915
|
+
```
|
|
916
|
+
|
|
917
|
+
π **endCall()**
|
|
918
|
+
|
|
919
|
+
β
Description: End a completed call (including rejecting a call).
|
|
920
|
+
|
|
921
|
+
```javascript
|
|
922
|
+
import {endCall} from 'omikit-plugin';
|
|
809
923
|
endCall();
|
|
810
|
-
|
|
811
|
-
- __rejectCall__: Used to reject an incoming call when the user has not accepted it yet.
|
|
812
|
-
Note: Do not use this function to end an ongoing call.
|
|
924
|
+
```
|
|
813
925
|
|
|
814
|
-
```javascript
|
|
815
|
-
import {rejectCall} from 'omikit-plugin';
|
|
816
926
|
|
|
927
|
+
π **rejectCall()**
|
|
928
|
+
|
|
929
|
+
β
Description: Used to reject an incoming call when the user has not accepted it yet.
|
|
930
|
+
|
|
931
|
+
π Note: Do not use this function to end an ongoing call.
|
|
932
|
+
|
|
933
|
+
```javascript
|
|
934
|
+
import {rejectCall} from 'omikit-plugin';
|
|
817
935
|
rejectCall();
|
|
818
|
-
|
|
819
|
-
- __Logout__: logout and remove all information.
|
|
936
|
+
```
|
|
820
937
|
|
|
821
|
-
```javascript
|
|
822
|
-
import {logout} from 'omikit-plugin';
|
|
823
938
|
|
|
939
|
+
π **logout()**
|
|
940
|
+
|
|
941
|
+
β
Description: logout and remove all information.
|
|
942
|
+
|
|
943
|
+
```javascript
|
|
944
|
+
import {logout} from 'omikit-plugin';
|
|
824
945
|
logout();
|
|
825
|
-
|
|
946
|
+
```
|
|
826
947
|
|
|
827
|
-
|
|
948
|
+
π **systemAlertWindow()**
|
|
828
949
|
|
|
829
|
-
|
|
830
|
-
import {systemAlertWindow} from 'omikit-plugin';
|
|
950
|
+
β
Description: Check system alert window permission (only Android).
|
|
831
951
|
|
|
832
|
-
|
|
833
|
-
|
|
952
|
+
```javascript
|
|
953
|
+
import {systemAlertWindow} from 'omikit-plugin';
|
|
954
|
+
const isAllow = await systemAlertWindow();
|
|
834
955
|
//true => allow
|
|
835
956
|
//false => denied
|
|
836
|
-
|
|
837
|
-
|
|
957
|
+
```
|
|
958
|
+
|
|
838
959
|
|
|
839
|
-
|
|
960
|
+
π **openSystemAlertSetting()**
|
|
840
961
|
|
|
841
|
-
|
|
842
|
-
|
|
962
|
+
β
Description: Open to enable system alert window (only Android).
|
|
963
|
+
|
|
964
|
+
```javascript
|
|
965
|
+
import {openSystemAlertSetting} from 'omikit-plugin';
|
|
843
966
|
|
|
844
967
|
if (Platform.OS === 'android') {
|
|
845
968
|
openSystemAlertSetting();
|
|
846
969
|
}
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
π **getCurrentAudio()**
|
|
973
|
+
|
|
974
|
+
β
Description: Get current information of audio devices
|
|
975
|
+
|
|
976
|
+
```javascript
|
|
977
|
+
import {getCurrentAudio} from 'omikit-plugin';
|
|
852
978
|
|
|
853
979
|
getCurrentAudio().then((data: any) => {
|
|
854
980
|
console.log(data); // [{"name": "Speaker", "type": "Speaker"}]
|
|
@@ -856,10 +982,14 @@ We need you request permission about call before make call:
|
|
|
856
982
|
// - name: Name of the audio device
|
|
857
983
|
// - type: Audio device type (e.g. "Speaker", "Receiver", etc.)
|
|
858
984
|
});
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
985
|
+
```
|
|
986
|
+
|
|
987
|
+
π **setAudio()**
|
|
988
|
+
|
|
989
|
+
β
Description: set Audio calls the current device
|
|
990
|
+
|
|
991
|
+
```javascript
|
|
992
|
+
import { getAudio, setAudio} from 'omikit-plugin';
|
|
863
993
|
|
|
864
994
|
const audioList = await getAudio(); // Get a list of supported audio device types
|
|
865
995
|
console.log("audioList --> ", audioList) // audioList --> [{"name": "Receiver", "type": "Receiver"}, {"name": "Speaker", "type": "Speaker"}]
|
|
@@ -871,60 +1001,63 @@ We need you request permission about call before make call:
|
|
|
871
1001
|
setAudio({
|
|
872
1002
|
portType: receiver.type,
|
|
873
1003
|
});
|
|
874
|
-
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1006
|
+
##### π Video Call functions: Support only video call, You need enable video in `init functions` and `start call` to implements under functions.
|
|
875
1007
|
|
|
876
|
-
|
|
1008
|
+
β
Description: Video Call functions: Support only video call, You need enable video in `init functions` and `start call` to implements under functions.
|
|
877
1009
|
|
|
878
|
-
|
|
1010
|
+
|
|
1011
|
+
π Switch front/back camera: We use the front camera for first time.
|
|
879
1012
|
|
|
880
1013
|
```javascript
|
|
881
1014
|
import {switchOmiCamera} from 'omikit-plugin';
|
|
882
1015
|
switchOmiCamera();
|
|
883
1016
|
```
|
|
884
1017
|
|
|
885
|
-
|
|
1018
|
+
π Toggle a video in video call: On/off video in video call
|
|
886
1019
|
|
|
887
1020
|
```javascript
|
|
888
1021
|
import {toggleOmiVideo} from 'omikit-plugin';
|
|
889
1022
|
toggleOmiVideo();
|
|
890
1023
|
```
|
|
891
1024
|
|
|
892
|
-
|
|
1025
|
+
π Local Camera Widget: Your camera view in a call
|
|
893
1026
|
|
|
894
1027
|
```javascript
|
|
895
1028
|
import { OmiLocalCameraView } from 'omikit-plugin';
|
|
896
1029
|
<OmiLocalCameraView style={styles.localCamera} />
|
|
897
1030
|
```
|
|
898
1031
|
|
|
899
|
-
|
|
1032
|
+
π Remote Camera Widget: Remote camera view in a call
|
|
900
1033
|
|
|
901
1034
|
```javascript
|
|
902
1035
|
import { OmiRemoteCameraView } from 'omikit-plugin';
|
|
903
1036
|
<OmiRemoteCameraView style={styles.remoteCamera} />
|
|
904
1037
|
```
|
|
905
1038
|
|
|
906
|
-
|
|
1039
|
+
π More function: Refresh local camera
|
|
907
1040
|
|
|
908
1041
|
```javascript
|
|
909
1042
|
import {refreshLocalCamera} from 'omikit-plugin';
|
|
910
1043
|
refreshLocalCamera();
|
|
911
1044
|
```
|
|
912
1045
|
|
|
913
|
-
|
|
1046
|
+
π More function: Refresh remote camera
|
|
914
1047
|
|
|
915
1048
|
```javascript
|
|
916
1049
|
import {refreshRemoteCamera} from 'omikit-plugin';
|
|
917
1050
|
refreshRemoteCamera();
|
|
918
1051
|
```
|
|
919
1052
|
|
|
920
|
-
|
|
1053
|
+
π Register event: Register remote video ready: only visible on iOS
|
|
921
1054
|
|
|
922
1055
|
```javascript
|
|
923
1056
|
import {registerVideoEvent} from 'omikit-plugin';
|
|
924
1057
|
registerVideoEvent();
|
|
925
1058
|
```
|
|
926
1059
|
|
|
927
|
-
|
|
1060
|
+
### ππ Events listener ππ
|
|
928
1061
|
|
|
929
1062
|
```javascript
|
|
930
1063
|
useEffect(() => {
|
|
@@ -967,24 +1100,32 @@ useEffect(() => {
|
|
|
967
1100
|
}, []);
|
|
968
1101
|
```
|
|
969
1102
|
|
|
970
|
-
- Important
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1103
|
+
- β
**Important Event: `onCallStateChanged`**
|
|
1104
|
+
This event is used to listen for call state changes. The emitted event is an `OmiAction` object containing two properties: `actionName` and `data`.
|
|
1105
|
+
|
|
1106
|
+
- π **Action Name Values:**
|
|
1107
|
+
- **`onCallStateChanged`**: Indicates that the call state has changed.
|
|
1108
|
+
- **`onSwitchboardAnswer`**: Indicates that the switchboard SIP is listening.
|
|
1109
|
+
- **Call Status Values:**
|
|
1110
|
+
- `unknown` (0)
|
|
1111
|
+
- `calling` (1)
|
|
1112
|
+
- `incoming` (2)
|
|
1113
|
+
- `early` (3)
|
|
1114
|
+
- `connecting` (4)
|
|
1115
|
+
- `confirmed` (5)
|
|
1116
|
+
- `disconnected` (6)
|
|
1117
|
+
- `hold` (7)
|
|
1118
|
+
|
|
1119
|
+
> **Note:** The `onCallStateChanged` event tracks the current state of the call. Please refer to `OmiCallState` for detailed status descriptions.
|
|
1120
|
+
|
|
1121
|
+
### π **Call State Lifecycle**
|
|
1122
|
+
- β
**Incoming Call Lifecycle:**
|
|
1123
|
+
`incoming` β `connecting` β `confirmed` β `disconnected`
|
|
1124
|
+
|
|
1125
|
+
- β
**Outgoing Call Lifecycle:**
|
|
1126
|
+
`calling` β `early` β `connecting` β `confirmed` β `disconnected`
|
|
1127
|
+
|
|
1128
|
+
|
|
988
1129
|
```javascript
|
|
989
1130
|
// The event is updated every time the call status changes
|
|
990
1131
|
const onCallStateChanged = (data: any) => {
|
|
@@ -1039,12 +1180,7 @@ const onSwitchboardAnswer = (data: any) => {
|
|
|
1039
1180
|
}
|
|
1040
1181
|
```
|
|
1041
1182
|
|
|
1042
|
-
|
|
1043
|
-
* **`Incoming call` state lifecycle**: incoming -> connecting -> confirmed -> disconnected
|
|
1044
|
-
* **`Outgoing call` state lifecycle**: calling -> early -> connecting -> confirmed -> disconnected
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
- Table describing code_end_call status
|
|
1183
|
+
β¨ Table describing `code_end_call` status
|
|
1048
1184
|
|
|
1049
1185
|
| Code | Description |
|
|
1050
1186
|
| --------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -1076,19 +1212,9 @@ const onSwitchboardAnswer = (data: any) => {
|
|
|
1076
1212
|
| `864` | Temporary block on Mobifone direction, please try again |
|
|
1077
1213
|
| `865` | he advertising number is currently outside the permitted calling hours, please try again later |
|
|
1078
1214
|
|
|
1079
|
-
|
|
1080
|
-
- `OmiCallEvent.onMuted`: Audio changed.
|
|
1081
|
-
- `OmiCallEvent.onSpeaker`: Audio changed.
|
|
1082
|
-
- `OmiCallEvent.onClickMissedCall`: Click missed call notification.
|
|
1083
|
-
- `OmiCallEvent.onSwitchboardAnswer`: Switchboard sip is listening.
|
|
1084
|
-
- `OmiCallEvent.onCallQuality`: The calling quality.
|
|
1085
|
-
- `OmiCallEvent.onRequestPermission`: Show a list permission you need to request before calling `joinCall` again.
|
|
1086
|
-
- `OmiCallEvent.onHold`: hold current call
|
|
1087
|
-
- Data value: We return `callerNumber`, `sip`, `isVideo: true/false` information
|
|
1088
|
-
|
|
1215
|
+
# β οΈ Issues
|
|
1089
1216
|
|
|
1090
|
-
# Issues
|
|
1091
1217
|
|
|
1092
|
-
## iOS
|
|
1218
|
+
## β¨ iOS
|
|
1093
1219
|
|
|
1094
1220
|
- Must use "Rosetta Destination" to run debug example app on macOS Apple chip
|
package/android/build.gradle
CHANGED
|
@@ -120,7 +120,7 @@ dependencies {
|
|
|
120
120
|
// use for OMISDK
|
|
121
121
|
implementation("androidx.work:work-runtime:2.8.1")
|
|
122
122
|
implementation "androidx.security:security-crypto:1.1.0-alpha06"
|
|
123
|
-
api 'vn.vihat.omicall:omi-sdk:2.3.
|
|
123
|
+
api 'vn.vihat.omicall:omi-sdk:2.3.19'
|
|
124
124
|
|
|
125
125
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
126
126
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
@@ -42,7 +42,6 @@ class CallManager {
|
|
|
42
42
|
var result = false;
|
|
43
43
|
do {
|
|
44
44
|
if let callInfo = self.omiLib.getCurrentConfirmCall() {
|
|
45
|
-
dump(callInfo)
|
|
46
45
|
if callInfo.callState != .disconnected {
|
|
47
46
|
callInfo.blindTransferCall(withNumber: phoneNumber);
|
|
48
47
|
result = true
|
|
@@ -51,7 +50,6 @@ class CallManager {
|
|
|
51
50
|
} catch let error {
|
|
52
51
|
print("ERROR_WHEN_TRANSFER_CALL_IOS: ", error)
|
|
53
52
|
}
|
|
54
|
-
print("calllZiii 2 ==> \(result)")
|
|
55
53
|
return result
|
|
56
54
|
}
|
|
57
55
|
|
|
@@ -497,12 +495,10 @@ class CallManager {
|
|
|
497
495
|
|
|
498
496
|
/// Toogle speaker
|
|
499
497
|
func toogleSpeaker() {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
}
|
|
505
|
-
isSpeaker = !isSpeaker
|
|
498
|
+
OMIAudioController *audioController = [[OMISIPLib.sharedInstance callManager] audioController];
|
|
499
|
+
OMIAudioControllerOutputs newOutput = (audioController.output == OMIAudioControllerOutputSpeaker) ? OMIAudioControllerOutputOther : OMIAudioControllerOutputSpeaker;
|
|
500
|
+
[audioController setOutput:newOutput];
|
|
501
|
+
self.isSpeaker = newOutput == OMIAudioControllerOutputSpeaker;
|
|
506
502
|
OmikitPlugin.instance.sendSpeakerStatus()
|
|
507
503
|
}
|
|
508
504
|
|
package/omikit-plugin.podspec
CHANGED