omikit-plugin 3.2.64 → 3.2.66
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 +116 -22
- package/android/build.gradle +1 -1
- package/android/gradle.properties +1 -1
- package/ios/CallProcess/CallManager.swift +3 -3
- package/omikit-plugin.podspec +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -694,18 +694,27 @@ We need you request permission about call before make call:
|
|
|
694
694
|
// Result is the same with startCall
|
|
695
695
|
```
|
|
696
696
|
|
|
697
|
-
-
|
|
697
|
+
- __Accept a call__:
|
|
698
698
|
|
|
699
699
|
```javascript
|
|
700
700
|
import {joinCall} from 'omikit-plugin';
|
|
701
701
|
|
|
702
702
|
await joinCall();
|
|
703
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.
|
|
704
705
|
|
|
705
|
-
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.
|
|
706
706
|
|
|
707
|
-
|
|
707
|
+
- __Call forwarding__: used to transfer the current call to any employee's sip number
|
|
708
|
+
```javascript
|
|
709
|
+
import {transferCall} from 'omikit-plugin';
|
|
708
710
|
|
|
711
|
+
transferCall({
|
|
712
|
+
phoneNumber: 102 // employee's internal number
|
|
713
|
+
})
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
- __End a call__ : We will push a event `endCall` for you.
|
|
709
718
|
```javascript
|
|
710
719
|
import {endCall} from 'omikit-plugin';
|
|
711
720
|
|
|
@@ -750,6 +759,7 @@ We need you request permission about call before make call:
|
|
|
750
759
|
- Send character: We only support `1 to 9` and `* #`.
|
|
751
760
|
|
|
752
761
|
```javascript
|
|
762
|
+
// FUNC IS USED when the user wants key interaction during a call. For example, press key 1, 2, 3.. to move to group
|
|
753
763
|
import {sendDTMF} from 'omikit-plugin';
|
|
754
764
|
|
|
755
765
|
sendDTMF({
|
|
@@ -791,14 +801,14 @@ We need you request permission about call before make call:
|
|
|
791
801
|
"uuid": "122aaa"
|
|
792
802
|
}
|
|
793
803
|
```
|
|
794
|
-
-
|
|
804
|
+
- __endCall__: End a completed call (including rejecting a call).
|
|
795
805
|
|
|
796
806
|
```javascript
|
|
797
807
|
import {endCall} from 'omikit-plugin';
|
|
798
808
|
|
|
799
809
|
endCall();
|
|
800
810
|
```
|
|
801
|
-
-
|
|
811
|
+
- __rejectCall__: Used to reject an incoming call when the user has not accepted it yet.
|
|
802
812
|
Note: Do not use this function to end an ongoing call.
|
|
803
813
|
|
|
804
814
|
```javascript
|
|
@@ -806,7 +816,7 @@ We need you request permission about call before make call:
|
|
|
806
816
|
|
|
807
817
|
rejectCall();
|
|
808
818
|
```
|
|
809
|
-
-
|
|
819
|
+
- __Logout__: logout and remove all information.
|
|
810
820
|
|
|
811
821
|
```javascript
|
|
812
822
|
import {logout} from 'omikit-plugin';
|
|
@@ -814,7 +824,7 @@ We need you request permission about call before make call:
|
|
|
814
824
|
logout();
|
|
815
825
|
```
|
|
816
826
|
|
|
817
|
-
-
|
|
827
|
+
- __Permission__: Check system alert window permission (only Android).
|
|
818
828
|
|
|
819
829
|
```javascript
|
|
820
830
|
import {systemAlertWindow} from 'omikit-plugin';
|
|
@@ -826,7 +836,7 @@ We need you request permission about call before make call:
|
|
|
826
836
|
}
|
|
827
837
|
```
|
|
828
838
|
|
|
829
|
-
-
|
|
839
|
+
- __Setting__: Open to enable system alert window (only Android).
|
|
830
840
|
|
|
831
841
|
```javascript
|
|
832
842
|
import {openSystemAlertSetting} from 'omikit-plugin';
|
|
@@ -835,6 +845,33 @@ We need you request permission about call before make call:
|
|
|
835
845
|
openSystemAlertSetting();
|
|
836
846
|
}
|
|
837
847
|
```
|
|
848
|
+
- __Audio__:
|
|
849
|
+
- func *getCurrentAudio*: Get current information of audio devices
|
|
850
|
+
```javascript
|
|
851
|
+
import {getCurrentAudio} from 'omikit-plugin';
|
|
852
|
+
|
|
853
|
+
getCurrentAudio().then((data: any) => {
|
|
854
|
+
console.log(data); // [{"name": "Speaker", "type": "Speaker"}]
|
|
855
|
+
// Note: Data is an array containing information about audio devices, with parameters:
|
|
856
|
+
// - name: Name of the audio device
|
|
857
|
+
// - type: Audio device type (e.g. "Speaker", "Receiver", etc.)
|
|
858
|
+
});
|
|
859
|
+
```
|
|
860
|
+
- func setAudio: set Audio calls the current device
|
|
861
|
+
```javascript
|
|
862
|
+
import { getAudio, setAudio} from 'omikit-plugin';
|
|
863
|
+
|
|
864
|
+
const audioList = await getAudio(); // Get a list of supported audio device types
|
|
865
|
+
console.log("audioList --> ", audioList) // audioList --> [{"name": "Receiver", "type": "Receiver"}, {"name": "Speaker", "type": "Speaker"}]
|
|
866
|
+
|
|
867
|
+
const receiver = audioList.find((element: any) => {
|
|
868
|
+
return element.type === 'Receiver'; // type: "Speaker" is the external speaker, Receiver is the internal speaker
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
setAudio({
|
|
872
|
+
portType: receiver.type,
|
|
873
|
+
});
|
|
874
|
+
```
|
|
838
875
|
|
|
839
876
|
- Video Call functions: Support only video call, You need enable video in `init functions` and `start call` to implements under functions.
|
|
840
877
|
|
|
@@ -887,7 +924,7 @@ We need you request permission about call before make call:
|
|
|
887
924
|
registerVideoEvent();
|
|
888
925
|
```
|
|
889
926
|
|
|
890
|
-
- Event listener
|
|
927
|
+
- *Event listener*:
|
|
891
928
|
|
|
892
929
|
```javascript
|
|
893
930
|
useEffect(() => {
|
|
@@ -898,7 +935,11 @@ useEffect(() => {
|
|
|
898
935
|
omiEmitter.addListener(OmiCallEvent.onClickMissedCall, clickMissedCall);
|
|
899
936
|
omiEmitter.addListener(OmiCallEvent.onSwitchboardAnswer, onSwitchboardAnswer);
|
|
900
937
|
omiEmitter.addListener(OmiCallEvent.onCallQuality, onCallQuality);
|
|
901
|
-
|
|
938
|
+
|
|
939
|
+
if(Platform.OS == "android") {
|
|
940
|
+
omiEmitter.addListener(OmiCallEvent.onRequestPermissionAndroid, onRequestPermission);
|
|
941
|
+
}
|
|
942
|
+
|
|
902
943
|
if (Platform.OS === 'ios') {
|
|
903
944
|
registerVideoEvent();
|
|
904
945
|
omiEmitter.addListener(
|
|
@@ -906,13 +947,18 @@ useEffect(() => {
|
|
|
906
947
|
refreshRemoteCameraEvent
|
|
907
948
|
);
|
|
908
949
|
}
|
|
950
|
+
|
|
909
951
|
return () => {
|
|
910
952
|
omiEmitter.removeAllListeners(OmiCallEvent.onCallStateChanged);
|
|
911
953
|
omiEmitter.removeAllListeners(OmiCallEvent.onMuted);
|
|
912
954
|
omiEmitter.removeAllListeners(OmiCallEvent.onHold);
|
|
913
955
|
omiEmitter.removeAllListeners(OmiCallEvent.onSpeaker);
|
|
914
956
|
omiEmitter.removeAllListeners(OmiCallEvent.onSwitchboardAnswer);
|
|
915
|
-
|
|
957
|
+
|
|
958
|
+
if(Platform.OS == "android") {
|
|
959
|
+
omiEmitter.removeAllListeners(OmiCallEvent.onRequestPermissionAndroid);
|
|
960
|
+
}
|
|
961
|
+
|
|
916
962
|
if (Platform.OS === 'ios') {
|
|
917
963
|
removeVideoEvent();
|
|
918
964
|
omiEmitter.removeAllListeners(OmiCallEvent.onRemoteVideoReady);
|
|
@@ -938,21 +984,75 @@ useEffect(() => {
|
|
|
938
984
|
- hold(7);
|
|
939
985
|
|
|
940
986
|
* onCallStateChanged is call state tracking event. We will return status of state. Please refer `OmiCallState`.
|
|
941
|
-
|
|
987
|
+
|
|
988
|
+
```javascript
|
|
989
|
+
// The event is updated every time the call status changes
|
|
990
|
+
const onCallStateChanged = (data: any) => {
|
|
991
|
+
/*
|
|
992
|
+
Call state change event data (Object) includes:
|
|
993
|
+
|
|
994
|
+
- _id: string (UUID of the call)
|
|
995
|
+
- callInfo: object (Detailed call information)
|
|
996
|
+
- callerNumber: string (Phone number of the caller)
|
|
997
|
+
- code_end_call: number (Status code when the call ends)
|
|
998
|
+
- destination_number?: string (Destination phone number, optional)
|
|
999
|
+
- direction: string ("inbound" or "outbound", call direction)
|
|
1000
|
+
- disposition: string (Call answer status)
|
|
1001
|
+
- incoming: boolean (true if it is an incoming call)
|
|
1002
|
+
- isVideo: boolean (true if it is a video call)
|
|
1003
|
+
- sip_user: string (Current SIP user)
|
|
1004
|
+
- source_number: string (SIP number of the user)
|
|
1005
|
+
- status: string (value matching with List status call)
|
|
1006
|
+
- time_end: number (Timestamp when the call ended)
|
|
1007
|
+
- time_start_to_answer: number (Time taken to answer the call)
|
|
1008
|
+
- transaction_id: string (OMI Call unique ID)
|
|
1009
|
+
*/
|
|
1010
|
+
};
|
|
1011
|
+
|
|
1012
|
+
// Event returned when the user mutes the call
|
|
1013
|
+
const onMuted = (isMuted: boolean) => {
|
|
1014
|
+
// isMuted: true when muted call
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
// Event returns value when user holds call
|
|
1018
|
+
const onHold = (isHold: boolean) => {
|
|
1019
|
+
// isHold: true when hold call
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
// The event updates the quality of an ongoing call
|
|
1023
|
+
const onCallQuality = (data: any) => {
|
|
1024
|
+
const { quality } = data;
|
|
1025
|
+
// quality: int is mean quality off calling
|
|
1026
|
+
// 1 is good, 2 is medium, 3 is low
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
// Even when user turn on speakerphone
|
|
1030
|
+
const onSpeaker = (isSpeaker: boolean) => {
|
|
1031
|
+
// isSpeaker: true, false
|
|
1032
|
+
// True mean speaker devices is open
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
// * onSwitchboardAnswer have callback when employee answered script call.
|
|
1036
|
+
const onSwitchboardAnswer = (data: any) => {
|
|
1037
|
+
const { sip } = data
|
|
1038
|
+
// sip: String
|
|
1039
|
+
}
|
|
1040
|
+
```
|
|
942
1041
|
|
|
943
|
-
|
|
944
|
-
|
|
1042
|
+
### 📞 Call State Lifecycle
|
|
1043
|
+
* **`Incoming call` state lifecycle**: incoming -> connecting -> confirmed -> disconnected
|
|
1044
|
+
* **`Outgoing call` state lifecycle**: calling -> early -> connecting -> confirmed -> disconnected
|
|
945
1045
|
|
|
946
|
-
* onSwitchboardAnswer have callback when employee answered script call.
|
|
947
1046
|
|
|
948
1047
|
- Table describing code_end_call status
|
|
949
1048
|
|
|
950
1049
|
| Code | Description |
|
|
951
1050
|
| --------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
952
|
-
| `600, 503
|
|
1051
|
+
| `600, 503` | These are the codes of the network operator or the user who did not answer the call |
|
|
953
1052
|
| `408` | Call request timeout (Each call usually has a waiting time of 30 seconds. If the 30 seconds expire, it will time out) |
|
|
954
1053
|
| `403` | Your service plan only allows calls to dialed numbers. Please upgrade your service pack|
|
|
955
1054
|
| `404` | The current number is not allowed to make calls to the carrier|
|
|
1055
|
+
| `480` | The number has an error, please contact support to check the details |
|
|
956
1056
|
| `603` | The call was rejected. Please check your account limit or call barring configuration! |
|
|
957
1057
|
| `850` | Simultaneous call limit exceeded, please try again later |
|
|
958
1058
|
| `486` | The listener refuses the call and does not answer |
|
|
@@ -986,12 +1086,6 @@ useEffect(() => {
|
|
|
986
1086
|
- `OmiCallEvent.onHold`: hold current call
|
|
987
1087
|
- Data value: We return `callerNumber`, `sip`, `isVideo: true/false` information
|
|
988
1088
|
|
|
989
|
-
- Forward calls to internal staff:
|
|
990
|
-
- You can use function `transferCall` for transfer to staff you want.
|
|
991
|
-
example:
|
|
992
|
-
transferCall({
|
|
993
|
-
phoneNumber: 102
|
|
994
|
-
})
|
|
995
1089
|
|
|
996
1090
|
# Issues
|
|
997
1091
|
|
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.17'
|
|
124
124
|
|
|
125
125
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
126
126
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
@@ -314,7 +314,7 @@ class CallManager {
|
|
|
314
314
|
"transactionId": "",
|
|
315
315
|
"_id": ""
|
|
316
316
|
]
|
|
317
|
-
|
|
317
|
+
|
|
318
318
|
if(call != nil){
|
|
319
319
|
if(call.isIncoming && callState == OMICallState.early.rawValue){
|
|
320
320
|
dataToSend["status"] = OMICallState.incoming.rawValue
|
|
@@ -335,7 +335,7 @@ class CallManager {
|
|
|
335
335
|
if (videoManager == nil && call.isVideo) {
|
|
336
336
|
videoManager = OMIVideoViewManager.init()
|
|
337
337
|
}
|
|
338
|
-
isSpeaker = call.
|
|
338
|
+
isSpeaker = call.speaker
|
|
339
339
|
lastStatusCall = "answered"
|
|
340
340
|
OmikitPlugin.instance.sendMuteStatus()
|
|
341
341
|
break
|
|
@@ -517,7 +517,7 @@ class CallManager {
|
|
|
517
517
|
func getCurrentAudio() -> [[String: String]] {
|
|
518
518
|
return OmiClient.getCurrentAudio()
|
|
519
519
|
}
|
|
520
|
-
|
|
520
|
+
|
|
521
521
|
//video call
|
|
522
522
|
func toggleCamera() {
|
|
523
523
|
if let videoManager = videoManager {
|
package/omikit-plugin.podspec
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omikit-plugin",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.66",
|
|
4
4
|
"description": "Omikit Plugin by ViHAT",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"type": "git",
|
|
45
45
|
"url": "git+https://github.com/VIHATTeam/OMICALL-React-Native-SDK"
|
|
46
46
|
},
|
|
47
|
-
"author": "ViHAT Group <
|
|
47
|
+
"author": "ViHAT Group <tranhoaihung05@gmail.com>",
|
|
48
48
|
"license": "MIT",
|
|
49
49
|
"bugs": {
|
|
50
50
|
"url": "https://github.com/VIHATTeam/OMICALL-React-Native-SDK/issues"
|