IOS Core Telephony Framework

Source: Internet
Author: User

Core Telephony Framework (key communication framework)

Overview:

This library is prefixed with CT (Core Telephony) and is used primarily to obtain information about the user's communication, which we can use to define an external interface for our own use. Of course we can just use this information to get the information we are currently calling.

The CT object can obtain communication information, for example, it can be used for VoIP (Voip-voice over internet Protocol). And Ctcall can help us get a lot of current call information, including a unique code and a status value-call (dialing), inbound (incoming), call (connected), hang up (disconnected).

Contains the following types:

Ctcall,ctcallcenter,ctcarrier,cttelephonynetworkinfo

The following is a detailed description of each object

Ctcall Class

Inherited from: NSObject

Version support: IOS 4.0 and later

Declared at: CTCall.h

Overview: Ctcall is an encapsulation of call information (don't think much, less pathetic information ...). )。

Contains attributes: Callid, Callstate

@property (Nonatomic, ReadOnly, retain) NSString *callid

Used to identify a mobile phone call (unique) to differentiate between multiple active calls (for example, a pending call and a call being made).

@property (Nonatomic, ReadOnly, retain) NSString *callstate

Used to identify the call status. The following are the four states used for identification:

extern nsstring Const *ctcallstatedialing;   extern nsstring Const *ctcallstateincoming;   extern nsstring Const *ctcallstateconnected; extern nsstring Const *ctcallstatedisconnected;

The initial status of a call is incoming (ctcallstateincoming) and outgoing (ctcallstatedialing), when the turn-on state is switched to ON (ctcallstateconnected), And when the call terminates, the state turns to hang up (ctcallstatedisconnected)

Ctcallcenter Class

Inherited from: NSObject

Version support: IOS 4.0 and later

Declared at: CTCallCenter.h

Overview: Ctcallcenter action When a call state changes, he will callback the specified event at this time.

Include attribute: Calleventhandle,currentcalls

@property (nonatomic, copy) void (^calleventhandler) (ctcall*);

A function that makes a callback when a call event state transitions. When our program is active, the call state transitions directly back to the function we specified. However, when the program is in a suspended state (background), the program does not immediately receive a callback for the state transition until it becomes active again. When suspended to active, the program can only receive the last transition state of each call event. For example, after the call is created (not connected), our program changes from active to suspended, and then the call turns into a call and hangs. When our program is reactivated, we will receive a hang-up message callback for this phone. This is the so-called single-call event in the official documentation.

The simple way to use it is as follows:

Ctcallcenter *center = [[Ctcallcenter alloc] init]; Center.calleventhandler = ^ (Ctcall *call) {NSLog (@ "call:%@", Call.callstate), @property (ReadOnly, retain) Nsset *curre Ntcalls

A container for all calls in the current process.

Ctcarrier Class

Inherited from: NSObject

Version support: IOS 4.0 and later

Declared at: CTCarrier.h

Overview: Ctcarrier is a package for telecom operator information

Include attribute: Allowsvoip,carriername,isocountrycode,mobilecountrycode,mobilenetworkcode

@property (nonatomic, ReadOnly, assign) BOOL Allowsvoip

To identify whether the carrier supports VoIP, and in the following three cases the value will be nil.

1, the device is in flight mode

2, the SIM card is not detected

3. No telecom signal

@property (Nonatomic, ReadOnly, retain) NSString *carriername

The name of the carrier, unless the SIM card is inserted, this value will be the name of the current SIM card or the previous SIM card (no SIM card in the current device) of the carrier.

@property (Nonatomic, ReadOnly, retain) NSString *isocountrycode

The country code that uses the ISO 3166-1 standard identifies the country in which the telecommunications operator is a member. The condition in the nil value is the same as Allowsvoip.

@property (Nonatomic, ReadOnly, retain) NSString *mobilecountrycode

Recorded mobile country Code (MMC), consisting of three digits, uniquely identifies the country to which the mobile user belongs, and our country is 460. It is important to note that the type of this property is NSString rather than numeric.

@property (Nonatomic, ReadOnly, retain) NSString *mobilenetworkcode

The Recorded mobile network Code (MNC) consists of two digits that identify the mobile network to which the mobile user belongs. China Mobile TD System uses 00, the Chinese Unicom GSM system uses 01, the mobile GSM system uses 02, the China Telecom CDMA system uses 03.

Cttelephonynetworkinfo Class

Inherited from: NSObject

Version support: IOS 4.0 and later

Declared at: CTTelephonyNetworkInfo.h

Overview: Cttelephonynetworkinfo is primarily used for the acquisition of carrier information when replacing a SIM card

Include attribute: Subscribercellularprovider,subscribercellularproviderdidupdatenotifier

@property (ReadOnly, retain) Ctcarrier *subscribercellularprovider

A Ctcarrier object that contains the content reference Ctcarrier Class.

@property (nonatomic, copy) void (^subscribercellularproviderdidupdatenotifier) (ctcarrier*);

The interface for callback when the carrier changes.

The simple way to use it is as follows:

Cttelephonynetworkinfo *info = [[Cttelephonynetworkinfo alloc] init]; Ctcarrier *carrier = Info.subscribercellularprovider; NSLog (@ "carrier:%@", [carrier description]); Info.subscribercellularproviderdidupdatenotifier = ^ (Ctcarrier *carrier) {NSLog (@ "carrier:%@", [Carrier description] ); }

Original link: http://blog.163.com/china_uv/blog/static/11713726720126725415858/

IOS Core Telephony Framework

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.