omikit-plugin 3.2.21 → 3.2.24
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
|
@@ -101,27 +101,92 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
101
101
|
- Update AndroidManifest.xml:
|
|
102
102
|
|
|
103
103
|
```
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
//
|
|
108
|
-
<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
104
|
+
<manifest
|
|
105
|
+
......
|
|
106
|
+
xmlns:tools="http://schemas.android.com/tools">
|
|
107
|
+
..... // your config
|
|
108
|
+
<uses-feature android:name="android.hardware.telephony" android:required="false" />
|
|
109
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
110
|
+
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
|
111
|
+
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
112
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE"/>
|
|
113
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA"/>
|
|
114
|
+
<uses-permission android:name="android.permission.CALL_PHONE"/>
|
|
115
|
+
..... // your config
|
|
116
|
+
|
|
117
|
+
<application
|
|
118
|
+
android:name=".MainApplication"
|
|
119
|
+
...... // your config
|
|
120
|
+
android:alwaysRetainTaskState="true"
|
|
121
|
+
android:largeHeap="true"
|
|
122
|
+
android:exported="true"
|
|
123
|
+
android:supportsRtl="true"
|
|
124
|
+
android:allowBackup="false"
|
|
125
|
+
android:enableOnBackInvokedCallback="true"
|
|
126
|
+
..... // your config
|
|
127
|
+
>
|
|
128
|
+
<activity
|
|
129
|
+
android:name=".MainActivity"
|
|
130
|
+
..... // your config
|
|
131
|
+
android:windowSoftInputMode="adjustResize"
|
|
132
|
+
android:showOnLockScreen="true"
|
|
133
|
+
android:launchMode="singleTask"
|
|
134
|
+
android:largeHeap="true"
|
|
135
|
+
android:alwaysRetainTaskState="true"
|
|
136
|
+
android:supportsPictureInPicture="false"
|
|
137
|
+
android:showWhenLocked="true"
|
|
138
|
+
android:turnScreenOn="true"
|
|
139
|
+
android:exported="true"
|
|
140
|
+
..... // your config
|
|
141
|
+
>
|
|
142
|
+
..... // your config
|
|
143
|
+
<intent-filter>
|
|
144
|
+
<action android:name="android.intent.action.MAIN" />
|
|
145
|
+
<category android:name="android.intent.category.LAUNCHER" />
|
|
146
|
+
</intent-filter>
|
|
147
|
+
<intent-filter>
|
|
148
|
+
<action
|
|
149
|
+
android:name="com.omicall.sdk.CallingActivity"
|
|
150
|
+
android:launchMode="singleTask"
|
|
151
|
+
android:largeHeap="true"
|
|
152
|
+
android:alwaysRetainTaskState="true"
|
|
153
|
+
/>
|
|
154
|
+
<category android:name="android.intent.category.DEFAULT" />
|
|
155
|
+
</intent-filter>
|
|
156
|
+
..... // your config
|
|
157
|
+
</activity>
|
|
158
|
+
..... // your config
|
|
159
|
+
<receiver
|
|
160
|
+
android:name="vn.vihat.omicall.omisdk.receiver.FirebaseMessageReceiver"
|
|
161
|
+
android:exported="true"
|
|
162
|
+
android:enabled="true"
|
|
163
|
+
tools:replace="android:exported"
|
|
164
|
+
android:permission="com.google.android.c2dm.permission.SEND">
|
|
165
|
+
<intent-filter>
|
|
166
|
+
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
|
167
|
+
</intent-filter>
|
|
168
|
+
</receiver>
|
|
169
|
+
<service
|
|
170
|
+
android:name="vn.vihat.omicall.omisdk.service.NotificationService"
|
|
171
|
+
android:enabled="true"
|
|
172
|
+
android:exported="false">
|
|
173
|
+
</service>
|
|
174
|
+
..... // your config
|
|
175
|
+
</application>
|
|
176
|
+
</manifest>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
##### In file MainActivity:
|
|
180
|
+
```
|
|
181
|
+
public class MainActivity extends ReactActivity {
|
|
182
|
+
..... // your config
|
|
183
|
+
@Override
|
|
184
|
+
protected void onResume() {
|
|
185
|
+
super.onResume();
|
|
186
|
+
OmikitPluginModule.Companion.onResume(this);
|
|
187
|
+
..... // your config
|
|
188
|
+
}
|
|
189
|
+
}
|
|
125
190
|
```
|
|
126
191
|
|
|
127
192
|
You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blob/main/example/android/app/src/main/AndroidManifest.xml">AndroidManifest</a> to know more informations.
|
|
@@ -322,6 +387,23 @@ We support 2 environments. So you need set correct key in Appdelegate.
|
|
|
322
387
|
|
|
323
388
|
## Implement
|
|
324
389
|
|
|
390
|
+
### Request permission
|
|
391
|
+
|
|
392
|
+
We need you request permission about call before make call:
|
|
393
|
+
- You can use <a href="https://github.com/zoontek/react-native-permissions">react-native-permissions</a> to do this
|
|
394
|
+
|
|
395
|
+
```
|
|
396
|
+
-Android:
|
|
397
|
+
+ PERMISSIONS.ANDROID.RECORD_AUDIO
|
|
398
|
+
+ PERMISSIONS.ANDROID.CALL_PHONE
|
|
399
|
+
+ PERMISSIONS.ANDROID.CAMERA; (if you want to make Video calls)
|
|
400
|
+
|
|
401
|
+
-IOS:
|
|
402
|
+
+ PERMISSIONS.IOS.MICROPHONE;
|
|
403
|
+
+ PERMISSIONS.IOS.CAMERA; (if you want to make Video calls)
|
|
404
|
+
|
|
405
|
+
```
|
|
406
|
+
|
|
325
407
|
- Set up <a href="https://rnfirebase.io/messaging/usage">Cloud Messaging</a> plugin:
|
|
326
408
|
|
|
327
409
|
```
|
|
@@ -438,17 +520,30 @@ We support 2 environments. So you need set correct key in Appdelegate.
|
|
|
438
520
|
phoneNumber: phone, //phone number
|
|
439
521
|
isVideo: false //allow video call: true/false
|
|
440
522
|
});
|
|
441
|
-
|
|
442
|
-
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
523
|
+
```
|
|
524
|
+
- The result will be in the form of object:
|
|
525
|
+
```
|
|
526
|
+
result = {
|
|
527
|
+
"_id": String // This is call_id. it just have id for iOS,
|
|
528
|
+
"status": Number // This is result code when make,
|
|
529
|
+
"message": String // This is a string key, describing the status of the call
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
- Describe in detail the results when startCall returns:
|
|
534
|
+
|
|
535
|
+
```
|
|
536
|
+
+ message="INVALID_UUID" (status = 0) : uid is invalid (we can not find on my page).
|
|
537
|
+
+ message="INVALID_PHONE_NUMBER" (status = 1) : sip user is invalid.
|
|
538
|
+
+ message="SAME_PHONE_NUMBER_WITH_PHONE_REGISTER" (status = 2) : Can not call same phone number.
|
|
539
|
+
+ message="MAX_RETRY" (status = 3) : call timeout exceeded, please try again later.
|
|
540
|
+
+ message="PERMISSION_DENIED" (status = 4) : The user has not granted MIC or audio permissions.
|
|
541
|
+
+ message="COULD_NOT_FIND_END_POINT" (status = 5) : Please login before make your call.
|
|
542
|
+
+ message="REGISTER_ACCOUNT_FAIL" (status = 6) : Can't log in to OMI( maybe wrong login information).
|
|
543
|
+
+ message="START_CALL_FAIL" (status = 7) : Call failed, please try again
|
|
544
|
+
+ message="HAVE_ANOTHER_CALL" (status = 9) : There is another call in progress, please wait for that call to end
|
|
545
|
+
+ message="START_CALL_SUCCESS" (status = 8) : START CALL SUCCESSFULLY.
|
|
546
|
+
|
|
452
547
|
```
|
|
453
548
|
|
|
454
549
|
- Call with UUID (only support with Api key):
|
|
@@ -661,8 +756,8 @@ useEffect(() => {
|
|
|
661
756
|
```
|
|
662
757
|
|
|
663
758
|
- Important event `onCallStateChanged`: We provide it to listen call state change.
|
|
664
|
-
//OmiAction have 2 variables: actionName and data
|
|
665
|
-
|
|
759
|
+
// OmiAction have 2 variables: actionName and data
|
|
760
|
+
|
|
666
761
|
- Action Name value:
|
|
667
762
|
- `onCallStateChanged`: Call state changed.
|
|
668
763
|
- `onSwitchboardAnswer`: Switchboard sip is listening.
|
|
@@ -689,12 +784,13 @@ useEffect(() => {
|
|
|
689
784
|
+ onSwitchboardAnswer have callback when employee answered script call.
|
|
690
785
|
|
|
691
786
|
- List of notable call codes `code_end_call`:
|
|
692
|
-
+ 600, 503, 480 : These are the codes of the network operator or the user who did not answer the call
|
|
693
|
-
+ 408: call request timeout (Each call usually has a waiting time of 30 seconds. If the 30 seconds expire, it will time out)
|
|
694
|
-
+ 403: Your service plan only allows calls to dialed numbers. Please upgrade your service pack
|
|
695
|
-
+ 404: The current number is not allowed to make calls to the carrier
|
|
696
|
-
+ 603: The call was rejected. Please check your account limit or call barring configuration!
|
|
697
|
-
+ 850: Simultaneous call limit exceeded, please try again later
|
|
787
|
+
+ `600, 503, 480` : These are the codes of the network operator or the user who did not answer the call
|
|
788
|
+
+ `408` : call request timeout (Each call usually has a waiting time of 30 seconds. If the 30 seconds expire, it will time out)
|
|
789
|
+
+ `403` : Your service plan only allows calls to dialed numbers. Please upgrade your service pack
|
|
790
|
+
+ `404` : The current number is not allowed to make calls to the carrier
|
|
791
|
+
+ `603` : The call was rejected. Please check your account limit or call barring configuration!
|
|
792
|
+
+ `850` : Simultaneous call limit exceeded, please try again later
|
|
793
|
+
+ `486` : The listener refuses the call and does not answer
|
|
698
794
|
|
|
699
795
|
|
|
700
796
|
- Action Name value:
|
package/android/build.gradle
CHANGED
|
@@ -104,7 +104,7 @@ dependencies {
|
|
|
104
104
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
105
105
|
// noinspection GradleDynamicVersion
|
|
106
106
|
// implementation "com.facebook.react:react-native"
|
|
107
|
-
api 'vn.vihat.omicall:omi-sdk:2.
|
|
107
|
+
api 'vn.vihat.omicall:omi-sdk:2.1.46'
|
|
108
108
|
|
|
109
109
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
110
110
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
@@ -79,6 +79,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
override fun onCallEnd(callInfo: MutableMap<String, Any?>, statusCode: Int) {
|
|
82
|
+
Log.d("OMISDK RN", "=>> onCallEnd 0000 => $callInfo")
|
|
82
83
|
val call = callInfo as Map<*, *>
|
|
83
84
|
val map: WritableMap = WritableNativeMap()
|
|
84
85
|
val timeStartToAnswer = call["time_start_to_answer"] as Long?
|
|
@@ -93,6 +94,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
93
94
|
map.putString("disposition", call["disposition"] as String)
|
|
94
95
|
map.putInt("status", CallState.disconnected.value)
|
|
95
96
|
map.putInt("code_end_call", statusCode as Int)
|
|
97
|
+
Log.d("OMISDK RN", "=>> onCallEnd => $map")
|
|
96
98
|
sendEvent(CALL_STATE_CHANGED, map)
|
|
97
99
|
}
|
|
98
100
|
|
|
@@ -220,7 +222,6 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
220
222
|
Handler(Looper.getMainLooper()).post {
|
|
221
223
|
OmiClient.getInstance(reactApplicationContext!!).addCallStateListener(this)
|
|
222
224
|
OmiClient.getInstance(reactApplicationContext!!).setDebug(false)
|
|
223
|
-
OmiClient.isAppReady = true;
|
|
224
225
|
}
|
|
225
226
|
}
|
|
226
227
|
|
|
@@ -364,12 +365,15 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
364
365
|
}
|
|
365
366
|
}
|
|
366
367
|
} else {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
368
|
+
var phoneNumberTemp: String = call["callerNumber"] as String
|
|
369
|
+
if(phoneNumberTemp.isNotEmpty()){
|
|
370
|
+
val map: WritableMap = WritableNativeMap()
|
|
371
|
+
map.putString("callerNumber", call["callerNumber"] as String)
|
|
372
|
+
map.putInt("status", call["status"] as Int)
|
|
373
|
+
map.putBoolean("muted", call["muted"] as Boolean)
|
|
374
|
+
map.putBoolean("isVideo", call["isVideo"] as Boolean)
|
|
375
|
+
promise.resolve(map)
|
|
376
|
+
}
|
|
373
377
|
}
|
|
374
378
|
}
|
|
375
379
|
}
|
|
@@ -388,7 +392,8 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
388
392
|
currentActivity?.runOnUiThread {
|
|
389
393
|
val phoneNumber = data.getString("phoneNumber") as String
|
|
390
394
|
val isVideo = data.getBoolean("isVideo") ?: false ;
|
|
391
|
-
val startCallResult =
|
|
395
|
+
val startCallResult = OmiClient.getInstance(reactApplicationContext!!).startCall(phoneNumber, isVideo)
|
|
396
|
+
Log.d("OMISDK", "=>> startCallResult START CALL => $startCallResult")
|
|
392
397
|
var statusCalltemp = startCallResult.value as Int;
|
|
393
398
|
if(startCallResult.value == 200 ){
|
|
394
399
|
statusCalltemp = 8
|
|
@@ -647,10 +652,20 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
647
652
|
|
|
648
653
|
companion object {
|
|
649
654
|
const val NAME = "OmikitPlugin"
|
|
655
|
+
|
|
650
656
|
fun onDestroy() {
|
|
651
657
|
|
|
652
658
|
}
|
|
653
659
|
|
|
660
|
+
fun onResume(act: ReactActivity) {
|
|
661
|
+
act?.let { context ->
|
|
662
|
+
if (!OmiClient.getInstance(context).isRegistering) {
|
|
663
|
+
OmiClient.autoRegister(true);
|
|
664
|
+
}
|
|
665
|
+
OmiClient.isAppReady = true;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
654
669
|
fun onRequestPermissionsResult(
|
|
655
670
|
requestCode: Int,
|
|
656
671
|
permissions: Array<out String>,
|
package/omikit-plugin.podspec
CHANGED