omikit-plugin 3.2.69 → 3.2.71

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
@@ -909,7 +909,9 @@ const result = await startCallWithUuid({
909
909
  {
910
910
  "extension": "111",
911
911
  "full_name": "chau1",
912
+ "fullName": "chau1",
912
913
  "avatar_url": "",
914
+ "avatarUrl": "",
913
915
  "uuid": "122aaa"
914
916
  }
915
917
  ```
@@ -1129,24 +1131,26 @@ useEffect(() => {
1129
1131
  ```javascript
1130
1132
  // The event is updated every time the call status changes
1131
1133
  const onCallStateChanged = (data: any) => {
1134
+ // ⚠️ ⚠️ Currently, we support two data formats: camelCase and snake_case. Snake_case is used for data v1, while camelCase is for v2. We encourage customers to use camelCase instead of snake_case, as we plan to completely remove the snake_case format in the future ❌ ❌
1135
+
1132
1136
  /*
1133
1137
  Call state change event data (Object) includes:
1134
1138
 
1135
1139
  - _id: string (UUID of the call)
1136
1140
  - callInfo: object (Detailed call information)
1137
1141
  - callerNumber: string (Phone number of the caller)
1138
- - code_end_call: number (Status code when the call ends)
1139
- - destination_number?: string (Destination phone number, optional)
1142
+ - code_end_call, codeEndCall: number (Status code when the call ends)
1143
+ - destination_number, destinationNumber?: string (Destination phone number, optional)
1140
1144
  - direction: string ("inbound" or "outbound", call direction)
1141
1145
  - disposition: string (Call answer status)
1142
1146
  - incoming: boolean (true if it is an incoming call)
1143
1147
  - isVideo: boolean (true if it is a video call)
1144
- - sip_user: string (Current SIP user)
1145
- - source_number: string (SIP number of the user)
1148
+ - sip_user, sipUser: string (Current SIP user)
1149
+ - source_number, sourceNumber: string (SIP number of the user)
1146
1150
  - status: string (value matching with List status call)
1147
- - time_end: number (Timestamp when the call ended)
1148
- - time_start_to_answer: number (Time taken to answer the call)
1149
- - transaction_id: string (OMI Call unique ID)
1151
+ - time_end, timeEnd: number (Timestamp when the call ended)
1152
+ - time_start_to_answer, timeStartToAnswer: number (Time taken to answer the call)
1153
+ - transaction_id, transactionId: string (OMI Call unique ID)
1150
1154
  */
1151
1155
  };
1152
1156
 
@@ -1180,7 +1184,7 @@ const onSwitchboardAnswer = (data: any) => {
1180
1184
  }
1181
1185
  ```
1182
1186
 
1183
- ✨ Table describing `code_end_call` status
1187
+ ✨ Table describing `code_end_call, codeEndCall` status
1184
1188
 
1185
1189
  | Code | Description |
1186
1190
  | --------------- | --------------------------------------------------------------------------------------------------------------------- |
@@ -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.19'
123
+ api 'vn.vihat.omicall:omi-sdk:2.3.20'
124
124
 
125
125
  implementation "com.facebook.react:react-native:+" // From node_modules
126
126
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
@@ -84,16 +84,25 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
84
84
  val map: WritableMap = WritableNativeMap()
85
85
  val timeStartToAnswer = call["time_start_to_answer"] as Long?
86
86
  val timeEnd = call["time_end"] as Long
87
- map.putString("transaction_id", call["transaction_id"] as String?)
88
87
  map.putString("direction", call["direction"] as String)
88
+ map.putString("transaction_id", call["transaction_id"] as String?)
89
89
  map.putString("source_number", call["source_number"] as String)
90
90
  map.putString("destination_number", call["destination_number"] as String)
91
91
  map.putDouble("time_start_to_answer", (timeStartToAnswer ?: 0).toDouble())
92
92
  map.putDouble("time_end", timeEnd.toDouble())
93
93
  map.putString("sip_user", call["sip_user"] as String)
94
+ map.putInt("code_end_call", statusCode as Int)
94
95
  map.putString("disposition", call["disposition"] as String)
95
96
  map.putInt("status", CallState.disconnected.value)
96
- map.putInt("code_end_call", statusCode as Int)
97
+
98
+ map.putString("transactionId", call["transaction_id"] as String?)
99
+ map.putString("sourceNumber", call["source_number"] as String)
100
+ map.putString("destinationNumber", call["destination_number"] as String)
101
+ map.putDouble("timeStartToAnswer", (timeStartToAnswer ?: 0).toDouble())
102
+ map.putDouble("timeEnd", timeEnd.toDouble())
103
+ map.putString("sipUser", call["sip_user"] as String)
104
+ map.putInt("codeEndCall", statusCode as Int)
105
+
97
106
  Log.d("OMISDK RN", "=>> onCallEnd => $map")
98
107
  sendEvent(CALL_STATE_CHANGED, map)
99
108
  }
@@ -194,6 +203,7 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
194
203
  putString("_id", "")
195
204
  putInt("status", 6)
196
205
  putInt("code_end_call", if (statusCode == 403) 853 else statusCode)
206
+ putInt("codeEndCall", if (statusCode == 403) 853 else statusCode)
197
207
  }
198
208
  sendEvent(CALL_STATE_CHANGED, mapObject)
199
209
  }
@@ -505,12 +515,27 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
505
515
 
506
516
  @ReactMethod
507
517
  fun joinCall(promise: Promise) {
508
- currentActivity?.runOnUiThread {
509
- if (reactApplicationContext != null) {
510
- OmiClient.getInstance(reactApplicationContext!!).pickUp()
511
- promise.resolve(true)
518
+ val appContext = reactApplicationContext.applicationContext
519
+ val activity = currentActivity
520
+
521
+ if (appContext == null) {
522
+ promise.reject("E_NULL_CONTEXT", "Application context is null")
523
+ return
524
+ }
525
+
526
+ if (activity == null) {
527
+ promise.reject("E_NULL_ACTIVITY", "Current activity is null")
528
+ return
529
+ }
530
+
531
+ activity.runOnUiThread {
532
+ try {
533
+ OmiClient.getInstance(appContext).pickUp()
534
+ promise.resolve(true)
535
+ } catch (e: Exception) {
536
+ promise.reject("E_JOIN_CALL_FAILED", "Failed to join call", e)
537
+ }
512
538
  }
513
- }
514
539
  }
515
540
 
516
541
  @ReactMethod
@@ -646,6 +671,10 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
646
671
  map.putString("uuid", call["uuid"] as String?)
647
672
  map.putString("full_name", call["full_name"] as String?)
648
673
  map.putString("avatar_url", call["avatar_url"] as String?)
674
+
675
+ map.putString("fullName", call["full_name"] as String?)
676
+ map.putString("avatarUrl", call["avatar_url"] as String?)
677
+
649
678
  promise.resolve(map)
650
679
  } else {
651
680
  promise.resolve(null);
@@ -671,6 +700,10 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
671
700
  map.putString("uuid", call["uuid"] as String?)
672
701
  map.putString("full_name", call["full_name"] as String?)
673
702
  map.putString("avatar_url", call["avatar_url"] as String?)
703
+
704
+ map.putString("fullName", call["full_name"] as String?)
705
+ map.putString("avatarUrl", call["avatar_url"] as String?)
706
+
674
707
  promise.resolve(map)
675
708
  } else {
676
709
  promise.resolve(null);
@@ -695,6 +728,9 @@ class OmikitPluginModule(reactContext: ReactApplicationContext?) :
695
728
  map.putString("uuid", call["uuid"] as String?)
696
729
  map.putString("full_name", call["full_name"] as String?)
697
730
  map.putString("avatar_url", call["avatar_url"] as String?)
731
+
732
+ map.putString("fullName", call["full_name"] as String?)
733
+ map.putString("avatarUrl", call["avatar_url"] as String?)
698
734
  promise.resolve(map)
699
735
  } else {
700
736
  promise.resolve(null)
@@ -377,7 +377,15 @@ class CallManager {
377
377
  "time_end" : timeEnd,
378
378
  "sip_user": user,
379
379
  "disposition" : lastStatusCall == nil ? "no_answered" : "answered",
380
- "code_end_call" : call.lastStatus
380
+ "code_end_call" : call.lastStatus,
381
+
382
+ "transactionId" : call.omiId,
383
+ "sourceNumber" : user,
384
+ "destinationNumber" : guestPhone,
385
+ "timeStartToAnswer" : call.createDate,
386
+ "timeEnd" : timeEnd,
387
+ "sipUser": user,
388
+ "codeEndCall" : call.lastStatus
381
389
  ]
382
390
  }
383
391
 
@@ -495,10 +503,8 @@ class CallManager {
495
503
 
496
504
  /// Toogle speaker
497
505
  func toogleSpeaker() {
498
- OMIAudioController *audioController = [[OMISIPLib.sharedInstance callManager] audioController];
499
- OMIAudioControllerOutputs newOutput = (audioController.output == OMIAudioControllerOutputSpeaker) ? OMIAudioControllerOutputOther : OMIAudioControllerOutputSpeaker;
500
- [audioController setOutput:newOutput];
501
- self.isSpeaker =
506
+ let result = self.omiLib.callManager.audioController.toggleSpeaker();
507
+ self.isSpeaker = result
502
508
  OmikitPlugin.instance.sendSpeakerStatus()
503
509
  }
504
510
 
@@ -31,7 +31,7 @@ Pod::Spec.new do |s|
31
31
 
32
32
  # Thêm dependency bắt buộc
33
33
  s.dependency "React-Core"
34
- s.dependency "OmiKit", "1.8.8"
34
+ s.dependency "OmiKit", "1.8.9"
35
35
 
36
36
  # Đảm bảo Swift bridging header được tự động tạo
37
37
  # s.requires_arc = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omikit-plugin",
3
- "version": "3.2.69",
3
+ "version": "3.2.71",
4
4
  "description": "Omikit Plugin by ViHAT",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",