Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
gtrnocswift committed Dec 4, 2014
1 parent 0c09994 commit 9549c3a
Show file tree
Hide file tree
Showing 37 changed files with 1,194 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
##BUILT FROM TwilioClient-1.2.0-705f421

###Had to Strip Out Duplicate Symbols From the static library

lipo libTwilioClient.a -info
lipo libTwilioClient.a -thin arm64 -output libTwilioClient.arm64
lipo libTwilioClient.a -thin armv7 -output libTwilioClient.armv7
lipo libTwilioClient.a -thin armv7s -output libTwilioClient.armv7s
lipo libTwilioClient.a -thin i386 -output libTwilioClient.i386
lipo libTwilioClient.a -thin x86_64 -output libTwilioClient.x86_64

ar -d -sv libTwilioClient.arm64 srtp_hmac.o
ar -d -sv libTwilioClient.armv7 srtp_hmac.o
ar -d -sv libTwilioClient.armv7s srtp_hmac.o
ar -d -sv libTwilioClient.arm64 srtp_hmac.o
ar -d -sv libTwilioClient.i386 srtp_hmac.o
ar -d -sv libTwilioClient.x86_64 srtp_hmac.o

ar -d -sv libTwilioClient.arm64 srtp_aes_cbc.o
ar -d -sv libTwilioClient.armv7 srtp_aes_cbc.o
ar -d -sv libTwilioClient.armv7s srtp_aes_cbc.o
ar -d -sv libTwilioClient.arm64 srtp_aes_cbc.o
ar -d -sv libTwilioClient.i386 srtp_aes_cbc.o
ar -d -sv libTwilioClient.x86_64 srtp_aes_cbc.o

ar -d -sv libTwilioClient.arm64 srtp_err.o
ar -d -sv libTwilioClient.armv7 srtp_err.o
ar -d -sv libTwilioClient.armv7s srtp_err.o
ar -d -sv libTwilioClient.arm64 srtp_err.o
ar -d -sv libTwilioClient.i386 srtp_err.o
ar -d -sv libTwilioClient.x86_64 srtp_err.o

lipo libTwilioClient.arm64 libTwilioClient.armv7 libTwilioClient.armv7s libTwilioClient.i386 libTwilioClient.x86_64 -create -output libTwilioClient.a

###Wanted to combine ios device and simulator frameworks

lipo TwilioClientKit.device TwilioClientKit.simulator -create -output TwilioClientKit
581 changes: 581 additions & 0 deletions TwilioClientKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

118 changes: 118 additions & 0 deletions TwilioClientKit/Headers/TCConnection.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
//
// Copyright 2011-2014 Twilio. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the
// Twilio Terms of Service located at http://www.twilio.com/legal/tos
//

#import <Foundation/Foundation.h>

#import "TCConnectionDelegate.h"

/** TCConnectionState is an enum representing the current status of TCConnection.
*/
typedef enum
{
TCConnectionStatePending = 0, /**< An incoming TCConnection has not yet been accepted. */
TCConnectionStateConnecting, /**< An incoming TCConnection has been accepted, or an outgoing TCConnection is being established. */
TCConnectionStateConnected, /**< A connection has been established. */
TCConnectionStateDisconnected /**< An open connection has been disconnected. */
} TCConnectionState;


/** @name Incoming connection parameter capability keys */

/*
* These keys can retrieve values from the TCConnection.parameters dictionary for incoming connections.
* These are a subset of the values provided as a part of a Twilio Request to your Twilio application.
* Please visit http://www.twilio.com/docs/api/twiml/twilio_request for details on the specifics of the parameters.
*/
extern NSString* const TCConnectionIncomingParameterFromKey; /**< NSString representing the calling party. If the caller is a telephone, it will be in the E.164 format. If the caller is another Twilio Client, it will be in a URI format "client:name" */
extern NSString* const TCConnectionIncomingParameterToKey; /**< NSString representing the client name of the called party. This is in a URI format "client:name" */
extern NSString* const TCConnectionIncomingParameterAccountSIDKey; /**< NSString representing the account id making the incoming call */
extern NSString* const TCConnectionIncomingParameterAPIVersionKey; /**< NSString representing the version of the Twilio API used in the server application */
extern NSString* const TCConnectionIncomingParameterCallSIDKey DEPRECATED_ATTRIBUTE; /**< NSString representing a unique identifier for the incoming call */

// Included in both Incoming and Outgoing parameters dictionaries
extern NSString* const TCConnectionParameterCallSIDKey; /**< NSString representing a unique identifier for the incoming call */

// Outgoing parameters besides CallSid are completely up to application developers and thus there are no constants for them here.


/** 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:].
*/
@interface TCConnection : NSObject

/** Current status of the TCConnection.
*/
@property (nonatomic, readonly) TCConnectionState state;

/** BOOL representing if the TCConnection is an incoming or outgoing connection.
If the connection is incoming, the value is YES.
*/
@property (nonatomic, readonly, getter=isIncoming) BOOL incoming;

/** 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.
*/
@property (weak, nonatomic, readonly) NSDictionary* parameters;

/** The delegate object which will receive TCConnection events.
*/
@property (nonatomic, weak) id<TCConnectionDelegate> delegate;

/** Property that defines if the connection's microphone is muted.
Setting the property will only take effect if the connection's state is TCConnectionStateConnected.
*/
@property (nonatomic, getter=isMuted) BOOL muted;

/** 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.
@returns None
*/
-(void)accept;

/** 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.
@returns None
*/
-(void)ignore;

/** 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 not receive a -[TCConnectionDelegate connectionDidDisconnect:] message since there was no actual connection created.
@returns None
*/
-(void)reject;

/** 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.
@returns None
*/
-(void)disconnect;

/** 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.
@param 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.
@returns None
*/
-(void)sendDigits:(NSString*)digits;

@end
66 changes: 66 additions & 0 deletions TwilioClientKit/Headers/TCConnectionDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
//
// Copyright 2011-2014 Twilio. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the
// Twilio Terms of Service located at http://www.twilio.com/legal/tos
//

#import <Foundation/Foundation.h>

@class TCConnection;

/** TCConnectionDelegate is the delegate protocol for receiving TCConnection state-change notifications.
*/
@protocol TCConnectionDelegate<NSObject>

@required

/** The TCConnection has failed with an error.
After this selector has been called, it is safe to assume that the connection is no longer connected. When this occurs the TCConnection will be in the TCConnectionStateDisconnected state.
For a list of error codes and their meanings, see <a href="http://www.twilio.com/docs/client/errors" target="_blank">http://www.twilio.com/docs/client/errors</a>.
@param connection The TCConnection that encountered an error
@param error The NSError for the error encountered by TCConnection
@returns None
*/
-(void)connection:(TCConnection*)connection didFailWithError:(NSError*)error;


@optional


/** The TCConnection is in the process of trying to connect.
When this occurs, TCConnection is in the TCConnectionStateConnecting state.
@param connection The TCConnection that is in the process of trying to connect.
@returns None
*/
-(void)connectionDidStartConnecting:(TCConnection*)connection;

/** The TCConnection has successfully connected.
When this occurs, TCConnection is in the TCConnectionStateConnected state.
@param connection The TCConnection that has just connected.
@returns None
*/
-(void)connectionDidConnect:(TCConnection*)connection;

/** The TCConnection has just disconnected.
This will occur when the connection has been disconnected or ignored by any party. When this occurs the TCConnection will be in the TCConnectionStateDisconnected state.
@param connection The TCConnection has just disconnected.
@returns None
*/
-(void)connectionDidDisconnect:(TCConnection*)connection;

@end
151 changes: 151 additions & 0 deletions TwilioClientKit/Headers/TCDevice.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
//
// Copyright 2011-2014 Twilio. All rights reserved.
//
// Use of this software is subject to the terms and conditions of the
// Twilio Terms of Service located at http://www.twilio.com/legal/tos
//

#import <Foundation/Foundation.h>

#import "TCDeviceDelegate.h"
#import "TCConnectionDelegate.h"

/** TCDeviceState represents the various states of the device's ability to listen for incoming connections and make outgoing connections.
The TCDeviceDelegate gets notified of the state changes.
*/
typedef enum
{
TCDeviceStateOffline = 0, /**< TCDevice The device is not connected and cannot receive incoming connections or make outgoing connections. */
TCDeviceStateReady, /**< TCDevice can receive incoming connections and attempt outgoing connections if capabilities allow. */
TCDeviceStateBusy /**< TCDevice is connected to the network and has an active connection. No additional connections can be created or accepted. */
} TCDeviceState;

/** @name Device capability keys */

/*
* These keys can retrieve values from the TCDevice.capabilities dictionary.
* The values are extracted from the Capability Token that is used to initialize a TCDevice.
*/
extern NSString* const TCDeviceCapabilityIncomingKey; /**< NSNumber of BOOL that indicates whether the device can receive incoming calls. */
extern NSString* const TCDeviceCapabilityOutgoingKey; /**< NSNumber of BOOL that indicates whether the device can make outgoing calls. */
extern NSString* const TCDeviceCapabilityExpirationKey; /**< NSNumber of long long that represents the time the device's capability token expires (number of seconds relative to the UNIX epoch). */
extern NSString* const TCDeviceCapabilityAccountSIDKey; /**< NSString representing the account SID. */
extern NSString* const TCDeviceCapabilityApplicationSIDKey; /**< The application SID used when making an outgoing call. Only present if TCDeviceCapabilityOutgoingKey is also present with a YES value. */
extern NSString* const TCDeviceCapabilityApplicationParametersKey; /**< A non-modifiable NSDictionary of key/value pairs that will be passed to the Twilio Application when making an outgoing call. Only present if TCDeviceCapabilityOutgoingKey is also present with a YES value and the Capability Token contains application parameters. Additional parameters may be specified in the connect:delegate: method if needed. */
extern NSString* const TCDeviceCapabilityClientNameKey; /**< NSString representing the client name. */


@class TCConnection;

/** An instance of TCDevice is an object that knows how to interface with Twilio Services.
A TCDevice is the primary entry point for Twilio Client. An iOS application should initialize a TCDevice with the initWithCapabilityToken:delegate: method with a Capability Token to talk to Twilio services.
A Capability Token is a JSON Web Token (JWT) that specifies what the TCDevice may do with respect to the Twilio Application, such as whether it can make outgoing calls, how long the token and the TCDevice are valid before needing to be refreshed, and so on. Please visit http://www.twilio.com/docs/client/capability-tokens for more information.
@see TCDeviceDelegate
*/
@interface TCDevice : NSObject

/** Current status of the TCDevice.
State changes will cause relevant methods to be called in TCDeviceDelegate and will include any NSErrors that occur.
*/
@property (nonatomic, readonly) TCDeviceState state;


/** Current capabilities of the TCDevice. The keys are defined by the "Device capability keys" constants.
*/
@property (weak, nonatomic, readonly) NSDictionary* capabilities;


/** The delegate object which will receive events from a TCDevice object.
*/
@property (nonatomic, weak) id<TCDeviceDelegate> delegate;

/** A BOOL indicating if a sound should be played for an incoming connection.
The default value is YES. See the Twilio Client iOS Usage Guide for more information on sounds.
*/
@property (nonatomic) BOOL incomingSoundEnabled;

/** A BOOL indicating if a sound should be played for an outgoing connection.
The default value is YES. See the Twilio Client iOS Usage Guide for more information on sounds.
*/
@property (nonatomic) BOOL outgoingSoundEnabled;

/** A BOOL indicating if a sound should be played when a connection is disconnected for any reason.
The default value is YES. See the Twilio Client iOS Usage Guide for more information on sounds.
*/
@property (nonatomic) BOOL disconnectSoundEnabled;


/** Initialize a new TCDevice object. If the incoming capabilities are defined, then the device will automatically begin listening for incoming connections.
@param capabilityToken A signed JSON Web Token that defines the features available to the TCDevice. These may be created using the Twilio Helper Libraries included with the SDK or available at http://www.twilio.com . The capabilities are used to begin listening for incoming connections and provide the default parameters used for establishing outgoing connections. Please visit http://www.twilio.com/docs/client/capability-tokens for more information.
@param delegate The delegate object which will receive events from a TCDevice object.
@returns The initialized receiver
@see updateCapabilityToken:
*/
-(id)initWithCapabilityToken:(NSString*)capabilityToken delegate:(id<TCDeviceDelegate>)delegate;


/** Start TCDevice to listen for incoming connections.
The TCDevice will automatically listen for incoming connections on method calls to initWithCapabilityToken:delegate: or updateCapabilityToken: if the token allows.
This method only needs to be called if unlisten was previously called.
@returns None
*/
-(void)listen;


/** Stop the device from listening for incoming connections. This could be used for a "silence" mode on the your iOS application, for instance.
This method will do nothing if the TCDevice is currently not listening, either because of a previous call to unlisten or because the TCDevice has not been granted the incoming capability.
@returns None
*/
-(void)unlisten;


/** Update the capabilities of the TCDevice.
There may be circumstances when the defined capabilities have expired. For example, the TCDevice may enter the TCDeviceStateOffline state because the capabilities have expired. In these cases, the capabilities will need to be updated. If the device is currently listening for incoming connections, it will restart the listening process (if permitted) using these updated capabilities.
Existing connections are not affected by updating the capability token.
@param capabilityToken A signed JWT that defines the capability token available to the TCDevice. Please visit http://www.twilio.com/docs/client/capability-tokens for more information on capability tokens.
@return None
*/
-(void)updateCapabilityToken:(NSString*)capabilityToken;


/** Create an outgoing connection.
@param parameters An optional dictionary containing parameters for the outgoing connection that get passed to your Twilio Application. These parameters are merged with any parameters supplied in the Capability Token (e.g. the dictionary retrived with the TCDeviceCapabilityApplicationParametersKey against the capabilities property). If there are any key collisions with the two dictionaries, the value(s) from TCDeviceCapabilityApplicationParametersKey dictionary will take precedence. Parameters other than NSString are ignored.
@param delegate An optional delegate object to receive callbacks when state changes occur to the TCConnection object.
@returns A TCConnection object representing the new outgoing connection. If TCConnection is nil, the connection could not be initialized.
*/
-(TCConnection*)connect:(NSDictionary*)parameters delegate:(id<TCConnectionDelegate>)delegate;


/** Disconnect all current connections associated with the receiver.
This a convenience routine that disconnects all current incoming and outgoing connections, including pending incoming connections.
@returns None
*/
-(void)disconnectAll;

@end
Loading

0 comments on commit 9549c3a

Please sign in to comment.