omikit-plugin 3.2.37 → 3.2.39
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 +118 -140
- package/android/build.gradle +16 -16
- package/android/gradle.properties +2 -0
- package/android/settings.gradle +5 -5
- package/android/src/main/java/com/omikitplugin/OmikitPluginModule.kt +7 -11
- package/ios/CallProcess/CallManager.swift +6 -0
- package/omikit-plugin.podspec +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,15 +36,24 @@ yarn add omikit-plugin --latest
|
|
|
36
36
|
```
|
|
37
37
|
jcenter()
|
|
38
38
|
maven {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
url "https://maven.pkg.github.com/omicall/OMICall-SDK"
|
|
40
|
+
credentials {
|
|
41
|
+
username = project.findProperty("OMI_USER") ?: ""
|
|
42
|
+
password = project.findProperty("OMI_TOKEN") ?: ""
|
|
43
|
+
}
|
|
44
|
+
authentication {
|
|
45
|
+
basic(BasicAuthentication)
|
|
46
|
+
}
|
|
47
47
|
}
|
|
48
|
+
|
|
49
|
+
dependencies {
|
|
50
|
+
api 'vn.vihat.omicall:omi-sdk:2.2.85'
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
```
|
|
54
|
+
// gradle.properties
|
|
55
|
+
OMI_USER=omicall
|
|
56
|
+
OMI_TOKEN=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
|
|
48
57
|
```
|
|
49
58
|
|
|
50
59
|
```
|
|
@@ -73,15 +82,15 @@ allprojects {
|
|
|
73
82
|
}
|
|
74
83
|
google()
|
|
75
84
|
maven { url 'https://www.jitpack.io' }
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
+
maven {
|
|
86
|
+
url "https://maven.pkg.github.com/omicall/OMICall-SDK"
|
|
87
|
+
credentials {
|
|
88
|
+
username = project.findProperty("OMI_USER") ?: ""
|
|
89
|
+
password = project.findProperty("OMI_TOKEN") ?: ""
|
|
90
|
+
}
|
|
91
|
+
authentication {
|
|
92
|
+
basic(BasicAuthentication)
|
|
93
|
+
}
|
|
85
94
|
}
|
|
86
95
|
}
|
|
87
96
|
}
|
|
@@ -101,33 +110,31 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
101
110
|
- Update AndroidManifest.xml:
|
|
102
111
|
|
|
103
112
|
```
|
|
104
|
-
<manifest
|
|
105
|
-
......
|
|
113
|
+
<manifest
|
|
114
|
+
......
|
|
106
115
|
xmlns:tools="http://schemas.android.com/tools">
|
|
107
|
-
..... // your config
|
|
116
|
+
..... // your config
|
|
108
117
|
<uses-feature android:name="android.hardware.telephony" android:required="false" />
|
|
109
118
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
110
119
|
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
|
111
120
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
112
|
-
<uses-permission android:name="android.permission.
|
|
113
|
-
|
|
114
|
-
<uses-permission android:name="android.permission.CALL_PHONE"/>
|
|
115
|
-
..... // your config
|
|
121
|
+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
122
|
+
..... // your config
|
|
116
123
|
|
|
117
124
|
<application
|
|
118
125
|
android:name=".MainApplication"
|
|
119
|
-
...... // your config
|
|
126
|
+
...... // your config
|
|
120
127
|
android:alwaysRetainTaskState="true"
|
|
121
128
|
android:largeHeap="true"
|
|
122
129
|
android:exported="true"
|
|
123
130
|
android:supportsRtl="true"
|
|
124
131
|
android:allowBackup="false"
|
|
125
132
|
android:enableOnBackInvokedCallback="true"
|
|
126
|
-
..... // your config
|
|
133
|
+
..... // your config
|
|
127
134
|
>
|
|
128
135
|
<activity
|
|
129
136
|
android:name=".MainActivity"
|
|
130
|
-
..... // your config
|
|
137
|
+
..... // your config
|
|
131
138
|
android:windowSoftInputMode="adjustResize"
|
|
132
139
|
android:showOnLockScreen="true"
|
|
133
140
|
android:launchMode="singleTask"
|
|
@@ -137,9 +144,9 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
137
144
|
android:showWhenLocked="true"
|
|
138
145
|
android:turnScreenOn="true"
|
|
139
146
|
android:exported="true"
|
|
140
|
-
..... // your config
|
|
147
|
+
..... // your config
|
|
141
148
|
>
|
|
142
|
-
..... // your config
|
|
149
|
+
..... // your config
|
|
143
150
|
<intent-filter>
|
|
144
151
|
<action android:name="android.intent.action.MAIN" />
|
|
145
152
|
<category android:name="android.intent.category.LAUNCHER" />
|
|
@@ -151,9 +158,9 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
151
158
|
android:host="incoming_call"
|
|
152
159
|
android:scheme="omisdk" />
|
|
153
160
|
</intent-filter>
|
|
154
|
-
..... // your config
|
|
161
|
+
..... // your config
|
|
155
162
|
</activity>
|
|
156
|
-
..... // your config
|
|
163
|
+
..... // your config
|
|
157
164
|
<receiver
|
|
158
165
|
android:name="vn.vihat.omicall.omisdk.receiver.FirebaseMessageReceiver"
|
|
159
166
|
android:exported="true"
|
|
@@ -169,15 +176,16 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
169
176
|
android:enabled="true"
|
|
170
177
|
android:exported="false">
|
|
171
178
|
</service>
|
|
172
|
-
..... // your config
|
|
179
|
+
..... // your config
|
|
173
180
|
</application>
|
|
174
181
|
</manifest>
|
|
175
182
|
```
|
|
176
183
|
|
|
177
184
|
##### In file MainActivity:
|
|
185
|
+
|
|
178
186
|
```
|
|
179
187
|
public class MainActivity extends ReactActivity {
|
|
180
|
-
..... // your config
|
|
188
|
+
..... // your config
|
|
181
189
|
|
|
182
190
|
|
|
183
191
|
@Override
|
|
@@ -202,51 +210,20 @@ public class MainActivity extends ReactActivity {
|
|
|
202
210
|
if (intent != null) {
|
|
203
211
|
OmikitPluginModule.Companion.onGetIntentFromNotification(reactApplicationContext, intent, this);
|
|
204
212
|
}
|
|
205
|
-
..... // your config
|
|
213
|
+
..... // your config
|
|
206
214
|
}
|
|
207
215
|
}
|
|
208
216
|
```
|
|
209
217
|
|
|
210
|
-
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.
|
|
211
|
-
|
|
212
|
-
- We registered permissions into my plugin:
|
|
213
|
-
|
|
214
|
-
```
|
|
215
|
-
<uses-feature
|
|
216
|
-
android:name="android.hardware.camera"
|
|
217
|
-
android:required="false" />
|
|
218
|
-
<uses-feature
|
|
219
|
-
android:name="android.hardware.telephony"
|
|
220
|
-
android:required="false" />
|
|
221
|
-
|
|
222
|
-
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
|
223
|
-
|
|
224
|
-
<uses-permission android:name="android.permission.INTERNET" />
|
|
225
|
-
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
|
226
|
-
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
|
227
|
-
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
228
|
-
<uses-permission android:name="android.permission.USE_SIP" />
|
|
229
|
-
<uses-permission android:name="android.permission.MANAGE_OWN_CALLS" />
|
|
230
|
-
<uses-permission android:name="android.permission.CALL_PHONE" />
|
|
231
|
-
<uses-permission android:name="android.permission.CAMERA" />
|
|
232
|
-
<uses-permission android:name="android.permission.SYSTEM_CAMERA" /> // add if use targetSDK 34
|
|
233
|
-
|
|
234
|
-
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
|
235
|
-
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
|
|
236
|
-
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
|
|
237
|
-
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CAMERA" />
|
|
238
|
-
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
239
|
-
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
|
240
|
-
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
241
|
-
```
|
|
242
|
-
|
|
243
218
|
- Setup remote push notification: Only support Firebase for remote push notification.
|
|
244
219
|
|
|
245
220
|
- Add `google-service.json` in `android/app` (For more information, you can refer <a href="https://rnfirebase.io/app/usage">Core/App</a>)
|
|
246
221
|
- 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)
|
|
247
222
|
|
|
248
223
|
- 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>
|
|
249
|
-
|
|
224
|
+
|
|
225
|
+
## Config for IOS
|
|
226
|
+
|
|
250
227
|
#### iOS(Object-C):
|
|
251
228
|
|
|
252
229
|
- Assets: Add `call_image` into assets folder to update callkit image. We only support png style.
|
|
@@ -268,6 +245,7 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
268
245
|
|
|
269
246
|
@end
|
|
270
247
|
```
|
|
248
|
+
|
|
271
249
|
- Add variables in **Appdelegate.h** for **New Architecture**:
|
|
272
250
|
|
|
273
251
|
```
|
|
@@ -295,7 +273,7 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
295
273
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
296
274
|
{
|
|
297
275
|
|
|
298
|
-
// ----- Start OmiKit Config ------
|
|
276
|
+
// ----- Start OmiKit Config ------
|
|
299
277
|
[OmiClient setEnviroment:KEY_OMI_APP_ENVIROMENT_SANDBOX userNameKey:@"full_name" maxCall:2 callKitImage:@"call_image" typePushVoip:TYPE_PUSH_CALLKIT_DEFAULT];
|
|
300
278
|
_provider = [[CallKitProviderDelegate alloc] initWithCallManager: [OMISIPLib sharedInstance].callManager];
|
|
301
279
|
_voipRegistry = [[PKPushRegistry alloc] initWithQueue:dispatch_get_main_queue()];
|
|
@@ -303,10 +281,10 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
303
281
|
if (@available(iOS 10.0, *)) {
|
|
304
282
|
[UNUserNotificationCenter currentNotificationCenter].delegate = (id<UNUserNotificationCenterDelegate>) self;
|
|
305
283
|
}
|
|
306
|
-
// ----- End OmiKit Config ------
|
|
284
|
+
// ----- End OmiKit Config ------
|
|
307
285
|
|
|
308
286
|
return YES;
|
|
309
|
-
|
|
287
|
+
|
|
310
288
|
}
|
|
311
289
|
|
|
312
290
|
|
|
@@ -368,8 +346,7 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
368
346
|
|
|
369
347
|
```
|
|
370
348
|
|
|
371
|
-
|
|
372
|
-
*** Only use under lines when added `Cloud Messaging` plugin in your project ***
|
|
349
|
+
**_ Only use under lines when added `Cloud Messaging` plugin in your project _**
|
|
373
350
|
|
|
374
351
|
- Setup push notification: We only support Firebase for push notification.
|
|
375
352
|
|
|
@@ -377,17 +354,20 @@ You can refer <a href="https://github.com/VIHATTeam/OMICALL-React-Native-SDK/blo
|
|
|
377
354
|
- 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)
|
|
378
355
|
|
|
379
356
|
- 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>
|
|
380
|
-
|
|
381
|
-
|
|
357
|
+
|
|
358
|
+
**_ Important release note _**
|
|
359
|
+
|
|
382
360
|
```
|
|
383
361
|
We support 2 environments. So you need set correct key in Appdelegate.
|
|
384
362
|
- KEY_OMI_APP_ENVIROMENT_SANDBOX support on debug mode
|
|
385
363
|
- KEY_OMI_APP_ENVIROMENT_PRODUCTION support on release mode
|
|
386
364
|
- Visit on web admin to select correct enviroment.
|
|
387
365
|
```
|
|
388
|
-
|
|
389
|
-
|
|
366
|
+
|
|
367
|
+
\*Note: At Tab Build Setting off Target Project, you need set: **_Enable Modules (C and Objective C)_** : YES\*
|
|
368
|
+
|
|
390
369
|
#### iOS(Swift):
|
|
370
|
+
|
|
391
371
|
- Assets: Add `call_image` into assets folder to update callkit image. We only support png style.
|
|
392
372
|
|
|
393
373
|
- Add variables in Appdelegate.swift:
|
|
@@ -411,7 +391,7 @@ voipRegistry = PKPushRegistry.init(queue: .main)
|
|
|
411
391
|
pushkitManager = PushKitManager.init(voipRegistry: voipRegistry)
|
|
412
392
|
```
|
|
413
393
|
|
|
414
|
-
-
|
|
394
|
+
- Add these lines into `Info.plist`:
|
|
415
395
|
|
|
416
396
|
```
|
|
417
397
|
<key>NSCameraUsageDescription</key>
|
|
@@ -436,7 +416,7 @@ extension Data {
|
|
|
436
416
|
}
|
|
437
417
|
```
|
|
438
418
|
|
|
439
|
-
|
|
419
|
+
**_ Only use under lines when added `Cloud Messaging` plugin in your project _**
|
|
440
420
|
|
|
441
421
|
- Setup push notification: We only support Firebase for push notification.
|
|
442
422
|
|
|
@@ -444,24 +424,25 @@ extension Data {
|
|
|
444
424
|
- 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)
|
|
445
425
|
|
|
446
426
|
- 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>
|
|
447
|
-
|
|
427
|
+
**_ Important release note _**
|
|
428
|
+
|
|
448
429
|
```
|
|
449
430
|
We support 2 environments. So you need set correct key in Appdelegate.
|
|
450
431
|
- KEY_OMI_APP_ENVIROMENT_SANDBOX support on debug mode
|
|
451
432
|
- KEY_OMI_APP_ENVIROMENT_PRODUCTION support on release mode
|
|
452
|
-
- Visit on web admin to select correct enviroment.
|
|
433
|
+
- Visit on web admin to select correct enviroment.
|
|
453
434
|
```
|
|
454
435
|
|
|
455
|
-
|
|
456
436
|
## Implement
|
|
457
437
|
|
|
458
438
|
### Request permission
|
|
459
439
|
|
|
460
440
|
We need you request permission about call before make call:
|
|
461
|
-
|
|
441
|
+
|
|
442
|
+
- You can use <a href="https://github.com/zoontek/react-native-permissions">react-native-permissions</a> to do this
|
|
462
443
|
|
|
463
444
|
```
|
|
464
|
-
-Android:
|
|
445
|
+
-Android:
|
|
465
446
|
+ PERMISSIONS.ANDROID.RECORD_AUDIO
|
|
466
447
|
+ PERMISSIONS.ANDROID.CALL_PHONE
|
|
467
448
|
+ PERMISSIONS.ANDROID.CAMERA; (if you want to make Video calls)
|
|
@@ -490,16 +471,18 @@ We need you request permission about call before make call:
|
|
|
490
471
|
|
|
491
472
|
startServices();
|
|
492
473
|
```
|
|
474
|
+
|
|
493
475
|
- 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>
|
|
494
476
|
|
|
495
477
|
- 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).
|
|
496
478
|
Please contact for my sale:
|
|
497
|
-
In This step, we need partner provide me
|
|
479
|
+
In This step, we need partner provide me fcmToken of firebase Message.
|
|
480
|
+
|
|
498
481
|
```
|
|
499
482
|
import { initCallWithApiKey } from 'omikit-plugin';
|
|
500
483
|
import messaging from '@react-native-firebase/messaging';
|
|
501
|
-
|
|
502
|
-
let token: String
|
|
484
|
+
|
|
485
|
+
let token: String
|
|
503
486
|
if(Platform.OS == "ios"){
|
|
504
487
|
token = await messaging.getAPNSToken()
|
|
505
488
|
} else {
|
|
@@ -519,14 +502,14 @@ We need you request permission about call before make call:
|
|
|
519
502
|
```
|
|
520
503
|
|
|
521
504
|
- Create OmiKit: OmiKit need userName, password, realm, fcmToken to init environment(All information in innit is required). ViHAT Group will provide information for you.
|
|
522
|
-
This function is used when you want to call any telecommunication number, calling back and forth between internal groups.
|
|
505
|
+
This function is used when you want to call any telecommunication number, calling back and forth between internal groups.
|
|
523
506
|
Please contact for my sale:
|
|
524
507
|
|
|
525
508
|
```
|
|
526
509
|
import { initCallWithUserPassword } from 'omikit-plugin';
|
|
527
510
|
import messaging from '@react-native-firebase/messaging';
|
|
528
|
-
|
|
529
|
-
let token: String
|
|
511
|
+
|
|
512
|
+
let token: String
|
|
530
513
|
if(Platform.OS == "ios"){
|
|
531
514
|
token = await messaging.getAPNSToken()
|
|
532
515
|
} else {
|
|
@@ -568,8 +551,6 @@ We need you request permission about call before make call:
|
|
|
568
551
|
//incomingAcceptButtonImage, incomingDeclineButtonImage, backImage, userImage: Add these into `android/app/src/main/res/drawble`
|
|
569
552
|
```
|
|
570
553
|
|
|
571
|
-
|
|
572
|
-
|
|
573
554
|
- Get call when user open application at first time:
|
|
574
555
|
|
|
575
556
|
```
|
|
@@ -593,7 +574,9 @@ We need you request permission about call before make call:
|
|
|
593
574
|
isVideo: false //allow video call: true/false
|
|
594
575
|
});
|
|
595
576
|
```
|
|
596
|
-
|
|
577
|
+
|
|
578
|
+
- The result will be in the form of object:
|
|
579
|
+
|
|
597
580
|
```
|
|
598
581
|
result = {
|
|
599
582
|
"_id": String // This is call_id. it just have id for iOS,
|
|
@@ -725,6 +708,7 @@ We need you request permission about call before make call:
|
|
|
725
708
|
|
|
726
709
|
logout();
|
|
727
710
|
```
|
|
711
|
+
|
|
728
712
|
- Permission: Check system alert window permission (only Android).
|
|
729
713
|
|
|
730
714
|
```
|
|
@@ -736,6 +720,7 @@ We need you request permission about call before make call:
|
|
|
736
720
|
//false => denied
|
|
737
721
|
}
|
|
738
722
|
```
|
|
723
|
+
|
|
739
724
|
- Setting: Open to enable system alert window (only Android).
|
|
740
725
|
|
|
741
726
|
```
|
|
@@ -827,49 +812,42 @@ useEffect(() => {
|
|
|
827
812
|
}, []);
|
|
828
813
|
```
|
|
829
814
|
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
- Action Name value:
|
|
834
|
-
- `onCallStateChanged`: Call state changed.
|
|
835
|
-
- `onSwitchboardAnswer`: Switchboard sip is listening.
|
|
836
|
-
- List status call:
|
|
837
|
-
+ unknown(0),
|
|
838
|
-
+ calling(1),
|
|
839
|
-
+ incoming(2),
|
|
840
|
-
+ early(3),
|
|
841
|
-
+ connecting(4),
|
|
842
|
-
+ confirmed(5),
|
|
843
|
-
+ disconnected(6);
|
|
844
|
-
+ onCallStateChanged is call state tracking event. We will return status of state. Please refer `OmiCallState`.
|
|
845
|
-
`onCallStateChanged value:`
|
|
846
|
-
+ isVideo: value boolean (true is call Video)
|
|
847
|
-
+ status: number (value matching with List status call )
|
|
848
|
-
+ callerNumber: phone number
|
|
849
|
-
+ incoming: boolean - status call incoming or outgoing
|
|
850
|
-
+ _id: option (id of every call)
|
|
851
|
-
+ code_end_call: This is code when end call.
|
|
852
|
-
|
|
853
|
-
+ `Incoming call` state lifecycle: incoming -> connecting -> confirmed -> disconnected
|
|
854
|
-
+ `Outgoing call` state lifecycle: calling -> early -> connecting -> confirmed -> disconnected
|
|
855
|
-
|
|
856
|
-
+ onSwitchboardAnswer have callback when employee answered script call.
|
|
815
|
+
- Important event `onCallStateChanged`: We provide it to listen call state change.
|
|
816
|
+
// OmiAction have 2 variables: actionName and data
|
|
857
817
|
|
|
858
|
-
-
|
|
818
|
+
- Action Name value:
|
|
819
|
+
- `onCallStateChanged`: Call state changed.
|
|
820
|
+
- `onSwitchboardAnswer`: Switchboard sip is listening.
|
|
821
|
+
- List status call:
|
|
822
|
+
- unknown(0),
|
|
823
|
+
- calling(1),
|
|
824
|
+
- incoming(2),
|
|
825
|
+
- early(3),
|
|
826
|
+
- connecting(4),
|
|
827
|
+
- confirmed(5),
|
|
828
|
+
- disconnected(6);
|
|
829
|
+
|
|
830
|
+
* onCallStateChanged is call state tracking event. We will return status of state. Please refer `OmiCallState`.
|
|
831
|
+
`onCallStateChanged value:` + isVideo: value boolean (true is call Video) + status: number (value matching with List status call ) + callerNumber: phone number + incoming: boolean - status call incoming or outgoing + \_id: option (id of every call) + code_end_call: This is code when end call.
|
|
832
|
+
|
|
833
|
+
* `Incoming call` state lifecycle: incoming -> connecting -> confirmed -> disconnected
|
|
834
|
+
* `Outgoing call` state lifecycle: calling -> early -> connecting -> confirmed -> disconnected
|
|
859
835
|
|
|
836
|
+
* onSwitchboardAnswer have callback when employee answered script call.
|
|
860
837
|
|
|
861
|
-
|
|
862
|
-
|-------|-------------|
|
|
863
|
-
| `600, 503, 480` | These are the codes of the network operator or the user who did not answer the call |
|
|
864
|
-
| `408` | Call request timeout (Each call usually has a waiting time of 30 seconds. If the 30 seconds expire, it will time out) |
|
|
865
|
-
| `403` | Your service plan only allows calls to dialed numbers. Please upgrade your service pack |
|
|
866
|
-
| `404` | The current number is not allowed to make calls to the carrier |
|
|
867
|
-
| `603` | The call was rejected. Please check your account limit or call barring configuration! |
|
|
868
|
-
| `850` | Simultaneous call limit exceeded, please try again later |
|
|
869
|
-
| `486` | The listener refuses the call and does not answer |
|
|
870
|
-
| `601` | Call ended by the customer |
|
|
871
|
-
| `602` | Call ended by the other employee |
|
|
838
|
+
- Table describing code_end_call status
|
|
872
839
|
|
|
840
|
+
| Code | Description |
|
|
841
|
+
| --------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
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 |
|
|
873
851
|
|
|
874
852
|
- Action Name value:
|
|
875
853
|
- `OmiCallEvent.onMuted`: Audio changed.
|
|
@@ -879,15 +857,15 @@ useEffect(() => {
|
|
|
879
857
|
- `OmiCallEvent.onCallQuality`: The calling quality.
|
|
880
858
|
- Data value: We return `callerNumber`, `sip`, `isVideo: true/false` information
|
|
881
859
|
|
|
882
|
-
|
|
883
860
|
- Forward calls to internal staff:
|
|
884
|
-
|
|
885
|
-
example:
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
861
|
+
- You can use function `transferCall` for transfer to staff you want.
|
|
862
|
+
example:
|
|
863
|
+
transferCall({
|
|
864
|
+
phoneNumber: 102
|
|
865
|
+
})
|
|
889
866
|
|
|
890
867
|
# Issues
|
|
891
868
|
|
|
892
|
-
|
|
893
|
-
|
|
869
|
+
## iOS
|
|
870
|
+
|
|
871
|
+
- Must use "Rosetta Destination" to run debug example app on macOS Apple chip
|
package/android/build.gradle
CHANGED
|
@@ -5,13 +5,13 @@ buildscript {
|
|
|
5
5
|
repositories {
|
|
6
6
|
google()
|
|
7
7
|
mavenCentral()
|
|
8
|
-
maven {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
8
|
+
// maven {
|
|
9
|
+
// url("https://vihatgroup.jfrog.io/artifactory/omi-voice/")
|
|
10
|
+
// credentials {
|
|
11
|
+
// username = "downloader"
|
|
12
|
+
// password = "Omi@2022"
|
|
13
|
+
// }
|
|
14
|
+
// }
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
dependencies {
|
|
@@ -83,15 +83,15 @@ allprojects {
|
|
|
83
83
|
mavenCentral()
|
|
84
84
|
jcenter() // Warning: this repository is going to shut down soon
|
|
85
85
|
maven {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
url "https://maven.pkg.github.com/omicall/OMICall-SDK"
|
|
87
|
+
credentials {
|
|
88
|
+
username = project.findProperty("OMI_USER") ?: ""
|
|
89
|
+
password = project.findProperty("OMI_TOKEN") ?: ""
|
|
90
|
+
}
|
|
91
|
+
authentication {
|
|
92
|
+
basic(BasicAuthentication)
|
|
93
|
+
}
|
|
90
94
|
}
|
|
91
|
-
authentication {
|
|
92
|
-
header(HttpHeaderAuthentication)
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -103,7 +103,7 @@ dependencies {
|
|
|
103
103
|
// use for OMISDK
|
|
104
104
|
implementation("androidx.work:work-runtime:2.8.1")
|
|
105
105
|
implementation "androidx.security:security-crypto:1.1.0-alpha06"
|
|
106
|
-
api 'vn.vihat.omicall:omi-sdk:2.
|
|
106
|
+
api 'vn.vihat.omicall:omi-sdk:2.3.12'
|
|
107
107
|
|
|
108
108
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
109
109
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
package/android/settings.gradle
CHANGED
|
@@ -14,13 +14,13 @@ dependencyResolutionManagement {
|
|
|
14
14
|
url "https://jitpack.io"
|
|
15
15
|
}
|
|
16
16
|
maven {
|
|
17
|
-
url "https://
|
|
18
|
-
credentials
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
url "https://maven.pkg.github.com/omicall/OMICall-SDK"
|
|
18
|
+
credentials {
|
|
19
|
+
username = project.findProperty("OMI_USER") ?: ""
|
|
20
|
+
password = project.findProperty("OMI_TOKEN") ?: ""
|
|
21
21
|
}
|
|
22
22
|
authentication {
|
|
23
|
-
|
|
23
|
+
basic(BasicAuthentication)
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -303,24 +303,18 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
303
303
|
mainScope.launch {
|
|
304
304
|
var loginResult = false
|
|
305
305
|
val userName = data.getString("userName")
|
|
306
|
-
Log.d("dataOmi", "INIT_CALL_USER_PASSWORD ==>> $data ")
|
|
307
|
-
Log.d("dataOmi", "INIT_CALL_USER_PASSWORD ==>> $userName ")
|
|
308
306
|
val password = data.getString("password")
|
|
309
307
|
val realm = data.getString("realm")
|
|
310
308
|
val host = data.getString("host") ?: "vh.omicrm.com"
|
|
311
309
|
val isVideo = data.getBoolean("isVideo")
|
|
312
|
-
val firebaseToken = data.getString("fcmToken")
|
|
313
|
-
|
|
314
|
-
Log.d(
|
|
315
|
-
"dataOmi",
|
|
316
|
-
"INIT_CALL_USER_PASSWORD $userName -- $password --$realm --$isVideo -- $host"
|
|
317
|
-
)
|
|
310
|
+
val firebaseToken = data.getString("fcmToken")
|
|
311
|
+
val projectId = data.getString("projectId") ?: ""
|
|
318
312
|
|
|
319
313
|
withContext(Dispatchers.Default) {
|
|
320
314
|
try {
|
|
321
315
|
if (userName != null && password != null && realm != null && firebaseToken != null) {
|
|
322
316
|
loginResult =
|
|
323
|
-
OmiClient.register(userName, password, realm, isVideo ?: true, firebaseToken, host)
|
|
317
|
+
OmiClient.register(userName, password, realm, isVideo ?: true, firebaseToken, host, projectId)
|
|
324
318
|
promise.resolve(loginResult)
|
|
325
319
|
}
|
|
326
320
|
} catch (_: Throwable) {
|
|
@@ -341,6 +335,8 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
341
335
|
val isVideo = data.getBoolean("isVideo") ?: false
|
|
342
336
|
val phone = data.getString("phone")
|
|
343
337
|
val firebaseToken = data.getString("fcmToken") as String
|
|
338
|
+
val projectId = data.getString("projectId") ?: ""
|
|
339
|
+
|
|
344
340
|
requestPermission(isVideo)
|
|
345
341
|
withContext(Dispatchers.Default) {
|
|
346
342
|
try {
|
|
@@ -351,7 +347,8 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
351
347
|
uuid = usrUuid,
|
|
352
348
|
phone = phone ?: "",
|
|
353
349
|
isVideo = isVideo,
|
|
354
|
-
firebaseToken
|
|
350
|
+
firebaseToken,
|
|
351
|
+
projectId
|
|
355
352
|
)
|
|
356
353
|
promise.resolve(true)
|
|
357
354
|
}
|
|
@@ -359,7 +356,6 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
|
|
|
359
356
|
promise.resolve(loginResult)
|
|
360
357
|
}
|
|
361
358
|
}
|
|
362
|
-
|
|
363
359
|
}
|
|
364
360
|
}
|
|
365
361
|
|
|
@@ -132,6 +132,9 @@ class CallManager {
|
|
|
132
132
|
//request permission
|
|
133
133
|
var result = false
|
|
134
134
|
if let usrUuid = params["usrUuid"] as? String, let fullName = params["fullName"] as? String, let apiKey = params["apiKey"] as? String, let token = params["fcmToken"] as? String {
|
|
135
|
+
if let projectID = params["projectId"] as? String, !projectID.isEmpty {
|
|
136
|
+
OmiClient.setFcmProjectId(projectID)
|
|
137
|
+
}
|
|
135
138
|
result = OmiClient.initWithUUID(usrUuid, fullName: fullName, apiKey: apiKey)
|
|
136
139
|
OmiClient.setUserPushNotificationToken(token)
|
|
137
140
|
}
|
|
@@ -146,6 +149,9 @@ class CallManager {
|
|
|
146
149
|
func initWithUserPasswordEndpoint(params: [String: Any]) -> Bool {
|
|
147
150
|
var result = false
|
|
148
151
|
if let userName = params["userName"] as? String, let password = params["password"] as? String, let realm = params["realm"] as? String, let token = params["fcmToken"] as? String {
|
|
152
|
+
if let projectID = params["projectId"] as? String, !projectID.isEmpty {
|
|
153
|
+
OmiClient.setFcmProjectId(projectID)
|
|
154
|
+
}
|
|
149
155
|
OmiClient.initWithUsername(userName, password: password, realm: realm, proxy: "")
|
|
150
156
|
OmiClient.setUserPushNotificationToken(token)
|
|
151
157
|
result = true
|
package/omikit-plugin.podspec
CHANGED