Search code examples
iosiphonejailbreakcore-telephony

How to intercept adding calls to call history in iOS?


I'm developing a tweak for jailbroken iPhones. I'm trying to intercept the process of a call being added to the call history. With a little bit search I found CTCallHistoryStoreAddCall function in CoreTelephony framework found here. When I try to use it I get an error:

Undefined symbols for architecture armv7: "_CTCallHistoryStoreAddCall"

I linked the CoreTelephony framework and the way I used it in my code was:

typedef struct __CTCall * CTCallRef;
extern "C" void CTCallHistoryStoreAddCall(CTCallRef call);

I guess that means this function does not exist anymore or if it does I'm not using it in the correct way. How can I find the right function that is responsible for adding an incoming phone call to the call history?

Thanks in advanced.

I'm using iOSOpenDev on Xcode 5.


Solution

  • There is no such function. At least in iOS7.

    I've posted solution for iOS7 here Hide a phone call completely in iOS (jailbreak device)

    Here is the code:

    //Private API from CoreTelephony.framework
    void CTCallDeleteFromCallHistory(CTCallRef call);
    
    %hook PHRecentCall
    
    -(id)initWithCTCall:(CTCallRef)call
    {
        if (IsCallShouldBeDeleted(call) == YES)
        {
            //Delete call from call history
            CTCallDeleteFromCallHistory(call);
    
            //Update MobilePhone app UI
            id PHRecentsViewController = [[[[[UIApplication sharedApplication] delegate] rootViewController] tabBarViewController] recentsViewController];
            if ([PHRecentsViewController isViewLoaded])
            {
                [PHRecentsViewController resetCachedIndexes];
                [PHRecentsViewController _reloadTableViewAndNavigationBar];
            }
    
            //Try uncommenting this, may be it will work. Should make the code faster.
            //return nil;
        }
    
        return %orig;
    }
    
    %end
    

    Tweak hooks class inside MobilePhone app so bundle filter is com.apple.mobilephone.

    IsCallShouldBeDeleted is pseudo function that determines whether a call should be deleted. You can remove it or implement your own. It's there just to make the code more clear.

    On iOS6 class names are different but code is exactly the same - Apple just renamed the classes. I use that solution since iOS4. Also on iOS4 it requires a bit more code as there was no CTCallDeleteFromCallHistory function.