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:
parent
7686f0ddda
commit
82387e4608
1
AUTHORS
1
AUTHORS
@ -20,3 +20,4 @@ MIPS Technologies
|
||||
Mozilla Foundation
|
||||
Opera Software ASA
|
||||
Vonage Holdings Corp.
|
||||
Temasys Communications
|
||||
|
@ -47,6 +47,7 @@
|
||||
|
||||
@property(nonatomic, assign) id<ICEServerDelegate> ICEServerDelegate;
|
||||
@property(nonatomic, assign) id<GAEMessageHandler> messageHandler;
|
||||
@property(nonatomic, assign) BOOL initiator;
|
||||
|
||||
- (void)connectToRoom:(NSURL *)room;
|
||||
- (void)sendData:(NSData *)data;
|
||||
|
@ -61,6 +61,7 @@
|
||||
@synthesize sendQueue = _sendQueue;
|
||||
@synthesize token = _token;
|
||||
@synthesize verboseLogging = _verboseLogging;
|
||||
@synthesize initiator = _initiator;
|
||||
|
||||
- (id)init {
|
||||
if (self = [super init]) {
|
||||
@ -272,6 +273,7 @@
|
||||
[self maybeLogMessage:
|
||||
[NSString stringWithFormat:@"Base URL: %@", self.baseURL]];
|
||||
|
||||
self.initiator = [[self findVar:@"initiator" strippingQuotes:NO] boolValue];
|
||||
self.token = [self findVar:@"channelToken" strippingQuotes:YES];
|
||||
if (!self.token)
|
||||
return;
|
||||
|
@ -229,6 +229,10 @@
|
||||
#pragma mark - GAEMessageHandler methods
|
||||
|
||||
- (void)onOpen {
|
||||
if (!self.client.initiator) {
|
||||
[self displayLogMessage:@"Callee; waiting for remote offer"];
|
||||
return;
|
||||
}
|
||||
[self displayLogMessage:@"GAE onOpen - create offer."];
|
||||
RTCPair *audio =
|
||||
[[RTCPair alloc] initWithKey:@"OfferToReceiveAudio" value:@"true"];
|
||||
@ -400,10 +404,34 @@
|
||||
|
||||
[self displayLogMessage:@"SDP onSuccess() - possibly drain candidates"];
|
||||
dispatch_async(dispatch_get_main_queue(), ^(void) {
|
||||
// TODO(hughv): Handle non-initiator case. http://s10/46622051
|
||||
if (self.peerConnection.remoteDescription) {
|
||||
[self displayLogMessage:@"SDP onSuccess - drain candidates"];
|
||||
[self drainRemoteCandidates];
|
||||
if (!self.client.initiator) {
|
||||
if (self.peerConnection.remoteDescription
|
||||
&& !self.peerConnection.localDescription) {
|
||||
[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];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user