Jabber Guest iOS SDK
CJGuestCall.h
1 //
2 // CJGuestCall.h
3 // JabberGuest
4 //
5 // Copyright (c) 2013 Cisco Systems, Inc. All Rights Reserved.
6 //
7 
8 #import <Foundation/Foundation.h>
9 #import <UIKit/UIKit.h>
10 
11 #import <JabberGuest/CJGuestMediaStatistics.h>
12 #import <JabberGuest/CJGuestVideoLicense.h>
13 
19 @protocol CJGuestInvalidCertCallback <NSObject>
23 - (void)accept;
27 - (void)reject;
28 @end
29 
34 @protocol CJGuestInvalidCertDelegate <NSObject>
35 @optional
47 - (void) onInvalidCert:(NSString*)certFingerprint
48  certSubjectCN:(NSString*)certSubjectCN
49  referenceID:(NSString*)referenceID
50  invalidReason:(NSArray*)invalidReason
51 subjectCertificateData:(NSString*)subjectCertificateData
52 intermediateCACertificateData:(NSArray*)intermediateCACertificateData
53  invalidCertCallback:(id <CJGuestInvalidCertCallback>)invalidCertCallback;
54 @end
55 
56 #pragma mark Notifications
57 
65 extern NSString *const CJGuestCallStateChangeNotification;
71 extern NSString *const CJGuestCallErrorNotification;
76 extern NSString *const CJGuestCallErrorKey;
81 extern NSString *const CJGuestCallSelfVideoResolutionNotification;
106 extern NSString *const CJGuestCallAudioInStateNotification;
111 extern NSString *const CJGuestCallAudioOutStateNotification;
116 extern NSString *const CJGuestCallVideoInStateNotification;
121 extern NSString *const CJGuestCallVideoOutStateNotification;
126 extern NSString *const CJGuestCallOrientationNotification;
131 extern NSString *const CJGuestCallSentDTMFNotification;
135 extern NSString *const CJGuestCallCameraSwitchedNotification;
139 extern NSString *const CJGuestCallServerVersionNotification;
140 
145 #pragma mark Errors
146 
153 typedef NS_ENUM(NSInteger, CJGuestErrorCode) {
231  /*
232  * The version of the API reported by the Jabber Guest server was invalid.
233  */
234  CJGuestInvalidApiVersionError,
235  /*
236  * The version of the API reported by the Jabber Guest server is not supported with this version of the SDK.
237  */
238  CJGuestUnsupportedApiVersionError
239 };
245 @class CJGuestCall;
246 
259 @interface CJGuestCall : NSObject
260 
271 - (id)init;
272 
273 
281 - (id)initWithServerName:(NSString *)serverName toURI:(NSString *)toURI;
282 
294 @property (nonatomic, readwrite, strong) NSString *serverName;
302 @property (nonatomic, readwrite, strong) NSString *toURI;
303 
316 @property (nonatomic, readwrite, strong) IBOutlet UIImageView * selfView;
317 
321 @property (nonatomic, readonly) CGSize selfSize;
322 
326 @property (nonatomic, readwrite, strong) IBOutlet UIImageView * remoteView;
327 
331 @property (nonatomic, readonly) CGSize remoteSize;
332 
336 @property (nonatomic, readwrite, strong) IBOutlet UIImageView * remotePresoView;
337 
341 @property (nonatomic, readonly) CGSize remotePresoSize;
342 
346 @property (nonatomic, readonly) BOOL remotePresoActive;
347 
351 @property (nonatomic, readonly) BOOL remotePresoStarted;
352 
357 @property (nonatomic, readwrite) UIDeviceOrientation captureOrientation;
358 
359 #if 0
360 
365 - (BOOL)startSelfView;
366 #endif
367 
373 - (void)startSelfView:(CJGuestVideoLicenseCompletion) completion;
374 
379 - (void)stopSelfView;
380 
384 - (void)switchCamera;
385 
395 #if 0
396 
401 - (BOOL)startCall;
402 #endif
403 
409 - (void)startCall:(CJGuestVideoLicenseCompletion) completion;
410 
416 - (void)endCall;
417 
430 typedef NS_ENUM(NSInteger, CJGuestCallStateType) {
435 
441 
450 
457 
465 };
469 @property (nonatomic, readonly) CJGuestCallStateType callState;
470 
483 typedef NS_ENUM(NSInteger, CJGuestMuteStateType) {
488 
494 
499 
504 };
505 
509 @property (nonatomic, readonly) CJGuestMuteStateType audioOutState;
513 @property (nonatomic, readonly) CJGuestMuteStateType videoOutState;
517 @property (nonatomic, readonly) CJGuestMuteStateType audioInState;
521 @property (nonatomic, readonly) CJGuestMuteStateType videoInState;
522 
523 
528 @property (nonatomic, readonly, getter = isAudioOutMuted) BOOL audioOutMuted;
533 @property (nonatomic, readonly, getter = isAudioOutUnmuted) BOOL audioOutUnmuted;
538 @property (nonatomic, readonly, getter = isAudioInMuted) BOOL audioInMuted;
543 @property (nonatomic, readonly, getter = isAudioInUnmuted) BOOL audioInUnmuted;
548 @property (nonatomic, readonly, getter = isVideoOutMuted) BOOL videoOutMuted;
553 @property (nonatomic, readonly, getter = isVideoOutUnmuted) BOOL videoOutUnmuted;
558 @property (nonatomic, readonly, getter = isVideoInMuted) BOOL videoInMuted;
563 @property (nonatomic, readonly, getter = isVideoInUnmuted) BOOL videoInUnmuted;
564 
570 - (void)muteAudioOut;
571 
577 - (void)unmuteAudioOut;
578 
584 - (void)muteVideoOut;
585 
591 - (void)unmuteVideoOut;
592 
604 @property (nonatomic, readonly) NSString *sentDTMF;
605 
611 - (void)sendDTMF:(char)dtmf;
612 
620 - (void)sendDTMFString:(NSString *)dtmfString;
621 
635 @property (nonatomic, readwrite, weak) IBOutlet id <CJGuestInvalidCertDelegate> invalidCertDelegate;
636 
640 @property (nonatomic, readonly, getter = isReady) BOOL ready DEPRECATED_ATTRIBUTE;
641 
645 @property (nonatomic, readonly, weak) CJGuestAudioStatistics * audioStatistics;
646 
650 @property (nonatomic, readonly, weak) CJGuestVideoStatistics * videoStatistics;
651 
656 @property (nonatomic, readonly, weak) NSString * htmlCallStatistics;
657 
658 
668 - (void)audioSetActive:(BOOL) active;
669 
670 
675 typedef NS_ENUM(NSInteger, CJGuestNetworkStatus) {
676  CJGuestNetworkStatus_Unknown,
677  CJGuestNetworkStatus_Online,
678  CJGuestNetworkStatus_Changed,
679  CJGuestNetworkStatus_Offline
680 };
681 
687 - (void)updateNetworkStatus:(CJGuestNetworkStatus) networkStatus;
688 
698 
705 + (NSDictionary *)parseQueryString:(NSString *)query;
706 
711 + (NSArray * )getAllLogs;
712 
719 + (NSString*)stringFromCallState:(CJGuestCallStateType)state;
720 
727 + (NSString*)stringFromMuteState:(CJGuestMuteStateType)state;
728 
729 @end
The destination was busy.
Definition: CJGuestCall.h:193
CJGuestMuteStateType audioInState
Represents the mute state of the audio being received by the local end point.
Definition: CJGuestCall.h:517
CJGuestVideoStatistics * videoStatistics
Provides access to the video stream statistics.
Definition: CJGuestCall.h:650
CJGuestMuteStateType audioOutState
Represents the mute state of the audio being sent to the remote end point.
Definition: CJGuestCall.h:509
CJGuestMuteStateType
Muting or unmuting a media stream requires some coordination between resources, so the state of the m...
Definition: CJGuestCall.h:483
NSString *const CJGuestCallErrorKey
The key for the value in the userInfo dictionary of the NSNotification received from the CJGuestCallE...
Definition: CJGuestCall.mm:64
An http error.
Definition: CJGuestCall.h:221
The ICE negotiation failed.
Definition: CJGuestCall.h:185
The Jabber Guest server encountered a SIP error.
Definition: CJGuestCall.h:157
An undefined error.
Definition: CJGuestCall.h:230
BOOL videoOutUnmuted
Convenience property for determining whether the video output is unmuted.
Definition: CJGuestCall.h:553
BOOL remotePresoActive
The active state of the remotePreso video stream.
Definition: CJGuestCall.h:346
The URI was invalid.
Definition: CJGuestCall.h:165
void muteVideoOut()
Start the process of muting the video output.
Definition: CJGuestCall.mm:906
The media gateway is not defined.
Definition: CJGuestCall.h:177
The URI was not found.
Definition: CJGuestCall.h:205
The server was busy and could no resource allocation failed.
Definition: CJGuestCall.h:181
void endCall()
After calling startCall() to establish the call with the remote endpoint, call this method to end the...
Definition: CJGuestCall.mm:874
void accept()
The delegate calls this to accept the invalid certificate.
This class holds parameters specific to the audio stream of the call.
Definition: CJGuestMediaStatistics.m:64
An invalid call state.
Definition: CJGuestCall.h:197
There was a network error.
Definition: CJGuestCall.h:226
BOOL videoInUnmuted
Convenience property for determining whether the video input is unmuted.
Definition: CJGuestCall.h:563
CJGuestCall * sharedInstance()
This method returns the active call instance.
Definition: CJGuestCall.mm:324
CJGuestCall is not communicating with any remote endpoints and is ready to establish a new communicat...
Definition: CJGuestCall.h:440
The URI was invalid.
Definition: CJGuestCall.h:173
CJGuestCallStateType
This identifies the progress of the call as the call is established with the remote endpoint...
Definition: CJGuestCall.h:430
BOOL audioInMuted
Convenience property for determining whether the audio input is muted.
Definition: CJGuestCall.h:538
A TURN error.
Definition: CJGuestCall.h:201
CGSize selfSize
The size of the self view video image.
Definition: CJGuestCall.h:321
The media stream is muted, no media is passing.
Definition: CJGuestCall.h:487
The URI is not active.
Definition: CJGuestCall.h:209
void stopSelfView()
This will stop capturing video from the local capture device and sending the video to the selfView if...
Definition: CJGuestCall.mm:674
NSString *const CJGuestCallSentDTMFNotification
Register for this event to be notified when a DTMF is sent to the remote endpoint.
Definition: CJGuestCall.mm:61
NSString *const CJGuestCallAudioOutStateNotification
Register for this event to be notified when the audio output mute state changes.
Definition: CJGuestCall.mm:56
NSString *const CJGuestCallErrorNotification
Register for this event to be notified when an error occurs during call processing.
Definition: CJGuestCall.mm:49
UIDeviceOrientation captureOrientation
Indicates the orientation of the device so the video capture can compensate and send the video in the...
Definition: CJGuestCall.h:357
void unmuteAudioOut()
Start the process of unmuting the audio output.
Definition: CJGuestCall.mm:902
This protocol provides a notification if any of the HTTP requests performed by CJGuestCall encounter ...
Definition: CJGuestCall.h:34
BOOL ready DEPRECATED_ATTRIBUTE
Indicates the call is ready and active (it is not disconnected).
Definition: CJGuestCall.h:640
NSString * htmlCallStatistics
Provides an HTML formatted view of the audio and video statistics for display in a web view...
Definition: CJGuestCall.h:656
The media stream is unmuted, media is passing.
Definition: CJGuestCall.h:498
CJGuestCall has not been initialized with a valid server name.
Definition: CJGuestCall.h:434
NSString * serverName
The server name through which we will establish this call.
Definition: CJGuestCall.h:294
This class holds parameters specific to the video stream of the call.
Definition: CJGuestMediaStatistics.h:118
CJGuestCall instance is currently connected to the called party from the URI that it was given...
Definition: CJGuestCall.h:456
CJGuestMuteStateType videoOutState
Represents the mute state of the video being sent to the remote end point.
Definition: CJGuestCall.h:513
NSArray * getAllLogs()
Returns an array of file names corresponding to the log files that exist on the device.
Definition: CJGuestCall.mm:334
CJGuestErrorCode
The error codes for the Jabber Guest Error Domain.
Definition: CJGuestCall.h:153
NSString *const CJGuestCallRemotePresoVideoStartedNotification
Register for this event to be notified when the first frame of the remotePreso video is received...
Definition: CJGuestCall.mm:54
An object implementing this protocol is passed to the CJGuestInvalidCertDelegate. ...
Definition: CJGuestCall.h:19
void switchCamera()
Cycle the local capture device to the next available one.
Definition: CJGuestCall.mm:881
The media stream is transitioning to the muted state and may be passing media.
Definition: CJGuestCall.h:503
id init()
Initializes an instance of CJGuestCall.
Definition: CJGuestCall.mm:355
NSString *const CJGuestCallStateChangeNotification
Register for this event to be notified when the call state changes.
Definition: CJGuestCall.mm:48
NSString * sentDTMF
Provides a string representation of the last DTMF digit sent.
Definition: CJGuestCall.h:604
The media stream is transitioning to the unmuted state and may not be passing media.
Definition: CJGuestCall.h:493
BOOL audioOutUnmuted
Convenience property for determining whether the audio output is unmuted.
Definition: CJGuestCall.h:533
There Jabber Guest server encountered an exception.
Definition: CJGuestCall.h:161
BOOL audioOutMuted
Convenience property for determining whether the audio output is muted.
Definition: CJGuestCall.h:528
NSString *const CJGuestCallServerVersionNotification
Register for this event to be notified of the server version.
Definition: CJGuestCall.mm:62
CGSize remoteSize
The size of the remote video image.
Definition: CJGuestCall.h:331
NSString *const CJGuestCallRemotePresoVideoActiveNotification
Register for this event to be notified when the active state of the remotePreso view video changes...
Definition: CJGuestCall.mm:53
BOOL videoOutMuted
Convenience property for determining whether the video output is muted.
Definition: CJGuestCall.h:548
NSString *const CJGuestCallVideoInStateNotification
Register for this event to be notified when the video input mute state changes.
Definition: CJGuestCall.mm:57
NSString *const CJGuestCallOrientationNotification
Register for this event to be notified when the orientation of the remote view video changes...
Definition: CJGuestCall.mm:59
NSString *const CJGuestCallRemotePresoVideoResolutionNotification
Register for this event to be notified when the size of the remotePreso view video changes...
Definition: CJGuestCall.mm:52
BOOL videoInMuted
Convenience property for determining whether the video input is muted.
Definition: CJGuestCall.h:558
NSString *const CJGuestCallVideoOutStateNotification
Register for this event to be notified when the video output mute state changes.
Definition: CJGuestCall.mm:58
CJGuestCallStateType callState
Indicates the current state of the call.
Definition: CJGuestCall.h:469
IBOutlet UIImageView * selfView
The selfView will be updated with video from the camera on the device, providing feedback so the user...
Definition: CJGuestCall.h:316
The URI has been disabled.
Definition: CJGuestCall.h:217
NSString *const CJGuestCallCameraSwitchedNotification
Register for this event to be notified when the video capture device is changed.
Definition: CJGuestCall.mm:60
NSString *const CJGuestCallAudioInStateNotification
Register for this event to be notified when the audio input mute state changes.
Definition: CJGuestCall.mm:55
NSString * toURI
The URI of the remote end point to which the call should be established.
Definition: CJGuestCall.h:302
CJGuestAudioStatistics * audioStatistics
Provides access to the audio stream statistics.
Definition: CJGuestCall.h:645
void muteAudioOut()
Start the process of muting the audio output.
Definition: CJGuestCall.mm:898
IBOutlet UIImageView * remotePresoView
This will be updated with video sent from the remotePreso endpoint of the call.
Definition: CJGuestCall.h:336
The URI has expired.
Definition: CJGuestCall.h:213
NSString *const CJGuestCallRemoteVideoResolutionNotification
Register for this event to be notified when the size of the remote view video changes.
Definition: CJGuestCall.mm:51
NSString *const CJGuestCallSelfVideoResolutionNotification
Register for this event to be notified when the size of the self view video changes.
Definition: CJGuestCall.mm:50
IBOutlet id< CJGuestInvalidCertDelegate > invalidCertDelegate
This delegate is called when HTTP requests encounter problems verifying the certificate for a web sit...
Definition: CJGuestCall.h:635
There was a networking error between the device and the server.
Definition: CJGuestCall.h:169
CJGuestMuteStateType videoInState
Represents the mute state of the video being received by the local end point.
Definition: CJGuestCall.h:521
CJGuestCall is trying to connect a call to the called party from the URI that it was given...
Definition: CJGuestCall.h:449
CJGuestCall instance is either attempting to end an active call at the request of the device user...
Definition: CJGuestCall.h:464
BOOL remotePresoStarted
The active state of the remotePreso video stream.
Definition: CJGuestCall.h:351
This is the main class of the Jabber Guest iOS SDK.
Definition: CJGuestCall.mm:314
IBOutlet UIImageView * remoteView
This will be updated with video sent from the remote endpoint of the call.
Definition: CJGuestCall.h:326
BOOL audioInUnmuted
Convenience property for determining whether the audio input is unmuted.
Definition: CJGuestCall.h:543
There was an error in the SIP configuration.
Definition: CJGuestCall.h:189
CGSize remotePresoSize
The size of the remotePreso video image.
Definition: CJGuestCall.h:341
void reject()
The delegate calls this to reject the invalid certificate.
void unmuteVideoOut()
Start the process of unmuting the video output.
Definition: CJGuestCall.mm:910