Skip to content

Instantly share code, notes, and snippets.

@jinahadam
Created October 15, 2010 02:37
Show Gist options
  • Save jinahadam/627502 to your computer and use it in GitHub Desktop.
Save jinahadam/627502 to your computer and use it in GitHub Desktop.
Call Center Setup
CTCallCenter *callCenter;
BOOL callHandlerSetup = NO;
// Setup Call Center
if (callHandlerSetup == NO) {
callCenter = [[CTCallCenter alloc] init];
callCenter.callEventHandler = ^(CTCall *call) {
//Call this function when there is an incoming call
// the incoming call state is in call.callState (NSString)
[NSThread detachNewThreadSelector:@selector(processCall)
toTarget:self
withObject:nil];
};
}
CTCall *call = [[CTCall alloc] init];
NSDictionary *infoDict = [NSDictionary dictionaryWithObjectsAndKeys:call.callID,@"callID", call.callState,@"callState < --", nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"CTCallChanged"
object:nil userInfo:infoDict];
NSOperationQueue *opQ = [[NSOperationQueue alloc] init];
[[NSNotificationCenter defaultCenter] addObserverForName:@"CTCallChanged"
object:nil queue:opQ
usingBlock:^(NSNotification *notif) {
}
];
[call release];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment