omikit-plugin 3.2.39 → 3.2.40

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