8383import static io .wazo .callkeep .Constants .EXTRA_CALL_UUID ;
8484import static io .wazo .callkeep .Constants .EXTRA_CALL_NUMBER ;
8585import static io .wazo .callkeep .Constants .EXTRA_HAS_VIDEO ;
86+ import static io .wazo .callkeep .Constants .EXTRA_PAYLOAD ;
8687import static io .wazo .callkeep .Constants .ACTION_END_CALL ;
8788import static io .wazo .callkeep .Constants .ACTION_ANSWER_CALL ;
8889import static io .wazo .callkeep .Constants .ACTION_MUTE_CALL ;
@@ -308,17 +309,22 @@ public void unregisterEvents() {
308309
309310 @ ReactMethod
310311 public void displayIncomingCall (String uuid , String number , String callerName ) {
311- this .displayIncomingCall (uuid , number , callerName , false );
312+ this .displayIncomingCall (uuid , number , callerName , false , null );
312313 }
313314
314315 @ ReactMethod
315316 public void displayIncomingCall (String uuid , String number , String callerName , boolean hasVideo ) {
317+ this .displayIncomingCall (uuid , number , callerName , hasVideo , null );
318+ }
319+
320+ @ ReactMethod
321+ public void displayIncomingCall (String uuid , String number , String callerName , boolean hasVideo , @ Nullable Bundle payload ) {
316322 if (!isConnectionServiceAvailable () || !hasPhoneAccount ()) {
317323 Log .w (TAG , "[RNCallKeepModule] displayIncomingCall ignored due to no ConnectionService or no phone account" );
318324 return ;
319325 }
320326
321- Log .d (TAG , "[RNCallKeepModule] displayIncomingCall, uuid: " + uuid + ", number: " + number + ", callerName: " + callerName + ", hasVideo: " + hasVideo );
327+ Log .d (TAG , "[RNCallKeepModule] displayIncomingCall, uuid: " + uuid + ", number: " + number + ", callerName: " + callerName + ", hasVideo: " + hasVideo + ", payload: " + payload );
322328
323329 Bundle extras = new Bundle ();
324330 Uri uri = Uri .fromParts (PhoneAccount .SCHEME_TEL , number , null );
@@ -327,6 +333,9 @@ public void displayIncomingCall(String uuid, String number, String callerName, b
327333 extras .putString (EXTRA_CALLER_NAME , callerName );
328334 extras .putString (EXTRA_CALL_UUID , uuid );
329335 extras .putString (EXTRA_HAS_VIDEO , String .valueOf (hasVideo ));
336+ if (payload != null ) {
337+ extras .putBundle (EXTRA_PAYLOAD , payload );
338+ }
330339
331340 telecomManager .addNewIncomingCall (handle , extras );
332341 }
@@ -350,12 +359,17 @@ public void answerIncomingCall(String uuid) {
350359
351360 @ ReactMethod
352361 public void startCall (String uuid , String number , String callerName ) {
353- this .startCall (uuid , number , callerName , false );
362+ this .startCall (uuid , number , callerName , false , null );
354363 }
355364
356365 @ ReactMethod
357366 public void startCall (String uuid , String number , String callerName , boolean hasVideo ) {
358- Log .d (TAG , "[RNCallKeepModule] startCall called, uuid: " + uuid + ", number: " + number + ", callerName: " + callerName );
367+ this .startCall (uuid , number , callerName , hasVideo , null );
368+ }
369+
370+ @ ReactMethod
371+ public void startCall (String uuid , String number , String callerName , boolean hasVideo , @ Nullable Bundle payload ) {
372+ Log .d (TAG , "[RNCallKeepModule] startCall called, uuid: " + uuid + ", number: " + number + ", callerName: " + callerName + ", payload: " + payload );
359373
360374 if (!isConnectionServiceAvailable () || !hasPhoneAccount () || !hasPermissions () || number == null ) {
361375 Log .w (TAG , "[RNCallKeepModule] startCall ignored: " + isConnectionServiceAvailable () + ", " + hasPhoneAccount () + ", " + hasPermissions () + ", " + number );
@@ -370,6 +384,9 @@ public void startCall(String uuid, String number, String callerName, boolean has
370384 callExtras .putString (EXTRA_CALL_UUID , uuid );
371385 callExtras .putString (EXTRA_CALL_NUMBER , number );
372386 callExtras .putString (EXTRA_HAS_VIDEO , String .valueOf (hasVideo ));
387+ if (payload != null ) {
388+ callExtras .putBundle (EXTRA_PAYLOAD , payload );
389+ }
373390
374391 extras .putParcelable (TelecomManager .EXTRA_PHONE_ACCOUNT_HANDLE , handle );
375392 extras .putParcelable (TelecomManager .EXTRA_OUTGOING_CALL_EXTRAS , callExtras );
0 commit comments