Advertisement
Guest User

Untitled

a guest
Dec 17th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.66 KB | None | 0 0
  1. #import <Foundation/Foundation.h>
  2.  
  3. #import "ACBView.h"
  4. #import "ACBMediaDirection.h"
  5.  
  6. /**
  7. Call status changes: they can only increase the value.
  8.  
  9. Outgoing calls and incoming OFFER_REQUESTs:
  10. Setup --> MediaOpened (not notified to user) --> Connecting (not notified to user) --> MediaPending --> (Ringing) -->InCall -->Ended
  11.  
  12. Incoming calls:
  13. Setup --> Alerting --> (not "Connecting") -- > MediaPending --> InCall --> Ended
  14.  
  15. Beware: these values are in order of progress, so that it is possible to check that the status is somewhere between a min and a max (e.g. Setup and InCall).
  16. */
  17. typedef enum
  18. {
  19. /** Indicates the call is in a process of being setup. */
  20. ACBClientCallStatusSetup,
  21. /** Indicates the call is ringing/alerting locally - incoming call. */
  22. ACBClientCallStatusAlerting,
  23. /** Indicates the call is ringing on the remote side - outgoing call. */
  24. ACBClientCallStatusRinging,
  25. /** Indicates the call is connected and we're waiting for media streams to establish. */
  26. ACBClientCallStatusMediaPending,
  27. /** Indicates the call is in progress including media. */
  28. ACBClientCallStatusInCall,
  29. /** Indicates the dialled operation timed out. */
  30. ACBClientCallStatusTimedOut,
  31. /** Indicates the dialled number is busy. */
  32. ACBClientCallStatusBusy,
  33. /** Indicates the dialled number was unreachable. */
  34. ACBClientCallStatusNotFound,
  35. /** Indicates the call has errored. */
  36. ACBClientCallStatusError,
  37. /** Indicates the call has ended. */
  38. ACBClientCallStatusEnded
  39. }
  40. ACBClientCallStatus;
  41.  
  42. typedef enum
  43. {
  44. /** Indicates that a general error has occurred when making an outgoing call. */
  45. ACBClientCallErrorDialFailure,
  46. /** Indicates that an attempt to make an outbound call failed because a call is already in progress. */
  47. ACBClientCallErrorDialFailureCallInProgress,
  48. /** Indicates that a general error has occurred with an established call. */
  49. ACBClientCallErrorCallFailure,
  50. /** Indicates that the call was in the wrong state when an answer has been received. */
  51. ACBClientCallErrorWrongStateWhenAnswerReceived,
  52. /** Indicates that a session description could not be created. */
  53. ACBClientCallErrorSessionDescriptionCreationError,
  54. }
  55. ACBClientCallErrorCode;
  56.  
  57.  
  58. @class ACBClientCall;
  59.  
  60. /**
  61. The call's delegate.
  62. */
  63. @protocol ACBClientCallDelegate <NSObject>
  64.  
  65. @required
  66.  
  67. /**
  68. A callback notification indicating that a new SDP offer has been received and has switched on or off audio
  69. and/or video streaming. The callback is not optional, as further action is required when audio or video are
  70. re-enabled, i.e. deciding whether to un-mute them, as they are automatically kept muted by the API.
  71.  
  72. @param call The call that received the media change.
  73. */
  74. - (void) callDidReceiveMediaChangeRequest:(ACBClientCall*)call;
  75.  
  76. /**
  77. A callback notification indicates the call has changed state.
  78.  
  79. @param call The call
  80. @param status The status of the call
  81. */
  82. - (void) call:(ACBClientCall*)call didChangeStatus:(ACBClientCallStatus)status;
  83.  
  84.  
  85. @optional
  86.  
  87. /**
  88. Callback indicating that an outgoing call failed to dial.
  89.  
  90. @param call The call that received the error.
  91. @param message A descriptive message for the error.
  92. */
  93. - (void) call:(ACBClientCall*)call didReceiveDialFailure:(NSString *)message __deprecated;
  94.  
  95. /**
  96. Callback indicating that that an established call is reporting an error.
  97.  
  98. @param call The call that received the error.
  99. @param message A descriptive message for the error.
  100. */
  101. - (void) call:(ACBClientCall*)call didReceiveCallFailure:(NSString *)message __deprecated;
  102.  
  103. /**
  104. Callback indicating that an outgoing call failed to dial.
  105.  
  106. @param call The call that received the error.
  107. @param error The error that has occurred. The 'code' property of this NSError will be set to
  108. an ACBClientCallErrorCode to indicate the nature of the problem.
  109. */
  110. - (void) call:(ACBClientCall*)call didReceiveDialFailureWithError:(NSError*)error;
  111.  
  112. /**
  113. Callback indicating that that an established call is reporting an error.
  114.  
  115. @param call The call that received the error.
  116. @param error The error that has occurred.
  117. */
  118. - (void) call:(ACBClientCall*)call didReceiveCallFailureWithError:(NSError*)error;
  119.  
  120. /**
  121. Callback indicating that the established call is being interrupted.
  122.  
  123. @param call The call that received the interruption.
  124. @param message A descriptive message of the cause of the interruption.
  125. */
  126. - (void) call:(ACBClientCall*)call didReceiveSessionInterruption:(NSString *)message;
  127.  
  128. /**
  129. Callback indicating that the application did not have permission to record the media required for the call.
  130.  
  131. @param message A descriptive message for the error.
  132. */
  133. - (void) call:(ACBClientCall*)call didReceiveCallRecordingPermissionFailure:(NSString *)message;
  134.  
  135. /**
  136. A callback notification indicates the remote party display name has changed.
  137.  
  138. @param call The call
  139. @param name Remote display name
  140. */
  141. - (void) call:(ACBClientCall*)call didChangeRemoteDisplayName:(NSString*)name;
  142.  
  143. /**
  144. A callback notification indicating that the local media stream was added.
  145.  
  146. @param call The call
  147. */
  148. - (void) callDidAddLocalMediaStream:(ACBClientCall *)call;
  149.  
  150. /**
  151. A callback notification indicating that the remote media stream was added.
  152.  
  153. @param call The call
  154. */
  155. - (void) callDidAddRemoteMediaStream:(ACBClientCall *)call;
  156.  
  157. /**
  158. A callback notification indicating that a new SDP offer has been received and will switch on or off audio
  159. and/or video streaming. The callback is optional, as no action is required when audio or video are
  160. still to be re-enabled; here the application has the chance to check the status of audio and video before the change
  161.  
  162. @param call The call that will receive the media change.
  163. */
  164. - (void) callWillReceiveMediaChangeRequest:(ACBClientCall*)call;
  165.  
  166. /**
  167. A callback notification to indicate that the current perceived quality of the incoming streams has changed.
  168.  
  169. @param call The call.
  170. @param inboundQuality The quality of the stream between 0 and 100, where 100 is best quality.
  171. */
  172. - (void) call:(ACBClientCall*)call didReportInboundQualityChange:(NSUInteger)inboundQuality;
  173.  
  174. @end
  175.  
  176. /**
  177. An object that represents a voice and/or video call.
  178. */
  179. @interface ACBClientCall : NSObject
  180.  
  181. /** The delegate. */
  182. @property (weak) id<ACBClientCallDelegate> delegate;
  183. /** The call status. */
  184. @property (readonly) ACBClientCallStatus status;
  185. /** The remote address of the call. */
  186. @property (nonatomic, readonly) NSString *remoteAddress;
  187. /** The remote party's display name */
  188. @property (nonatomic, readonly) NSString *remoteDisplayName;
  189. /** The UIView for displaying the video streaming */
  190. @property (strong) ACBView* videoView;
  191. /** YES if the remote party SDP has audio */
  192. @property (readonly) BOOL hasRemoteAudio;
  193. /** YES if the remote party SDP has video */
  194. @property (readonly) BOOL hasRemoteVideo;
  195. /** custom call information... subject ot change */
  196. @property (readonly) NSDictionary *information;
  197.  
  198. /**
  199. Deprecated; please use [answerWithAudio:andVideo:] instead.
  200.  
  201. @param audio Whether to use audio.
  202. @param video Whether to use video.
  203. */
  204. - (void) answerWithAudio:(BOOL)audio video:(BOOL)video __deprecated_msg("Use ACBMediaDirection for audio and video parameters.");
  205.  
  206. /**
  207. Answers an incoming call.
  208.  
  209. Note that the SDK only supports one call at a time. If you answer an incoming call
  210. whilst another is in progress, then that other call will be terminated.
  211.  
  212. @param audio The required audio direction for the answered call.
  213. @param video The required video direction for the answered call.
  214. */
  215. - (void) answerWithAudio:(ACBMediaDirection)audioDir andVideo:(ACBMediaDirection)videoDir;
  216.  
  217. /**
  218. Enables or disables local streams.
  219.  
  220. @param isAudioEnabled Whether local audio should be enabled.
  221. */
  222. - (void) enableLocalAudio:(BOOL)isAudioEnabled;
  223.  
  224. /**
  225. Enables or disables local streams.
  226.  
  227. @param isVideoEnabled Whether local video should be enabled.
  228. */
  229. - (void) enableLocalVideo:(BOOL)isVideoEnabled;
  230.  
  231. /**
  232. Plays DTMF tones
  233.  
  234. Use this method to send DTMF on an active call. Valid codes are 0-9, #, *, A, B, C and D.
  235.  
  236. @param code The DTMF tone(s) to play.
  237. @param localPlayback Whether the tone sound should be echoed back to the user.
  238. */
  239. - (void) playDTMFCode:(NSString*)code localPlayback:(BOOL)localPlayback;
  240.  
  241. /**
  242. Terminates a call
  243.  
  244. Call this method to end a call.
  245. */
  246. - (void) end;
  247.  
  248. /**
  249. Holds the call
  250.  
  251. In order to place a call on hold, call this method once the call has a status of ACBClientCallStatusInCall.
  252. */
  253. - (void) hold;
  254.  
  255. /**
  256. Resumes the held call
  257.  
  258. After a call has been placed on hold, use this method to resume the call.
  259. */
  260. - (void) resume;
  261.  
  262. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement