3

Is it possible to accept/answer an incoming phone call programmatically via a private API?

I tried out the code to block an incoming call referenced at How can I use private APIs to block incoming calls in an iOS application?. Eventually, I got it to build for iOS 6.

Maybe one difficulty is that the own app goes to the background as soon as a call arrives? Or is there an event the app can receive before that?

Community
  • 1
  • 1
jakob.j
  • 942
  • 13
  • 28

1 Answers1

1

I got it: You have to use CTCallAnswer(call); in the following notification case:

if ([str1 isEqualToString:@"kCTCallIdentificationChangeNotification"])
{
    NSDictionary *info = (__bridge NSDictionary *)userInfo;
    CTCall2 *call = (__bridge CTCall *)[info objectForKey:@"kCTCall"];
    NSString *caller = CTCallCopyAddress(NULL, call);
    NSLog(@"Caller %@",caller);

    // answer this call
    CTCallAnswer(call);
}
jakob.j
  • 942
  • 13
  • 28