omikit-plugin 3.2.19 → 3.2.23

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
- //need request this permission
105
- //need request this permission
106
- <uses-permission android:name="android.permission.INTERNET" />
107
- //add these lines inside <activity>
108
- <intent-filter>
109
- <action android:name="com.omicall.sdk.CallingActivity"/>
110
- <category android:name="android.intent.category.DEFAULT" />
111
- </intent-filter>
112
- //add these lines outside <activity>
113
- <receiver
114
- android:name="vn.vihat.omicall.omisdk.receiver.FirebaseMessageReceiver"
115
- android:exported="true"
116
- android:permission="com.google.android.c2dm.permission.SEND">
117
- <intent-filter>
118
- <action android:name="com.google.android.c2dm.intent.RECEIVE" />
119
- </intent-filter>
120
- </receiver>
121
- <service
122
- android:name="vn.vihat.omicall.omisdk.service.NotificationService"
123
- android:exported="false">
124
- </service>
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,22 @@ 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
+
394
+ -Android:
395
+ + PERMISSIONS.ANDROID.RECORD_AUDIO
396
+ + PERMISSIONS.ANDROID.CALL_PHONE
397
+ + PERMISSIONS.ANDROID.CAMERA; (if you want to make Video calls)
398
+
399
+ -IOS:
400
+ + PERMISSIONS.IOS.MICROPHONE;
401
+ + PERMISSIONS.IOS.CAMERA; (if you want to make Video calls)
402
+
403
+ You can use react native permissions to do this
404
+ ```
405
+
325
406
  - Set up <a href="https://rnfirebase.io/messaging/usage">Cloud Messaging</a> plugin:
326
407
 
327
408
  ```
@@ -438,17 +519,31 @@ We support 2 environments. So you need set correct key in Appdelegate.
438
519
  phoneNumber: phone, //phone number
439
520
  isVideo: false //allow video call: true/false
440
521
  });
441
- //we will return OmiStartCallStatus with:
442
- - invalidUuid: uuid is invalid (we can not find on my page)
443
- - invalidPhoneNumber: sip user is invalid.
444
- - samePhoneNumber: Can not call same phone number.
445
- - maxRetry: We try to refresh call but we can not start your call.
446
- - permissionDenied: Check audio permission.
447
- - couldNotFindEndpoint: Please login before make your call.
448
- - accountRegisterFailed: We can not register your account.
449
- - startCallFailed: We can not start you call.
450
- - startCallSuccess: Start call successfully.
451
- - haveAnotherCall: We can not start you call because you are joining another call.
522
+
523
+ // The result will be in the form of object:
524
+
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
+ ```
534
+ - Describe in detail the results when startCall returns:
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):
@@ -681,12 +776,22 @@ useEffect(() => {
681
776
  + callerNumber: phone number
682
777
  + incoming: boolean - status call incoming or outgoing
683
778
  + _id: option (id of every call)
779
+ + code_end_call: This is code when end call.
684
780
 
685
781
  + `Incoming call` state lifecycle: incoming -> connecting -> confirmed -> disconnected
686
782
  + `Outgoing call` state lifecycle: calling -> early -> connecting -> confirmed -> disconnected
687
783
 
688
784
  + onSwitchboardAnswer have callback when employee answered script call.
689
785
 
786
+ - List of notable call codes `code_end_call`:
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
794
+
690
795
 
691
796
  - Action Name value:
692
797
  - `OmiCallEvent.onMuted`: Audio 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.0.72'
107
+ api 'vn.vihat.omicall:omi-sdk:2.1.45'
108
108
 
109
109
  implementation "com.facebook.react:react-native:+" // From node_modules
110
110
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
@@ -124,9 +124,9 @@ dependencies {
124
124
  implementation "com.squareup.okhttp3:okhttp-urlconnection:4.9.1"
125
125
  implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
126
126
  implementation "com.google.code.gson:gson:2.8.9"
127
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
127
+
128
128
  implementation "androidx.security:security-crypto:1.1.0-alpha06"
129
- implementation "com.github.voismart:crypto:0.1.0"
129
+
130
130
 
131
131
  implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
132
132
  implementation "com.github.bumptech.glide:glide:4.15.1"
@@ -79,7 +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", "=>> ON CALL END => ")
82
+ Log.d("OMISDK RN", "=>> onCallEnd 0000 => $callInfo")
83
83
  val call = callInfo as Map<*, *>
84
84
  val map: WritableMap = WritableNativeMap()
85
85
  val timeStartToAnswer = call["time_start_to_answer"] as Long?
@@ -93,6 +93,8 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
93
93
  map.putString("sip_user", call["sip_user"] as String)
94
94
  map.putString("disposition", call["disposition"] as String)
95
95
  map.putInt("status", CallState.disconnected.value)
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
- val map: WritableMap = WritableNativeMap()
368
- map.putString("callerNumber", call["callerNumber"] as String)
369
- map.putInt("status", call["status"] as Int)
370
- map.putBoolean("muted", call["muted"] as Boolean)
371
- map.putBoolean("isVideo", call["isVideo"] as Boolean)
372
- promise.resolve(map)
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 = OmiClient.getInstance(reactApplicationContext!!).startCall(phoneNumber, isVideo)
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>,
@@ -358,6 +358,7 @@ class CallManager {
358
358
  "time_end" : timeEnd,
359
359
  "sip_user": user,
360
360
  "disposition" : lastStatusCall == nil ? "no_answered" : "answered",
361
+ "code_end_call" : call.lastStatus
361
362
  ]
362
363
  }
363
364
 
@@ -32,5 +32,5 @@ Pod::Spec.new do |s|
32
32
  s.dependency "RCTTypeSafety"
33
33
  s.dependency "ReactCommon/turbomodule/core"
34
34
  end
35
- s.dependency "OmiKit", '1.6.4'
35
+ s.dependency "OmiKit", '1.6.37'
36
36
  end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omikit-plugin",
3
- "version": "3.2.19",
3
+ "version": "3.2.23",
4
4
  "description": "Omikit Plugin by ViHAT",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",