Add ability to receive calls for iOS
BUG=2701 R=fischman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/7989005 Patch from Sajid Hussain <shussain@temasys.com.sg>. git-svn-id: http://webrtc.googlecode.com/svn/trunk@5518 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
1
AUTHORS
1
AUTHORS
@@ -20,3 +20,4 @@ MIPS Technologies
|
|||||||
Mozilla Foundation
|
Mozilla Foundation
|
||||||
Opera Software ASA
|
Opera Software ASA
|
||||||
Vonage Holdings Corp.
|
Vonage Holdings Corp.
|
||||||
|
Temasys Communications
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
@property(nonatomic, assign) id<ICEServerDelegate> ICEServerDelegate;
|
@property(nonatomic, assign) id<ICEServerDelegate> ICEServerDelegate;
|
||||||
@property(nonatomic, assign) id<GAEMessageHandler> messageHandler;
|
@property(nonatomic, assign) id<GAEMessageHandler> messageHandler;
|
||||||
|
@property(nonatomic, assign) BOOL initiator;
|
||||||
|
|
||||||
- (void)connectToRoom:(NSURL *)room;
|
- (void)connectToRoom:(NSURL *)room;
|
||||||
- (void)sendData:(NSData *)data;
|
- (void)sendData:(NSData *)data;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
@synthesize sendQueue = _sendQueue;
|
@synthesize sendQueue = _sendQueue;
|
||||||
@synthesize token = _token;
|
@synthesize token = _token;
|
||||||
@synthesize verboseLogging = _verboseLogging;
|
@synthesize verboseLogging = _verboseLogging;
|
||||||
|
@synthesize initiator = _initiator;
|
||||||
|
|
||||||
- (id)init {
|
- (id)init {
|
||||||
if (self = [super init]) {
|
if (self = [super init]) {
|
||||||
@@ -272,6 +273,7 @@
|
|||||||
[self maybeLogMessage:
|
[self maybeLogMessage:
|
||||||
[NSString stringWithFormat:@"Base URL: %@", self.baseURL]];
|
[NSString stringWithFormat:@"Base URL: %@", self.baseURL]];
|
||||||
|
|
||||||
|
self.initiator = [[self findVar:@"initiator" strippingQuotes:NO] boolValue];
|
||||||
self.token = [self findVar:@"channelToken" strippingQuotes:YES];
|
self.token = [self findVar:@"channelToken" strippingQuotes:YES];
|
||||||
if (!self.token)
|
if (!self.token)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -229,6 +229,10 @@
|
|||||||
#pragma mark - GAEMessageHandler methods
|
#pragma mark - GAEMessageHandler methods
|
||||||
|
|
||||||
- (void)onOpen {
|
- (void)onOpen {
|
||||||
|
if (!self.client.initiator) {
|
||||||
|
[self displayLogMessage:@"Callee; waiting for remote offer"];
|
||||||
|
return;
|
||||||
|
}
|
||||||
[self displayLogMessage:@"GAE onOpen - create offer."];
|
[self displayLogMessage:@"GAE onOpen - create offer."];
|
||||||
RTCPair *audio =
|
RTCPair *audio =
|
||||||
[[RTCPair alloc] initWithKey:@"OfferToReceiveAudio" value:@"true"];
|
[[RTCPair alloc] initWithKey:@"OfferToReceiveAudio" value:@"true"];
|
||||||
@@ -400,10 +404,34 @@
|
|||||||
|
|
||||||
[self displayLogMessage:@"SDP onSuccess() - possibly drain candidates"];
|
[self displayLogMessage:@"SDP onSuccess() - possibly drain candidates"];
|
||||||
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
||||||
// TODO(hughv): Handle non-initiator case. http://s10/46622051
|
if (!self.client.initiator) {
|
||||||
if (self.peerConnection.remoteDescription) {
|
if (self.peerConnection.remoteDescription
|
||||||
[self displayLogMessage:@"SDP onSuccess - drain candidates"];
|
&& !self.peerConnection.localDescription) {
|
||||||
[self drainRemoteCandidates];
|
[self displayLogMessage:@"Callee, setRemoteDescription succeeded"];
|
||||||
|
RTCPair *audio =
|
||||||
|
[[RTCPair alloc]
|
||||||
|
initWithKey:@"OfferToReceiveAudio" value:@"true"];
|
||||||
|
// TODO(hughv): Add video.
|
||||||
|
// RTCPair *video =
|
||||||
|
// [[RTCPair alloc]
|
||||||
|
// initWithKey:@"OfferToReceiveVideo" value:@"true"];
|
||||||
|
NSArray *mandatory = @[ audio /*, video*/ ];
|
||||||
|
RTCMediaConstraints *constraints =
|
||||||
|
[[RTCMediaConstraints alloc]
|
||||||
|
initWithMandatoryConstraints:mandatory
|
||||||
|
optionalConstraints:nil];
|
||||||
|
[self.peerConnection
|
||||||
|
createAnswerWithDelegate:self constraints:constraints];
|
||||||
|
[self displayLogMessage:@"PC - createAnswer."];
|
||||||
|
} else {
|
||||||
|
[self displayLogMessage:@"SDP onSuccess - drain candidates"];
|
||||||
|
[self drainRemoteCandidates];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (self.peerConnection.remoteDescription) {
|
||||||
|
[self displayLogMessage:@"SDP onSuccess - drain candidates"];
|
||||||
|
[self drainRemoteCandidates];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user