Created
October 15, 2010 02:37
-
-
Save jinahadam/627502 to your computer and use it in GitHub Desktop.
Call Center Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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