Get Started

TCConnection Class Reference

Overview

A TCConnection object represents the connection between a TCDevice and Twilio’s services.

A TCConnection is either incoming or outgoing. You do not create a TCConnection directly; an outgoing connection is created by calling the [TCDevice connect:delegate:] method. Incoming connections are created internally by TCDevice and handed to the registered TCDeviceDelegate via [TCDeviceDelegate device:didReceiveIncomingConnection:].

Tasks

Selector Description Type
state Current status of the TCConnection. Property
incoming BOOL representing if the TCConnection is an incoming or outgoing connection. Property
parameters A dictionary of parameters that define the connection. Property
delegate The delegate object which will receive TCConnection events. Property
muted Property that defines if the connection’s microphone is muted. Property
–accept Accepts an incoming connection request. Instance Method
–ignore Ignores an incoming connection request. Instance Method
–reject Rejects an incoming connection request. Instance Method
–disconnect Disconnect the connection. Instance Method
–sendDigits: Send a string of digits over the connection. Instance Method

Properties

delegate

The delegate object which will receive TCConnection events.

@property (nonatomic, assign) id<TCConnectionDelegate> delegate

Discussion

The delegate object which will receive TCConnection events.


incoming

BOOL representing if the TCConnection is an incoming or outgoing connection.

@property (nonatomic, readonly, getter=isIncoming) BOOL incoming

Discussion

BOOL representing if the TCConnection is an incoming or outgoing connection. If the connection is incoming, the value is YES.


muted

Property that defines if the connection’s microphone is muted.

@property (nonatomic, getter=isMuted) BOOL muted

Discussion

Property that defines if the connection’s microphone is muted.

Setting the property will only take effect if the connection’s state is TCConnectionStateConnected.


parameters

A dictionary of parameters that define the connection.

@property (nonatomic, readonly) NSDictionary *parameters

Discussion

A dictionary of parameters that define the connection.

Incoming connection parameters are defined by the "Incoming connection parameter capability keys". Outgoing connection parameters are defined by the union of optional application parameters specified in the Capability Token and any additional parameters specified when the [TCDevice connect:delegate:] method is called.


state

Current status of the TCConnection.

@property (nonatomic, readonly) TCConnectionState state

Discussion

Current status of the TCConnection.

Instance Methods

accept

Accepts an incoming connection request.

- (void)accept

Discussion

Accepts an incoming connection request.

When the TCDeviceDelegate receives a [TCDeviceDelegate device:didReceiveIncomingConnection:] message, calling this method will accept the incoming connection. Calling this method on a TCConnection that is not in the TCConnectionStatePending state will have no effect.


disconnect

Disconnect the connection.

- (void)disconnect

Discussion

Disconnect the connection.

Calling this method on a TCConnection that is in the TCConnectionStateDisconnected state will have no effect. The TCConnectionDelegate will eventually receive a [TCConnectionDelegate connectionDidDisconnect:] message once the connection is terminated.


ignore

Ignores an incoming connection request.

- (void)ignore

Discussion

Ignores an incoming connection request.

When the TCDeviceDelegate receives a [TCDeviceDelegate device:didReceiveIncomingConnection:] message, calling ignore will close the incoming connection request and the connection may not be accepted. Calling this method on a TCConnection that is not in the TCConnectionStatePending state will have no effect. The TCConnectionDelegate will eventually receive a [TCConnectionDelegate connectionDidDisconnect:] message once the connection is terminated.


reject

Rejects an incoming connection request.

- (void)reject

Discussion

Rejects an incoming connection request.

When the TCDeviceDelegate receives a [TCDeviceDelegate device:didReceiveIncomingConnection:] message, calling reject will terminate the request, notifying the caller that the call was rejected. Calling this method on a TCConnection that is not in the TCConnectionStatePending state will have no effect. The TCConnectionDelegate will eventually receive a [TCConnectionDelegate connectionDidDisconnect:] message once the connection is terminated.


sendDigits:

Send a string of digits over the connection.

- (void)sendDigits:(NSString *)digits

Parameters
Name Description
digits A string of characters to be played. Valid values are ‘0’ – ‘9’, ‘*’, ‘#’, and ‘w’. Each ‘w’ will cause a 500 ms pause between digits sent. If any invalid character is present, no digits will be sent.
Discussion

Send a string of digits over the connection.

Calling this method on a TCConnection that is not in the TCConnectionStateConnected state will have no effect.