omikit-plugin 3.2.39 → 3.2.41

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
@@ -17,13 +17,13 @@ Currently active maintenance and improve performance
17
17
 
18
18
  Install via npm:
19
19
 
20
- ```sh
20
+ ```ruby
21
21
  npm install omikit-plugin@latest
22
22
  ```
23
23
 
24
24
  Install via yarn:
25
25
 
26
- ```sh
26
+ ```ruby
27
27
  yarn add omikit-plugin --latest
28
28
  ```
29
29
 
@@ -33,7 +33,7 @@ yarn add omikit-plugin --latest
33
33
 
34
34
  - Add these settings in `build.gradle`:
35
35
 
36
- ```
36
+ ```kotlin
37
37
  jcenter()
38
38
  maven {
39
39
  url "https://maven.pkg.github.com/omicall/OMICall-SDK"
@@ -46,22 +46,19 @@ maven {
46
46
  }
47
47
  }
48
48
 
49
- dependencies {
50
- api 'vn.vihat.omicall:omi-sdk:2.2.85'
51
- }
52
- ```
53
49
  ```
50
+ ```kotlin
54
51
  // gradle.properties
55
52
  OMI_USER=omicall
56
- OMI_TOKEN=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
53
+ OMI_TOKEN=${OMI_TOKEN} // connect with dev off OMI for get token
57
54
  ```
58
55
 
59
- ```
56
+ ```kotlin
60
57
  // in dependencies
61
58
  classpath 'com.google.gms:google-services:4.3.13'
62
59
  ```
63
60
 
64
- ```
61
+ ```kotlin
65
62
  // under buildscript
66
63
  allprojects {
67
64
  repositories {
@@ -100,7 +97,7 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
100
97
 
101
98
  - Add these settings in `app/build.gradle`:
102
99
 
103
- ```
100
+ ```kotlin
104
101
  apply plugin: 'com.android.application'
105
102
  apply plugin: 'com.google.gms.google-services'
106
103
  ```
@@ -109,7 +106,7 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
109
106
 
110
107
  - Update AndroidManifest.xml:
111
108
 
112
- ```
109
+ ```kotlin
113
110
  <manifest
114
111
  ......
115
112
  xmlns:tools="http://schemas.android.com/tools">
@@ -183,7 +180,7 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
183
180
 
184
181
  ##### In file MainActivity:
185
182
 
186
- ```
183
+ ```java
187
184
  public class MainActivity extends ReactActivity {
188
185
  ..... // your config
189
186
 
@@ -230,7 +227,7 @@ public class MainActivity extends ReactActivity {
230
227
 
231
228
  - Add variables in **Appdelegate.h** for **Old Architecture**:
232
229
 
233
- ```
230
+ ```objective-c
234
231
  #import <UIKit/UIKit.h>
235
232
  #import <UserNotifications/UserNotifications.h>
236
233
  #import <OmiKit/OmiKit-umbrella.h>
@@ -248,7 +245,7 @@ public class MainActivity extends ReactActivity {
248
245
 
249
246
  - Add variables in **Appdelegate.h** for **New Architecture**:
250
247
 
251
- ```
248
+ ```objective-c
252
249
  #import <UIKit/UIKit.h>
253
250
  #import <UserNotifications/UserNotifications.h>
254
251
  #import <OmiKit/OmiKit-umbrella.h>
@@ -267,7 +264,7 @@ public class MainActivity extends ReactActivity {
267
264
 
268
265
  - Edit AppDelegate.m:
269
266
 
270
- ```
267
+ ```objective-c
271
268
  #import <OmiKit/OmiKit.h>
272
269
 
273
270
  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
@@ -318,7 +315,7 @@ public class MainActivity extends ReactActivity {
318
315
 
319
316
  - Add these lines into `Info.plist`:
320
317
 
321
- ```
318
+ ```swift
322
319
  <key>NSMicrophoneUsageDescription</key>
323
320
  <string>Need microphone access for make Call</string>
324
321
  //If you implement video call
@@ -328,7 +325,7 @@ public class MainActivity extends ReactActivity {
328
325
 
329
326
  - Save token for `OmiClient`: if You added `Cloud Messaging` in your project so you don't need add these lines.
330
327
 
331
- ```
328
+ ```swift
332
329
  - (void)application:(UIApplication*)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)devToken
333
330
  {
334
331
  // parse token bytes to string
@@ -372,7 +369,7 @@ We support 2 environments. So you need set correct key in Appdelegate.
372
369
 
373
370
  - Add variables in Appdelegate.swift:
374
371
 
375
- ```
372
+ ```swift
376
373
  import OmiKit
377
374
  import PushKit
378
375
  import NotificationCenter
@@ -384,7 +381,7 @@ var voipRegistry: PKPushRegistry?
384
381
 
385
382
  - Add these lines into `didFinishLaunchingWithOptions`:
386
383
 
387
- ```
384
+ ```swift
388
385
  OmiClient.setEnviroment(KEY_OMI_APP_ENVIROMENT_SANDBOX, userNameKey: "extension", maxCall: 1, callKitImage: "call_image")
389
386
  provider = CallKitProviderDelegate.init(callManager: OMISIPLib.sharedInstance().callManager)
390
387
  voipRegistry = PKPushRegistry.init(queue: .main)
@@ -393,7 +390,7 @@ pushkitManager = PushKitManager.init(voipRegistry: voipRegistry)
393
390
 
394
391
  - Add these lines into `Info.plist`:
395
392
 
396
- ```
393
+ ```swift
397
394
  <key>NSCameraUsageDescription</key>
398
395
  <string>Need camera access for video call functions</string>
399
396
  <key>NSMicrophoneUsageDescription</key>
@@ -402,7 +399,7 @@ pushkitManager = PushKitManager.init(voipRegistry: voipRegistry)
402
399
 
403
400
  - Save token for `OmiClient`: if you added `firebase_messaging` in your project so you don't need add these lines.
404
401
 
405
- ```
402
+ ```swift
406
403
  func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
407
404
  let deviceTokenString = deviceToken.hexString
408
405
  OmiClient.setUserPushNotificationToken(deviceTokenString)
@@ -465,7 +462,7 @@ We need you request permission about call before make call:
465
462
 
466
463
  - Start Serivce: OmiKit need start services and register some events.
467
464
 
468
- ```
465
+ ```javascript
469
466
  //Call in the root widget
470
467
  import { startServices } from 'omikit-plugin';
471
468
 
@@ -478,7 +475,7 @@ We need you request permission about call before make call:
478
475
  Please contact for my sale:
479
476
  In This step, we need partner provide me fcmToken of firebase Message.
480
477
 
481
- ```
478
+ ```javascript
482
479
  import { initCallWithApiKey } from 'omikit-plugin';
483
480
  import messaging from '@react-native-firebase/messaging';
484
481
 
@@ -496,6 +493,7 @@ We need you request permission about call before make call:
496
493
  phone: phone,
497
494
  fcmToken: token, //with android is fcm_token and ios is APNS token
498
495
  isVideo: isVideo,
496
+ projectId: projectId // firebase project id off your
499
497
  };
500
498
  const result = await initCallWithApiKey(loginInfo);
501
499
  //result is true then user login successfully.
@@ -505,7 +503,7 @@ We need you request permission about call before make call:
505
503
  This function is used when you want to call any telecommunication number, calling back and forth between internal groups.
506
504
  Please contact for my sale:
507
505
 
508
- ```
506
+ ```javascript
509
507
  import { initCallWithUserPassword } from 'omikit-plugin';
510
508
  import messaging from '@react-native-firebase/messaging';
511
509
 
@@ -521,7 +519,8 @@ We need you request permission about call before make call:
521
519
  password: password, //string
522
520
  realm: realm, //string
523
521
  isVideo: isVideo, //boolean: true/false
524
- fcmToken: token, //with android is fcm_token and ios is APNS token
522
+ fcmToken: token, //with android is fcm_token and ios is APNS token,
523
+ projectId: projectId // firebase project id off your
525
524
  };
526
525
  const result = await initCallWithUserPassword(loginInfo);
527
526
  //result is true then user login successfully.
@@ -529,7 +528,7 @@ We need you request permission about call before make call:
529
528
 
530
529
  - Config push notification:
531
530
 
532
- ```
531
+ ```javascript
533
532
  import { configPushNotification } from 'omikit-plugin';
534
533
 
535
534
  configPushNotification({
@@ -567,7 +566,7 @@ We need you request permission about call before make call:
567
566
 
568
567
  - Call with phone number (mobile phone or internal number):
569
568
 
570
- ```
569
+ ```javascript
571
570
  import {startCall} from 'omikit-plugin';
572
571
  const result = await startCall({
573
572
  phoneNumber: phone, //phone number
@@ -577,7 +576,7 @@ We need you request permission about call before make call:
577
576
 
578
577
  - The result will be in the form of object:
579
578
 
580
- ```
579
+ ```javascript
581
580
  result = {
582
581
  "_id": String // This is call_id. it just have id for iOS,
583
582
  "status": Number // This is result code when make,
@@ -587,7 +586,7 @@ We need you request permission about call before make call:
587
586
 
588
587
  - Describe in detail the results when startCall returns:
589
588
 
590
- ```
589
+ ```javascript
591
590
  + message="INVALID_UUID" (status = 0) : uid is invalid (we can not find on my page).
592
591
  + message="INVALID_PHONE_NUMBER" (status = 1) : sip user is invalid.
593
592
  + message="SAME_PHONE_NUMBER_WITH_PHONE_REGISTER" (status = 2) : Can not call same phone number.
@@ -603,7 +602,7 @@ We need you request permission about call before make call:
603
602
 
604
603
  - Call with UUID (only support with Api key):
605
604
 
606
- ```
605
+ ```javascript
607
606
  import {startCallWithUuid} from 'omikit-plugin';
608
607
  const result = await startCallWithUuid({
609
608
  usrUuid: uuid, //phone number
@@ -614,7 +613,7 @@ We need you request permission about call before make call:
614
613
 
615
614
  - Accept a call:
616
615
 
617
- ```
616
+ ```javascript
618
617
  import {joinCall} from 'omikit-plugin';
619
618
 
620
619
  await joinCall();
@@ -622,7 +621,7 @@ We need you request permission about call before make call:
622
621
 
623
622
  - End a call: We will push a event `endCall` for you.
624
623
 
625
- ```
624
+ ```javascript
626
625
  import {endCall} from 'omikit-plugin';
627
626
 
628
627
  const value = await endCall();
@@ -642,7 +641,7 @@ We need you request permission about call before make call:
642
641
 
643
642
  - Toggle the audio: On/off audio a call
644
643
 
645
- ```
644
+ ```javascript
646
645
  import {toggleMute} from 'omikit-plugin';
647
646
 
648
647
  toggleMute();
@@ -650,7 +649,7 @@ We need you request permission about call before make call:
650
649
 
651
650
  - Toggle the speaker: On/off the phone speaker
652
651
 
653
- ```
652
+ ```javascript
654
653
  import {toggleSpeaker} from 'omikit-plugin';
655
654
 
656
655
  toggleSpeaker();
@@ -658,7 +657,7 @@ We need you request permission about call before make call:
658
657
 
659
658
  - Send character: We only support `1 to 9` and `* #`.
660
659
 
661
- ```
660
+ ```javascript
662
661
  import {sendDTMF} from 'omikit-plugin';
663
662
 
664
663
  sendDTMF({
@@ -667,7 +666,7 @@ We need you request permission about call before make call:
667
666
  ```
668
667
 
669
668
  - Get current user information:
670
- ```
669
+ ```javascript
671
670
  final user = await getCurrentUser();
672
671
  Output Sample:
673
672
  {
@@ -678,7 +677,7 @@ We need you request permission about call before make call:
678
677
  }
679
678
  ```
680
679
  - Get guest user information:
681
- ```
680
+ ```javascript
682
681
  final user = await getGuestUser();
683
682
  Output Sample:
684
683
  {
@@ -690,7 +689,7 @@ We need you request permission about call before make call:
690
689
  ```
691
690
  - Get user information from sip:
692
691
 
693
- ```
692
+ ```javascript
694
693
  final user = await getUserInfo("111");
695
694
  Output Sample:
696
695
  {
@@ -703,7 +702,7 @@ We need you request permission about call before make call:
703
702
 
704
703
  - Logout: logout and remove all information.
705
704
 
706
- ```
705
+ ```javascript
707
706
  import {logout} from 'omikit-plugin';
708
707
 
709
708
  logout();
@@ -711,7 +710,7 @@ We need you request permission about call before make call:
711
710
 
712
711
  - Permission: Check system alert window permission (only Android).
713
712
 
714
- ```
713
+ ```javascript
715
714
  import {systemAlertWindow} from 'omikit-plugin';
716
715
 
717
716
  if (Platform.OS === 'android') {
@@ -723,7 +722,7 @@ We need you request permission about call before make call:
723
722
 
724
723
  - Setting: Open to enable system alert window (only Android).
725
724
 
726
- ```
725
+ ```javascript
727
726
  import {openSystemAlertSetting} from 'omikit-plugin';
728
727
 
729
728
  if (Platform.OS === 'android') {
@@ -735,56 +734,56 @@ We need you request permission about call before make call:
735
734
 
736
735
  - Switch front/back camera: We use the front camera for first time.
737
736
 
738
- ```
737
+ ```javascript
739
738
  import {switchOmiCamera} from 'omikit-plugin';
740
739
  switchOmiCamera();
741
740
  ```
742
741
 
743
742
  - Toggle a video in video call: On/off video in video call
744
743
 
745
- ```
744
+ ```javascript
746
745
  import {toggleOmiVideo} from 'omikit-plugin';
747
746
  toggleOmiVideo();
748
747
  ```
749
748
 
750
749
  - Local Camera Widget: Your camera view in a call
751
750
 
752
- ```
751
+ ```javascript
753
752
  import { OmiLocalCameraView } from 'omikit-plugin';
754
753
  <OmiLocalCameraView style={styles.localCamera} />
755
754
  ```
756
755
 
757
756
  - Remote Camera Widget: Remote camera view in a call
758
757
 
759
- ```
758
+ ```javascript
760
759
  import { OmiRemoteCameraView } from 'omikit-plugin';
761
760
  <OmiRemoteCameraView style={styles.remoteCamera} />
762
761
  ```
763
762
 
764
763
  - More function: Refresh local camera
765
764
 
766
- ```
765
+ ```javascript
767
766
  import {refreshLocalCamera} from 'omikit-plugin';
768
767
  refreshLocalCamera();
769
768
  ```
770
769
 
771
770
  - More function: Refresh remote camera
772
771
 
773
- ```
772
+ ```javascript
774
773
  import {refreshRemoteCamera} from 'omikit-plugin';
775
774
  refreshRemoteCamera();
776
775
  ```
777
776
 
778
777
  - Register event: Register remote video ready: only visible on iOS
779
778
 
780
- ```
779
+ ```javascript
781
780
  import {registerVideoEvent} from 'omikit-plugin';
782
781
  registerVideoEvent();
783
782
  ```
784
783
 
785
784
  - Event listener:
786
785
 
787
- ```
786
+ ```javascript
788
787
  useEffect(() => {
789
788
  omiEmitter.addListener(OmiCallEvent.onCallStateChanged, onCallStateChanged);
790
789
  omiEmitter.addListener(OmiCallEvent.onMuted, onMuted);
@@ -839,15 +838,32 @@ useEffect(() => {
839
838
 
840
839
  | Code | Description |
841
840
  | --------------- | --------------------------------------------------------------------------------------------------------------------- |
842
- | `600, 503, 480` | These are the codes of the network operator or the user who did not answer the call |
843
- | `408` | Call request timeout (Each call usually has a waiting time of 30 seconds. If the 30 seconds expire, it will time out) |
844
- | `403` | Your service plan only allows calls to dialed numbers. Please upgrade your service pack |
845
- | `404` | The current number is not allowed to make calls to the carrier |
846
- | `603` | The call was rejected. Please check your account limit or call barring configuration! |
847
- | `850` | Simultaneous call limit exceeded, please try again later |
848
- | `486` | The listener refuses the call and does not answer |
849
- | `601` | Call ended by the customer |
850
- | `602` | Call ended by the other employee |
841
+ | `600, 503, 480` | These are the codes of the network operator or the user who did not answer the call |
842
+ | `408` | Call request timeout (Each call usually has a waiting time of 30 seconds. If the 30 seconds expire, it will time out) |
843
+ | `403` | Your service plan only allows calls to dialed numbers. Please upgrade your service pack|
844
+ | `404` | The current number is not allowed to make calls to the carrier|
845
+ | `603` | The call was rejected. Please check your account limit or call barring configuration! |
846
+ | `850` | Simultaneous call limit exceeded, please try again later |
847
+ | `486` | The listener refuses the call and does not answer |
848
+ | `601` | Call ended by the customer |
849
+ | `602` | Call ended by the other employee |
850
+ | `603` | The call was rejected. Please check your account limit or call barring configuration |
851
+ | `850` | Simultaneous call limit exceeded, please try again later |
852
+ | `851` | Call duration limit exceeded, please try again later |
853
+ | `852` | Service package not assigned, please contact the provider |
854
+ | `853` | Internal number has been disabled |
855
+ | `854` | Subscriber is in the DNC list |
856
+ | `855` | Exceeded the allowed number of calls for the trial package |
857
+ | `856` | Exceeded the allowed minutes for the trial package |
858
+ | `857` | Subscriber has been blocked in the configuration |
859
+ | `858` | Unidentified or unconfigured number |
860
+ | `859` | No available numbers for Viettel direction, please contact the provider |
861
+ | `860` | No available numbers for VinaPhone direction, please contact the provider |
862
+ | `861` | No available numbers for Mobifone direction, please contact the provider |
863
+ | `862` | Temporary block on Viettel direction, please try again |
864
+ | `863` | Temporary block on VinaPhone direction, please try again |
865
+ | `864` | Temporary block on Mobifone direction, please try again |
866
+ | `865` | he advertising number is currently outside the permitted calling hours, please try again later |
851
867
 
852
868
  - Action Name value:
853
869
  - `OmiCallEvent.onMuted`: Audio changed.
@@ -182,8 +182,20 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
182
182
  }
183
183
 
184
184
  override fun onRegisterCompleted(statusCode: Int) {
185
- Log.d("OMISDK", "=>> ON REGISTER COMPLETED => status code $statusCode")
186
- }
185
+ Log.d("OMISDK", "=> ON REGISTER COMPLETED => status code: $statusCode")
186
+
187
+ if (statusCode != 200) {
188
+ val mapObject = WritableNativeMap().apply {
189
+ putBoolean("isVideo", false)
190
+ putBoolean("incoming", true)
191
+ putString("callerNumber", "")
192
+ putString("_id", "")
193
+ putInt("status", 6)
194
+ putInt("code_end_call", if (statusCode == 403) 853 else statusCode)
195
+ }
196
+ sendEvent(CALL_STATE_CHANGED, mapObject)
197
+ }
198
+ }
187
199
 
188
200
 
189
201
  override fun onVideoSize(width: Int, height: Int) {
@@ -424,7 +436,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
424
436
  OmiClient.getInstance(reactApplicationContext!!).startCall(phoneNumber, isVideo)
425
437
  Log.d("OMISDK", "=>> startCallResult START CALL => $startCallResult")
426
438
  var statusCalltemp = startCallResult.value as Int;
427
- if (startCallResult.value == 200) {
439
+ if (startCallResult.value == 200 || startCallResult.value == 407) {
428
440
  statusCalltemp = 8
429
441
  }
430
442
  map.putInt("status", statusCalltemp)
@@ -741,11 +753,15 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
741
753
  }
742
754
 
743
755
  fun sendEvent(eventName: String?, params: Any?) {
756
+ if (eventName == null) {
757
+ Log.e("OmikitPlugin", "eventName is null. Event cannot be emitted.")
758
+ return
759
+ }
744
760
  if (currentActivity != null) {
745
- currentActivity!!.runOnUiThread {
746
- reactApplicationContext.getJSModule(RCTNativeAppEventEmitter::class.java)
747
- .emit(eventName, params)
748
- }
761
+ currentActivity!!.runOnUiThread {
762
+ reactApplicationContext.getJSModule(RCTNativeAppEventEmitter::class.java)
763
+ .emit(eventName, params)
764
+ }
749
765
  }
750
766
  }
751
767
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omikit-plugin",
3
- "version": "3.2.39",
3
+ "version": "3.2.41",
4
4
  "description": "Omikit Plugin by ViHAT",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",