Tuesday, 15 March 2011

ios - Intercepting phone call - iPhone (correct method to hook in CoreTelephony) -



ios - Intercepting phone call - iPhone (correct method to hook in CoreTelephony) -

i new jailbreak tweak development scene. trying figure out appropriate method 'hook' can intercept incoming phone call (and run code).

i have dumped header files of coretelephony framework no methods seem obvious hook. have tried:

- (void)broadcastcallstatechangesifneededwithfailurelogmessage:(id)arg1; - (bool)setupserverconnection;

but neither have worked. worked mean - called when iphone receives call.

any pointers appropriate method hook? :)

note: going jailbreak tweak using private apis won't submitted app store.

i didn't test code, think problem might need utilize core telephony notification center register event (not had in code in comment). this:

// register core telephony notifications id ct = cttelephonycentergetdefault(); cttelephonycenteraddobserver(ct, // center null, // observer telephonyeventcallback, // callback null, // event name (or all) null, // object cfnotificationsuspensionbehaviordeliverimmediately);

and callback function is

static void telephonyeventcallback(cfnotificationcenterref center, void *observer, cfstringref name, const void *object, cfdictionaryref userinfo) { nsstring *notifyname = (nsstring*)name; if ([notifyname isequaltostring:@"kctcallidentificationchangenotification"]) { nsdictionary* info = (nsdictionary*)userinfo; ctcall* phone call = (ctcall*)[info objectforkey:@"kctcall"]; nsstring* caller = ctcallcopyaddress(null, call); if (call.callstate == ctcallstatedisconnected) { nslog(@"call has been disconnected"); } else if (call.callstate == ctcallstateconnected) { nslog(@"call has been connected"); } else if (call.callstate == ctcallstateincoming) { nslog(@"call incoming"); } else if (call.callstate == ctcallstatedialing) { nslog(@"call dialing"); } else { nslog(@"none of conditions"); } } }

i offer technique in similar question here. also, note comment in question not getting notifications in uiapplication has been set background.

update: see cud_programmer's comment below using kctcallstatus on ios 6 instead of kctcall.

ios objective-c hook jailbreak core-telephony

No comments:

Post a Comment