mNo edit summary |
m (→References) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
== Initiating a call == | == Initiating a call == | ||
To initiate a call without using {{applink|MobilePhone}}, you can use the CTCallDial function. | To initiate a call without using {{applink|MobilePhone}}, you can use the <tt>CTCallDial</tt> function. | ||
<source lang=c> | <source lang=c> | ||
Line 16: | Line 16: | ||
</source> | </source> | ||
The CTCallHold, CTCallResume and CTCallDisconnect (end the call) can be used to hold call, resume a held call and end a call, respectively. | The <tt>CTCallHold</tt>, <tt>CTCallResume</tt> and <tt>CTCallDisconnect</tt> (to end the call) functions can be used to hold call, resume a held call and end a call, respectively. | ||
* '''Note''': The phone number passed to CTCallDial must be normalized. For example, +1 (555) 555-5555 will become 15555555555 after normalization. You can use the [[CPPhoneNumber|CPPhoneNumberCopyNormalized]] function to normalize. | * '''Note''': The phone number passed to <tt>CTCallDial</tt> must be normalized. For example, +1 (555) 555-5555 will become 15555555555 after normalization. You can use the [[CPPhoneNumber|CPPhoneNumberCopyNormalized]] function to normalize. | ||
== | == Getting the call history == | ||
* | One can use the <tt>_CTCallCopyAllCalls</tt> function to get the call history as a list of CTCalls. | ||
<source lang=c> | |||
CFArrayRef calls = _CTCallCopyAllCalls(); | |||
NSLog(@"Calls: %@", calls); | |||
CFRelease(calls); | |||
</source> | |||
== External links == | |||
* Header: https://github.com/Cykey/ios-reversed-headers/blob/master/CoreTelephony/CTCall.h | |||
{{occlass|library=CoreTelephony.framework|navbox=1}} | {{occlass|library=CoreTelephony.framework|navbox=1}} |
Latest revision as of 18:39, 26 October 2014
CTCall is a set of APIs in CoreTelephony.framework that is used to achieve various things related to phone calls.
Initiating a call
To initiate a call without using MobilePhone, you can use the CTCallDial function.
CFStringRef number = CFSTR("15555555555");
CTCallRef call = CTCallDial(number);
...
CTCallHold(call);
...
CTCallResume(call);
...
CTCallDisconnect(call);
The CTCallHold, CTCallResume and CTCallDisconnect (to end the call) functions can be used to hold call, resume a held call and end a call, respectively.
- Note: The phone number passed to CTCallDial must be normalized. For example, +1 (555) 555-5555 will become 15555555555 after normalization. You can use the CPPhoneNumberCopyNormalized function to normalize.
Getting the call history
One can use the _CTCallCopyAllCalls function to get the call history as a list of CTCalls.
CFArrayRef calls = _CTCallCopyAllCalls();
NSLog(@"Calls: %@", calls);
CFRelease(calls);
External links
|