Call.h 9.47 KB
Newer Older
1
/*
2
Call.h
3 4 5 6 7 8 9 10 11 12 13
Copyright (C) 2015  Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
14
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
15 16 17 18 19
*/

#pragma once

#include "Enums.h"
20
#include "Core.h"
21

22
namespace BelledonneCommunications
23
{
24
	namespace Linphone
25
	{
26
		namespace Native
27
		{
28 29 30 31 32
			ref class Address;
			ref class CallLog;
			ref class CallParams;
			ref class CallStats;
			ref class Core;
33 34

			/// <summary>
35 36
			/// Object representing a call.
			/// Calls are create using Core::Invite or passed to the application by the listener CoreListener::CallState.
37
			/// </summary>
38
			[Windows::Foundation::Metadata::WebHostHidden]
39
			public ref class Call sealed
40
			{
41 42 43 44 45 46 47 48
			public:
				/// <summary>
				/// Gets the audio statistics associated with this call.
				/// </summary>
				property CallStats^ AudioStats
				{
					CallStats^ get();
				}
49

50 51 52 53 54 55 56 57
				/// <summary>
				/// Used by ZRTP encryption mechanism.
				/// </summary>
				/// <returns>SAS associated to the main stream [voice]</returns>
				property Platform::String^ AuthenticationToken
				{
					Platform::String^ get();
				}
58

59 60 61 62 63 64 65 66 67
				/// <summary>
				/// Used by ZRTP mechanism.
				/// SAS can verified manually by the user or automatically using a previously shared secret.
				/// </summary>
				property Platform::Boolean AuthenticationTokenVerified
				{
					Platform::Boolean get();
					void set(Platform::Boolean value);
				}
68

69 70 71 72 73 74 75 76
				/// <summary>
				/// Returns call quality averaged over all the duration of the call.
				/// See GetCurrentQuality for more details about quality mesurement.
				/// </summary>
				property float AverageQuality
				{
					float get();
				}
77

78 79 80 81 82 83 84
				/// <summary>
				/// Gets the CallLog associated with this call.
				/// </summary>
				property CallLog^ CallLog
				{
					BelledonneCommunications::Linphone::Native::CallLog^ get();
				}
85

86 87 88 89 90 91 92 93
				/// <summary>
				/// Tells whether video captured from the camera is sent to the remote party.
				/// </summary>
				property Platform::Boolean CameraEnabled
				{
					Platform::Boolean get();
					void set(Platform::Boolean value);
				}
94

95 96 97 98 99 100 101 102 103
				/// <summary>
				/// Gets the current local call parameters.
				/// Do not change this params directly, make a copy with CallParams::Copy to do that.
				/// </summary>
				/// <returns>The current local call parameters</returns>
				property CallParams^ CurrentParams
				{
					CallParams^ get();
				}
104

105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
				/// <summary>
				/// Obtain real time quality rating of the call.
				/// Based on local RTP statistics and RTCP feedback, a quality rating is computed and updated during all the duration of the call.
				/// This function returns its value at the time of the function call.
				/// It is expected that the rating is updated at least every 5 seconds or so.
				/// The rating is a floating point number comprised between 0 and 5.
				/// 4-5 = good quality
				/// 3-4 = average quality
				/// 2-3 = poor quality
				/// 1-2 = very poor quality
				/// 0-1 = can't be worse, mostly unusable
				/// </summary>
				/// <returns>
				/// -1 if no quality mesurement is available, for example if no active audio stream exists. Otherwise returns the quality rating.
				/// </returns>
				property float CurrentQuality
				{
					float get();
				}
124

125 126 127 128 129 130 131
				/// <summary>
				/// Returns the CallDirection (Outgoing or incoming).
				/// </summary>
				property CallDirection Direction
				{
					CallDirection get();
				}
132

133 134 135 136 137 138 139
				/// <summary>
				/// Gets the current duration of the call in seconds.
				/// </summary>
				property int Duration
				{
					int get();
				}
140

141 142 143 144 145 146 147 148
				/// <summary>
				/// Enable or disable the echo cancellation.
				/// </summary>
				property Platform::Boolean EchoCancellationEnabled
				{
					Platform::Boolean get();
					void set(Platform::Boolean value);
				}
149

150 151 152 153 154 155 156 157
				/// <summary>
				/// Enable or disable the echo limiter.
				/// </summary>
				property Platform::Boolean EchoLimiterEnabled
				{
					Platform::Boolean get();
					void set(Platform::Boolean value);
				}
158

159 160 161 162 163 164 165 166 167 168
				/// <summary>
				/// Returns true if this calls has received a transfer that has not been executed yet.
				/// Pending transfers are executed when this call is being paused or closed, locally or by remote endpoint.
				/// If the call is already paused while receiving the transfer request, the transfer immediately occurs.
				/// </summary>
				property Platform::Boolean HasTransferPending
				{
					Platform::Boolean get();
				}

169 170 171 172 173 174 175
				/// <summary>
				/// Tells whether the call is in conference or not.
				/// </summary>
				property Platform::Boolean IsInConference
				{
					Platform::Boolean get();
				}
176

177 178 179 180 181 182 183 184
				/// <summary>
				/// Tells whether an operation is in progress at the media side.
				/// </summary>
				property Platform::Boolean MediaInProgress
				{
					Platform::Boolean get();
				}

185 186 187 188 189 190 191 192
				/// <summary>
				/// Sets the native video window id (a Windows::UI::Xaml::Controls::MediaElement as a Platform::Object).
				/// </summary>
				property Platform::Object^ NativeVideoWindowId
				{
					Platform::Object^ get();
					void set(Platform::Object^ value);
				}
193

194 195 196 197 198 199 200 201
				/// <summary>
				/// Gets the measured sound volume played locally (received from remote).
				/// It is expressed in dbm0.
				/// </summary>
				property float PlayVolume
				{
					float get();
				}
202

203 204 205 206 207 208 209
				/// <summary>
				/// Gets the reason for a call termination (either error or normal termination)
				/// </summary>
				property Reason Reason
				{
					BelledonneCommunications::Linphone::Native::Reason get();
				}
210

211 212 213 214 215 216 217 218
				/// <summary>
				/// Gets the refer-to uri (if the call was transfered)
				/// </summary>
				property Platform::String^ ReferTo
				{
					Platform::String^ get();
				}

219 220 221 222 223 224 225
				/// <summary>
				/// Gets the remote Address.
				/// </summary>
				property Address^ RemoteAddress
				{
					Address^ get();
				}
226

227 228 229 230 231 232 233
				/// <summary>
				/// Gets the far end's sip contact as a string, if available.
				/// </summary>
				property Platform::String^ RemoteContact
				{
					Platform::String^ get();
				}
234

235 236 237 238 239 240 241 242 243
				/// <summary>
				/// Gets the call parameters given by the remote peer.
				/// This is useful for example to know if far end supports video or encryption.
				/// Do not change this params directly, make a copy with CallParams::Copy to do that.
				/// </summary>
				property CallParams^ RemoteParams
				{
					CallParams^ get();
				}
244

245 246 247 248 249 250 251
				/// <summary>
				/// Gets the far end's user agent description string, if available.
				/// </summary>
				property Platform::String^ RemoteUserAgent
				{
					Platform::String^ get();
				}
252

253 254 255 256 257 258 259 260 261 262 263
				/// <summary>
				/// Returns the call object this call is replacing, if any.
				/// Call replacement can occur during call transfers.
				/// By default, the core automatically terminates the replaced call and accept the new one.
				/// This function allows the application to know whether a new incoming call is a one that replaces another one.
				/// </summary>
				property Call^ ReplacedCall
				{
					Call^ get();
				}

264 265 266 267 268 269 270
				/// <summary>
				/// Gets the CallState of the call (StreamRunning, IncomingReceived, OutgoingProgress, ...).
				/// </summary>
				property CallState State
				{
					CallState get();
				}
271

272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
				/// <summary>
				/// Gets the transferer if this call was started automatically as a result of an incoming transfer request.
				/// The call in which the transfer request was received is returned in this case.
				/// </summary>
				property Call^ TransfererCall
				{
					Call^ get();
				}

				/// <summary>
				/// Returns the current transfer state, if a transfer has been initiated from this call.
				/// </summary>
				property CallState TransferState
				{
					CallState get();
				}

				/// <summary>
				/// When this call has received a transfer request, returns the new call that was automatically created as a result of the transfer.
				/// </summary>
				property Call^ TransferTargetCall
				{
					Call^ get();
				}

297 298 299 300 301 302 303 304 305 306 307 308
				/// <summary>
				/// Gets the video statistics associated with this call.
				/// </summary>
				property CallStats^ VideoStats
				{
					CallStats^ get();
				}

				/// <summary>
				/// Requests remote side to send us a Video Fast Update.
				/// </summary>
				void SendVFURequest();
309 310

#if 0
311 312 313 314 315 316 317
				/// <summary>
				/// Uses the CallContext object (native VoipPhoneCall) to get the DateTimeOffset at which the call started
				/// </summary>
				property Platform::Object^ CallStartTimeFromContext
				{
					Platform::Object^ get();
				}
318
#endif
319

320 321 322
				/// <summary>
				/// Gets the CallContext object (native VoipPhoneCall)
				/// </summary>
323
				property Windows::ApplicationModel::Calls::VoipPhoneCall^ CallContext
324
				{
325 326
					Windows::ApplicationModel::Calls::VoipPhoneCall^ get();
					void set(Windows::ApplicationModel::Calls::VoipPhoneCall^ cc);
327
				}
328

329 330 331 332 333 334 335
			private:
				friend class Utils;
				friend ref class CallStats;
				friend ref class Core;

				Call(::LinphoneCall *call);
				~Call();
336

337
				Windows::ApplicationModel::Calls::VoipPhoneCall^ callContext;
338 339 340
				::LinphoneCall *call;
			};
		}
341
	}
342
}