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 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
- ### Running
17
+ ## πŸ› οΈ Configuration
17
18
 
18
- Install via npm:
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
- ### Configuration
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
- ```kotlin
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
- - Update AndroidManifest.xml:
113
+ <br>
108
114
 
109
- ```kotlin
115
+ πŸ“Œ **Config AndroidManifest.xml file**
116
+
117
+
118
+
119
+ ```xml
110
120
  <manifest
111
- ......
112
121
  xmlns:tools="http://schemas.android.com/tools">
113
- ..... // your config
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
- ..... // your config
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
- ..... // your config
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
- ..... // your config
151
+ // ... your config
145
152
  >
146
- ..... // your config
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
- ..... // your config
165
+ // ... your config
159
166
  </activity>
160
- ..... // your config
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
- ..... // your config
183
+ // ... your config
177
184
  </application>
178
185
  </manifest>
179
186
  ```
180
187
 
181
- ##### In file MainActivity:
182
- # For React Native < 0.74
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
- ..... // your config
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
- ..... // your config
220
+ // your config ...
212
221
  }
213
222
  }
214
223
  ```
215
224
 
216
- # For React Native > 0.74
225
+ ### βœ… For React Native > 0.74
226
+
217
227
 
218
228
  ```kotlin
219
229
  class MainActivity : ReactActivity() {
220
- ..... // your config
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
- ..... // your config
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
- ## Config for IOS
286
+ <br>
277
287
 
278
- #### iOS(Object-C):
288
+ *Now let's continue configuring iOS, let's go πŸš€*
279
289
 
280
- - Assets: Add `call_image` into assets folder to update callkit image. We only support png style.
290
+ ##### πŸš€ Config for IOS
281
291
 
282
- - Add variables in **Appdelegate.h** for **Old Architecture**:
292
+ ##### πŸ“Œ iOS(Object-C):
283
293
 
284
- ```objective-c
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
- ```objective-c
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
- - Edit AppDelegate.m:
333
+ - βœ… Update AppDelegate.m:
320
334
 
321
- ```objective-c
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
- ```swift
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
- ```swift
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
- **_ Only use under lines when added `Cloud Messaging` plugin in your project _**
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
- - Add `google-service.json` in `android/app` (For more information, you can refer <a href="https://rnfirebase.io/app/usage">Core/App</a>)
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
- \*Note: At Tab Build Setting off Target Project, you need set: **_Enable Modules (C and Objective C)_** : YES\*
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
- #### Currently, OMICALL does not support React Native new architect.
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
- Open file android/gradle.properties and add line below:
461
+ βœ… For Android
462
+
463
+ - Open file **_android/gradle.properties_** and add line below:
445
464
  ```kotlin
446
- # TαΊ―t New Architecture
465
+ # Turn off New Architecture
447
466
  newArchEnabled=false
448
467
  ```
449
- #### iOS(Swift):
468
+ #### πŸ“Œ iOS(Swift):
450
469
 
451
- - Assets: Add `call_image` into assets folder to update callkit image. We only support png style.
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
- ```swift
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
- **_ Only use under lines when added `Cloud Messaging` plugin in your project _**
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
- - Add `google-service.json` in `android/app` (For more information, you can refer <a href="https://rnfirebase.io/app/usage">Core/App</a>)
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
- ## Implement
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
- - Important function.
565
+ πŸ“Œ **startServices()**
545
566
 
546
- - Start Serivce: OmiKit need start services and register some events.
567
+ βœ… Description:
547
568
 
548
- ```javascript
549
- //Call in the root widget
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
- startServices();
553
- ```
572
+ - Usage:
573
+ ```javascript
574
+ // Import startServices from omikit-plugin
575
+ import { startServices } from 'omikit-plugin';
554
576
 
555
- - OmiKit need FCM for Android and APNS to push notification on user devices. We use more packages: <a href="https://rnfirebase.io/messaging/usage">Cloud Messaging</a>
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
- - Create OmiKit With ApiKey: OmiKit need apikey, username, user id to init environment(All information in innit is required). ViHAT Group will provide api key for you. This function is used when making calls from customers to switchboard numbers (not making internal calls).
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
- ```javascript
562
- import { initCallWithApiKey } from 'omikit-plugin';
563
- import messaging from '@react-native-firebase/messaging';
586
+ πŸ“Œ **initCallWithApiKey()**
564
587
 
565
- let token: String
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
- const loginInfo = {
573
- usrUuid: usrUuid,
574
- fullName: fullName,
575
- apiKey: apiKey,
576
- phone: phone,
577
- fcmToken: token, //with android is fcm_token and ios is APNS token
578
- isVideo: isVideo,
579
- projectId: projectId // firebase project id off your
580
- };
581
- const result = await initCallWithApiKey(loginInfo);
582
- //result is true then user login successfully.
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
- - Create OmiKit: OmiKit need userName, password, realm, fcmToken to init environment(All information in innit is required). ViHAT Group will provide information for you.
586
- This function is used when you want to call any telecommunication number, calling back and forth between internal groups.
587
- Please contact for my sale:
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
- import { initCallWithUserPassword } from 'omikit-plugin';
591
- import messaging from '@react-native-firebase/messaging';
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
- const loginInfo = {
601
- userName: userName, //string
602
- password: password, //string
603
- realm: realm, //string
604
- isVideo: isVideo, //boolean: true/false
605
- fcmToken: token, //with android is fcm_token and ios is APNS token,
606
- projectId: projectId // firebase project id off your
607
- };
608
- const result = await initCallWithUserPassword(loginInfo);
609
- //result is true then user login successfully.
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
- - Config push notification:
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
- import { configPushNotification } from 'omikit-plugin';
616
-
617
- configPushNotification({
618
- notificationIcon : "calling_face", //notification icon on Android
619
- prefix : "Cuα»™c gọi tα»›i tα»«: ",
620
- incomingBackgroundColor : "#FFFFFFFF",
621
- incomingAcceptButtonImage : "join_call", //image name
622
- incomingDeclineButtonImage : "hangup", //image name
623
- backImage : "ic_back", //image name: icon of back button
624
- userImage : "calling_face", //image name: icon of user default
625
- prefixMissedCallMessage: 'Cuα»™c gọi nhα»‘ tα»«', //config prefix message for the missed call
626
- missedCallTitle: 'Cuα»™c gọi nhα»‘', //config title for the missed call
627
- userNameKey: 'uuid', //we have 3 values: uuid, full_name, extension.
628
- channelId: 'com.channel.sample', //your notification channel id
629
- audioNotificationDescription: '' //audio description
630
- videoNotificationDescription: '' //video descriptipn,
631
- representName: '' // Pass down the representative name if you want all incoming calls on the customer app to display only 1 unique name of your business
632
- });
633
- //incomingAcceptButtonImage, incomingDeclineButtonImage, backImage, userImage: Add these into `android/app/src/main/res/drawble`
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
- - Get call when user open application at first time:
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
- const callingInfo = await getInitialCall();
642
- if (callingInfo !== false) {
643
- navigation.navigate('DialCall' as never, callingInfo as never);
644
- }
645
- //callingInfo != false then user have a calling.
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
- - Other functions:
708
+ πŸ“Œ **startCall()**
649
709
 
650
- - Call with phone number (mobile phone or internal number):
710
+ βœ… Description: Used to initiate a call to a random number, telecommunication number, hotline or internal number
651
711
 
652
712
  ```javascript
653
- import {startCall} from 'omikit-plugin';
654
- const result = await startCall({
655
- phoneNumber: phone, //phone number
656
- isVideo: false //allow video call: true/false
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
- - The result will be in the form of object:
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
- - Describe in detail the results when startCall returns:
732
+ πŸ“ Detailed Description of Possible Results
671
733
 
672
- ```javascript
673
- + message="INVALID_UUID" (status = 0) : uid is invalid (we can not find on my page).
674
- + message="INVALID_PHONE_NUMBER" (status = 1) : sip user is invalid.
675
- + message="SAME_PHONE_NUMBER_WITH_PHONE_REGISTER" (status = 2) : Can not call same phone number.
676
- + message="MAX_RETRY" (status = 3) : call timeout exceeded, please try again later.
677
- + message="PERMISSION_DENIED" (status = 4) : The user has not granted MIC or audio permissions.
678
- + message="COULD_NOT_FIND_END_POINT" (status = 5) : Please login before make your call.
679
- + message="REGISTER_ACCOUNT_FAIL" (status = 6) : Can't log in to OMI( maybe wrong login information).
680
- + message="START_CALL_FAIL" (status = 7) : Call failed, please try again
681
- + message="HAVE_ANOTHER_CALL" (status = 9) : There is another call in progress, please wait for that call to end
682
- + message="START_CALL_SUCCESS" (status = 8) : START CALL SUCCESSFULLY.
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
- - Call with UUID (only support with Api key):
749
+ πŸ“Œ **startCallWithUuid()**
687
750
 
688
- ```javascript
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
- - __Accept a call__:
753
+ ```javascript
754
+ import { startCallWithUuid } from 'omikit-plugin';
698
755
 
699
- ```javascript
700
- import {joinCall} from 'omikit-plugin';
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
- await joinCall();
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
- - __Call forwarding__: used to transfer the current call to any employee's sip number
708
- ```javascript
709
- import {transferCall} from 'omikit-plugin';
767
+ πŸ“Œ **joinCall()**
710
768
 
711
- transferCall({
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
- - __End a call__ : We will push a event `endCall` for you.
718
- ```javascript
719
- import {endCall} from 'omikit-plugin';
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
- - Toggle the audio: On/off audio a call
814
+ πŸ“Œ **toggleMute()**
737
815
 
738
- ```javascript
739
- import {toggleMute} from 'omikit-plugin';
816
+ βœ… Description: Toggle the audio, On/off audio a call
740
817
 
741
- toggleMute();
742
- ```
818
+ ```javascript
819
+ import {toggleMute} from 'omikit-plugin';
820
+
821
+ toggleMute();
822
+ ```
743
823
 
744
- - Toggle the speaker: On/off the phone speaker
824
+ πŸ“Œ **toggleSpeaker()**
745
825
 
746
- ```javascript
747
- import {toggleSpeaker} from 'omikit-plugin';
826
+ βœ… Description: Toggle the speaker, On/off the phone speaker
748
827
 
749
- toggleSpeaker();
750
- ```
751
- - Toggle the hold: hold current call
828
+ ```javascript
829
+ import {toggleSpeaker} from 'omikit-plugin';
830
+
831
+ toggleSpeaker();
832
+ ```
752
833
 
753
- ```javascript
754
- import {toggleHold} from 'omikit-plugin';
834
+ πŸ“Œ **toggleHold()**
835
+
836
+ βœ… Description: hold current call
837
+
838
+ ```javascript
839
+ import {toggleHold} from 'omikit-plugin';
840
+
841
+ toggleHold();
842
+ ```
755
843
 
756
- toggleHold();
757
- ```
844
+ πŸ“Œ **sendDTMF()**
758
845
 
759
- - Send character: We only support `1 to 9` and `* #`.
846
+ βœ… Description: Send character: We only support `1 to 9` and `* #`.
760
847
 
761
- ```javascript
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
- - Get current user information:
771
- ```javascript
859
+ βœ… Description: Retrieves the current user's information.
860
+
861
+ ```javascript
862
+ import {getCurrentUser} from 'omikit-plugin';
772
863
  final user = await getCurrentUser();
773
- Output Sample:
774
- {
775
- "extension": "111",
776
- "full_name": "chau1",
777
- "avatar_url": "",
778
- "uuid": "122aaa"
779
- }
780
- ```
781
- - Get guest user information:
782
- ```javascript
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
- Output Sample:
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
- ```javascript
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
- ```javascript
807
- import {endCall} from 'omikit-plugin';
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
- - __Permission__: Check system alert window permission (only Android).
948
+ πŸ“Œ **systemAlertWindow()**
828
949
 
829
- ```javascript
830
- import {systemAlertWindow} from 'omikit-plugin';
950
+ βœ… Description: Check system alert window permission (only Android).
831
951
 
832
- if (Platform.OS === 'android') {
833
- const isAllow = await systemAlertWindow();
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
- - __Setting__: Open to enable system alert window (only Android).
960
+ πŸ“Œ **openSystemAlertSetting()**
840
961
 
841
- ```javascript
842
- import {openSystemAlertSetting} from 'omikit-plugin';
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
- - __Audio__:
849
- - func *getCurrentAudio*: Get current information of audio devices
850
- ```javascript
851
- import {getCurrentAudio} from 'omikit-plugin';
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
- - func setAudio: set Audio calls the current device
861
- ```javascript
862
- import { getAudio, setAudio} from 'omikit-plugin';
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
- - Video Call functions: Support only video call, You need enable video in `init functions` and `start call` to implements under functions.
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
- - Switch front/back camera: We use the front camera for first time.
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
- - Toggle a video in video call: On/off video in video call
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
- - Local Camera Widget: Your camera view in a call
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
- - Remote Camera Widget: Remote camera view in a call
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
- - More function: Refresh local camera
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
- - More function: Refresh remote camera
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
- - Register event: Register remote video ready: only visible on iOS
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
- - *Event listener*:
1060
+ ### πŸš€πŸš€ Events listener πŸš€πŸš€
928
1061
 
929
1062
  ```javascript
930
1063
  useEffect(() => {
@@ -967,24 +1100,32 @@ useEffect(() => {
967
1100
  }, []);
968
1101
  ```
969
1102
 
970
- - Important event `onCallStateChanged`: We provide it to listen call state change.
971
- // OmiAction have 2 variables: actionName and data
972
-
973
- - Action Name value:
974
- - `onCallStateChanged`: Call state changed.
975
- - `onSwitchboardAnswer`: Switchboard sip is listening.
976
- - List status call:
977
- - unknown(0),
978
- - calling(1),
979
- - incoming(2),
980
- - early(3),
981
- - connecting(4),
982
- - confirmed(5),
983
- - disconnected(6);
984
- - hold(7);
985
-
986
- * onCallStateChanged is call state tracking event. We will return status of state. Please refer `OmiCallState`.
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
- ### πŸ“ž Call State Lifecycle
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
- - Action Name value:
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
@@ -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.17'
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"
@@ -4,4 +4,4 @@ OmikitPlugin_targetSdkVersion=33
4
4
  OmikitPlugin_compileSdkVersion=33
5
5
  OmikitPlugin_ndkversion=21.4.7075529
6
6
  OMI_USER=omicall
7
- OMI_TOKEN=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
7
+ OMI_TOKEN=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
@@ -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
- if !isSpeaker {
501
- try? AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)
502
- } else {
503
- try? AVAudioSession.sharedInstance().overrideOutputAudioPort(.none)
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
 
@@ -31,7 +31,7 @@ Pod::Spec.new do |s|
31
31
 
32
32
  # ThΓͺm dependency bαΊ―t buα»™c
33
33
  s.dependency "React-Core"
34
- s.dependency "OmiKit", "1.8.4"
34
+ s.dependency "OmiKit", "1.8.6"
35
35
 
36
36
  # Đảm bαΊ£o Swift bridging header được tα»± Δ‘α»™ng tαΊ‘o
37
37
  # s.requires_arc = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omikit-plugin",
3
- "version": "3.2.66",
3
+ "version": "3.2.68",
4
4
  "description": "Omikit Plugin by ViHAT",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",