Skip to content

Commit a04cf4a

Browse files
c960657manuquentin
authored andcommitted
Support DTMF events
1 parent b4ea705 commit a04cf4a

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

actions.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ const didPerformSetMutedCallAction = handler =>
4444
eventEmitter.addListener(RNCallKeepDidPerformSetMutedCallAction, (data) => handler(data.muted));
4545

4646
const didPerformDTMFAction = handler => {
47-
// @TODO: handle DTMF on iOS
48-
if (isIOS) {
49-
return;
50-
}
51-
5247
eventEmitter.addListener(RNCallKeepDidPerformDTMFAction, handler);
5348
};
5449

ios/RNCallKeep/RNCallKeep.m

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
static NSString *const RNCallKeepDidActivateAudioSession = @"RNCallKeepDidActivateAudioSession";
2525
static NSString *const RNCallKeepDidDisplayIncomingCall = @"RNCallKeepDidDisplayIncomingCall";
2626
static NSString *const RNCallKeepDidPerformSetMutedCallAction = @"RNCallKeepDidPerformSetMutedCallAction";
27+
static NSString *const RNCallKeepPerformPlayDTMFCallAction = @"RNCallKeepDidPerformDTMFAction";
2728

2829
@implementation RNCallKeep
2930
{
@@ -67,7 +68,8 @@ - (void)dealloc
6768
RNCallKeepPerformEndCallAction,
6869
RNCallKeepDidActivateAudioSession,
6970
RNCallKeepDidDisplayIncomingCall,
70-
RNCallKeepDidPerformSetMutedCallAction
71+
RNCallKeepDidPerformSetMutedCallAction,
72+
RNCallKeepPerformPlayDTMFCallAction
7173
];
7274
}
7375

@@ -453,6 +455,15 @@ - (void)provider:(CXProvider *)provider performSetHeldCallAction:(CXSetHeldCallA
453455
#endif
454456
}
455457

458+
- (void)provider:(CXProvider *)provider performPlayDTMFCallAction:(CXPlayDTMFCallAction *)action {
459+
#ifdef DEBUG
460+
NSLog(@"[RNCallKit][CXProviderDelegate][provider:performPlayDTMFCallAction]");
461+
#endif
462+
NSString *callUUID = [self containsLowerCaseLetter:action.callUUID.UUIDString] ? action.callUUID.UUIDString : [action.callUUID.UUIDString lowercaseString];
463+
[self sendEventWithName:RNCallKeepPerformPlayDTMFCallAction body:@{ @"digits": action.digits, @"callUUID": callUUID }];
464+
[action fulfill];
465+
}
466+
456467
- (void)provider:(CXProvider *)provider timedOutPerformingAction:(CXAction *)action
457468
{
458469
#ifdef DEBUG

0 commit comments

Comments
 (0)