|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #pragma once |
|
6 |
|
7 #include "CC_Common.h" |
|
8 #include "ECC_Types.h" |
|
9 #include "mozilla/RefPtr.h" |
|
10 |
|
11 extern "C" |
|
12 { |
|
13 #include "ccapi_types.h" |
|
14 } |
|
15 |
|
16 #if defined(__cplusplus) && __cplusplus >= 201103L |
|
17 typedef struct Timecard Timecard; |
|
18 #else |
|
19 #include "timecard.h" |
|
20 #endif |
|
21 |
|
22 namespace CSF |
|
23 { |
|
24 class ECC_API CC_Call |
|
25 { |
|
26 public: |
|
27 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CC_Call) |
|
28 |
|
29 protected: |
|
30 CC_Call () { } |
|
31 |
|
32 public: |
|
33 virtual ~CC_Call () {} |
|
34 |
|
35 virtual void setRemoteWindow (VideoWindowHandle window) = 0; |
|
36 |
|
37 virtual int setExternalRenderer(VideoFormat videoFormat, ExternalRendererHandle renderer) = 0; |
|
38 |
|
39 virtual void sendIFrame () = 0; |
|
40 |
|
41 virtual CC_CallInfoPtr getCallInfo () = 0; |
|
42 |
|
43 virtual std::string toString() = 0; |
|
44 |
|
45 /** |
|
46 Originate call - API to go offhook and dial specified digits on a given call |
|
47 |
|
48 @param [in] video_pref - video direction desired on call |
|
49 @param [in] digits - digits to be dialed. can be empty then this API simply goes offhook |
|
50 |
|
51 @return true or false. |
|
52 */ |
|
53 virtual bool originateCall (cc_sdp_direction_t video_pref, const std::string & digits) = 0; |
|
54 |
|
55 /** |
|
56 Use this function to answer an incoming call. |
|
57 |
|
58 @param[in] video_pref - video direction desired on call |
|
59 |
|
60 @return true or false. |
|
61 */ |
|
62 virtual bool answerCall (cc_sdp_direction_t video_pref) = 0; |
|
63 |
|
64 /** |
|
65 Use this function to put an active call on hold. |
|
66 |
|
67 @param[in] reason - If the user chooses to put the call on hold then |
|
68 CC_HOLD_REASON_NONE should be the value passed in here. |
|
69 |
|
70 @return true or false. If it's not appropriate to put this call on |
|
71 hold at the moment then this function will return false. |
|
72 */ |
|
73 virtual bool hold (cc_hold_reason_t reason) = 0; |
|
74 |
|
75 /** |
|
76 Use this function to resume a call that is currently on hold. |
|
77 |
|
78 @param [in] video_pref - video direction desired on call |
|
79 |
|
80 @return true or false |
|
81 */ |
|
82 virtual bool resume (cc_sdp_direction_t video_pref) = 0; |
|
83 |
|
84 /** |
|
85 Use this function to end an active call. |
|
86 |
|
87 @return true or false |
|
88 */ |
|
89 virtual bool endCall() = 0; |
|
90 |
|
91 /** |
|
92 Send digits on the call - can be invoked either to dial additional digits or send DTMF |
|
93 |
|
94 @param [in] digit - digit to be dialed |
|
95 |
|
96 @return true or false |
|
97 */ |
|
98 virtual bool sendDigit (cc_digit_t digit) = 0; |
|
99 |
|
100 /** |
|
101 Send Backspace - Delete last digit dialed. |
|
102 |
|
103 @return true or false |
|
104 */ |
|
105 virtual bool backspace() = 0; |
|
106 |
|
107 /** |
|
108 Redial |
|
109 |
|
110 @param [in] video_pref - video direction desired on call |
|
111 @return true or false |
|
112 */ |
|
113 virtual bool redial (cc_sdp_direction_t video_pref) = 0; |
|
114 |
|
115 /** |
|
116 Initiate Call Forward All |
|
117 |
|
118 @return true or false |
|
119 */ |
|
120 virtual bool initiateCallForwardAll() = 0; |
|
121 |
|
122 /** |
|
123 end Consult leg - used to end consult leg when the user picks active calls list for xfer/conf |
|
124 |
|
125 @return true or false |
|
126 */ |
|
127 virtual bool endConsultativeCall() = 0; |
|
128 |
|
129 /** |
|
130 Initiate a conference |
|
131 |
|
132 @param [in] video_pref - video direction desired on consult call |
|
133 |
|
134 @return true or false |
|
135 */ |
|
136 virtual bool conferenceStart (cc_sdp_direction_t video_pref) = 0; |
|
137 |
|
138 /** |
|
139 complete conference |
|
140 |
|
141 @param [in] otherCall - CC_CallPtr of the other leg |
|
142 @param [in] video_pref - video direction desired on consult call |
|
143 |
|
144 @return true or false |
|
145 */ |
|
146 virtual bool conferenceComplete (CC_CallPtr otherLog, cc_sdp_direction_t video_pref) = 0; |
|
147 |
|
148 /** |
|
149 start transfer |
|
150 |
|
151 @param [in] video_pref - video direction desired on consult call |
|
152 |
|
153 @return true or false |
|
154 */ |
|
155 virtual bool transferStart (cc_sdp_direction_t video_pref) = 0; |
|
156 |
|
157 /** |
|
158 complete transfer |
|
159 |
|
160 @param [in] otherLeg - CC_CallPtr of the other leg |
|
161 @param [in] video_pref - video direction desired on consult call |
|
162 |
|
163 @return true or false |
|
164 */ |
|
165 virtual bool transferComplete (CC_CallPtr otherLeg, |
|
166 cc_sdp_direction_t video_pref) = 0; |
|
167 |
|
168 /** |
|
169 cancel conference or transfer |
|
170 |
|
171 @return true or false |
|
172 */ |
|
173 virtual bool cancelTransferOrConferenceFeature() = 0; |
|
174 |
|
175 /** |
|
176 direct Transfer |
|
177 |
|
178 @param [in] target - call handle for transfer target call |
|
179 @return true or false |
|
180 */ |
|
181 virtual bool directTransfer (CC_CallPtr target) = 0; |
|
182 |
|
183 /** |
|
184 Join Across line |
|
185 |
|
186 @param [in] target - join target |
|
187 @return true or false |
|
188 */ |
|
189 virtual bool joinAcrossLine (CC_CallPtr target) = 0; |
|
190 |
|
191 /** |
|
192 BLF Call Pickup |
|
193 |
|
194 @param [in] video_pref - video direction preference |
|
195 @param [in] speed - speedDial Number |
|
196 @return true or false |
|
197 */ |
|
198 virtual bool blfCallPickup (cc_sdp_direction_t video_pref, const std::string & speed) = 0; |
|
199 |
|
200 /** |
|
201 Select a call |
|
202 |
|
203 @return true or false |
|
204 */ |
|
205 virtual bool select() = 0; |
|
206 |
|
207 /** |
|
208 Update Video Media Cap for the call |
|
209 |
|
210 @param [in] video_pref - video direction desired on call |
|
211 @return true or false |
|
212 */ |
|
213 virtual bool updateVideoMediaCap (cc_sdp_direction_t video_pref) = 0; |
|
214 |
|
215 /** |
|
216 send INFO method for the call |
|
217 @param [in] handle - call handle |
|
218 @param [in] infopackage - Info-Package header value |
|
219 @param [in] infotype - Content-Type header val |
|
220 @param [in] infobody - Body of the INFO message |
|
221 @return true or false |
|
222 */ |
|
223 virtual bool sendInfo (const std::string & infopackage, const std::string & infotype, const std::string & infobody) = 0; |
|
224 |
|
225 /** |
|
226 API to mute audio |
|
227 |
|
228 @return true if the operation succeeded |
|
229 |
|
230 NOTE: The mute state is persisted within the stack and shall be remembered across hold/resume. |
|
231 */ |
|
232 virtual bool muteAudio(void) = 0; |
|
233 |
|
234 |
|
235 /** |
|
236 API to unmute audio |
|
237 |
|
238 @return true if the operation succeeded |
|
239 |
|
240 NOTE: The mute state is persisted within the stack and shall be remembered across hold/resume. |
|
241 */ |
|
242 virtual bool unmuteAudio(void) = 0; |
|
243 /** |
|
244 API to mute video |
|
245 |
|
246 @return true if the operation succeeded |
|
247 |
|
248 NOTE: The mute state is persisted within the stack and shall be remembered across hold/resume. |
|
249 */ |
|
250 virtual bool muteVideo(void) = 0; |
|
251 |
|
252 |
|
253 /** |
|
254 API to unmute video |
|
255 |
|
256 @return true if the operation succeeded |
|
257 |
|
258 NOTE: The mute state is persisted within the stack and shall be remembered across hold/resume. |
|
259 */ |
|
260 virtual bool unmuteVideo(void) = 0; |
|
261 |
|
262 |
|
263 /** |
|
264 API to set the call volume, acceptable values are 0 - 100 |
|
265 @return true if volume set successfully, false if value out of range or change failed |
|
266 */ |
|
267 virtual bool setVolume(int volume) = 0; |
|
268 |
|
269 |
|
270 /** |
|
271 Originate P2P call - API to go offhook and dial specified digits\user on a given call |
|
272 |
|
273 @param [in] video_pref - video direction desired on call |
|
274 @param [in] digits - digits to be dialed. can be empty then this API simply goes offhook |
|
275 @param [in] ip address - the ip address of the peer to call |
|
276 |
|
277 @return void |
|
278 */ |
|
279 virtual void originateP2PCall (cc_sdp_direction_t video_pref, const std::string & digits, const std::string & ip) = 0; |
|
280 |
|
281 virtual void createOffer (cc_media_constraints_t* constraints, Timecard *) = 0; |
|
282 |
|
283 virtual void createAnswer(cc_media_constraints_t* constraints, Timecard *) = 0; |
|
284 |
|
285 virtual void setLocalDescription(cc_jsep_action_t action, const std::string & sdp, Timecard *) = 0; |
|
286 |
|
287 virtual void setRemoteDescription(cc_jsep_action_t action, const std::string & sdp, Timecard *) = 0; |
|
288 |
|
289 virtual void setPeerConnection(const std::string& handle) = 0; |
|
290 |
|
291 virtual void addStream(cc_media_stream_id_t stream_id, |
|
292 cc_media_track_id_t track_id, |
|
293 cc_media_type_t media_type, |
|
294 cc_media_constraints_t *constraints) = 0; |
|
295 |
|
296 virtual void removeStream(cc_media_stream_id_t stream_id, cc_media_track_id_t track_id, cc_media_type_t media_type) = 0; |
|
297 |
|
298 virtual const std::string& getPeerConnection() const = 0; |
|
299 |
|
300 virtual void addICECandidate(const std::string & candidate, const std::string & mid, unsigned short level, Timecard *) = 0; |
|
301 |
|
302 }; |
|
303 } |
|
304 |