8

In our enterprise iOS app we used

CTCallRef CTCallDial(CFStringRef number);

to do calls from the app (and be able to hide the caller-id

It does not seem to work in iOS 7. Has the API changed there?

(I'm fully aware that this is a private API call and that it can change anytime, but I'm still hoping to find an alternative. Sadly I'm not savvy enough to know how to find all private API that is available)

clows
  • 332
  • 5
  • 11

4 Answers4

3

I think it requires you to sign your app with com.apple.coretelephony.Calls.allow entitlement. I found it in SpringBoard binary. Apple added a whole bunch of new entitlements. So we should expect that many APIs will not work without them. Just for CoreTelephony alone there is four entitlements in SpringBoard.

creker
  • 9,400
  • 1
  • 30
  • 47
  • I can confirm that `com.apple.coretelephony.Calls.allow` is the solution. Without this entitlement you can't make calls with `CTCallDial`. – creker Dec 23 '13 at 19:18
  • I was used class-dump for SpringBoardServices, SpringBoardFoundation, SpringBoardUI, SpringBoardUIServices. **but do not see com.apple.coretelephony.Calls.allow** where is it ???? help me – vualoaithu Dec 27 '13 at 07:49
  • 1
    I was talking about `SpringBoard.app/SpringBoard` binary. You can find it on your device at `/System/Library/CoreServices/SpringBoard.app/SpringBoard` or in iOS simulator at `Xcode.app/Content/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/System/Library/CoreServices/SpringBoard.app/SpringBoard` . Open binary with any text editor and scroll to the end. You will find many entitlements among which will be `com.apple.coretelephony.Calls.allow` – creker Dec 27 '13 at 10:30
  • Yes ,I have seen it.but value is yes. Thanks Creker – vualoaithu Dec 30 '13 at 05:13
2

I asked the same question here in stackoverflow 2 hours after your post... A first look at the class dump (https://github.com/EthanArbuckle/IOS-7-Headers/blob/master/Frameworks/CoreTelephony.framework/CTCall.h) shows, that this function is missing...

ErdyMurphy
  • 101
  • 1
  • 5
  • In the Header File of TUCallCenter (https://github.com/EthanArbuckle/IOS-7-Headers/blob/master/PrivateFrameworks/TelephonyUtilities.framework/TUCallCenter.h) there is a function named "- (id)dial:(id)arg1 service:(int)arg2" but i cant get an instance of the TUCallcenter because sharedInstance returns null. – ErdyMurphy Sep 24 '13 at 07:37
  • But when I call [TUCallCenter sharedInstance] dial:@"123" service:0]; I got the same behaviour as calling CTCallDial() – ErdyMurphy Sep 24 '13 at 08:12
  • Yes I came to the same conclusion. So far I was unable to find a way to create a properly instantiated CTCall object to make a call with. But that might be the way to go in iOS7+ – clows Sep 27 '13 at 07:59
0

Actually I've tried the same as vualoaithu and got no luck. But I've also tried to use other methods of TUCallCenter object and looks like it works fine. For example following method works:

TUCallCenter *callCenter = [TUCallCenter sharedInstance];
if(callCenter) {
    NSLog(@"callCenter is created!");
    //Working part
    if([callCenter inCall]){
        NSLog(@"IN CALL"); // when you press answer button and can talk
    }else{
        NSLog(@"NOT IN CALL"); // other cases
    }
}

Also I've tried following:

    TUPhoneNumber* phoneNumber =
    [TUPhoneNumber phoneNumberWithDigits:@"55555555"
                             countryCode:@"1"];
if(phoneNumber) {
    NSLog(@"Phone Number obj = %@",phoneNumber);
    NSLog(@"Phone Number = %@",phoneNumber.digits);
    NSLog(@"Country Code = %@",phoneNumber.countryCode);
}
[callCenter dial:phoneNumber service:0];

But I got exception:

[TUPhoneNumber length]: unrecognized selector sent to instance 0x14dcefd0

Looks Like we are on the way. If someone will find solution. Please post it here. Thanks.

0x8BADF00D
  • 7,138
  • 2
  • 41
  • 34
-1

you can use

[[UIApplication sharedApplication] openURL: [NSURL URLWithString:[NSString stringWithFormat:@"tel:%@",num]]];

But you can't close call screen when call finished

vualoaithu
  • 936
  • 10
  • 9
  • As @ErdyMurphy mentioned in the other answer, this method does not allow to send control sequences to the telephone app. Which you need for hiding caller-id. – clows Sep 27 '13 at 07:57