quality_reporting_tester.c 20.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
	liblinphone_tester - liblinphone test suite
	Copyright (C) 2013  Belledonne Communications SARL

	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, see <http://www.gnu.org/licenses/>.
*/

#include <stdio.h>
#include "linphonecore.h"
#include "private.h"
#include "liblinphone_tester.h"

24 25 26
/*avoid crash if x is NULL on libc versions <4.5.26 */
#define __strstr(x, y) ((x==NULL)?NULL:strstr(x,y))

27
void on_report_send_mandatory(const LinphoneCall *call, SalStreamType stream_type, const LinphoneContent *content){
28
	char * body = (char *)linphone_content_get_buffer(content);
29
	char * remote_metrics_start = __strstr(body, "RemoteMetrics:");
30
	BC_ASSERT_TRUE(
31 32 33 34
			__strstr(body, "VQIntervalReport\r\n")			== body ||
			__strstr(body, "VQSessionReport\r\n")			== body ||
			__strstr(body, "VQSessionReport: CallTerm\r\n") == body
	);
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "CallID:"));
	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalID:"));
	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteID:"));
	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "OrigID:"));
	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalGroup:"));
	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteGroup:"));
	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalAddr:"));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "IP="));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PORT="));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SSRC="));
	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteAddr:"));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "IP="));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PORT="));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SSRC="));
	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalMetrics:"));
	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Timestamps:"));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "START="));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "STOP="));

	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SessionDesc:"));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PT="));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PD="));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SR="));
58 59

	/* We should have not reached RemoteMetrics section yet */
60
	BC_ASSERT_TRUE(!remote_metrics_start || body < remote_metrics_start);
61

62
	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "DialogID:"));
63 64 65 66
}

char * on_report_send_verify_metrics(const reporting_content_metrics_t *metrics, char * body){
	if (metrics->rtcp_xr_count){
67 68 69
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "SessionDesc:"));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "JitterBuffer:"));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "PacketLoss:"));
70
	}
71
	if (metrics->rtcp_sr_count+metrics->rtcp_xr_count>0){
72
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Delay:"));
73
	}
74
	if (metrics->rtcp_xr_count){
75
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "QualityEst:"));
76
	}
77 78 79 80

	return body;
}

81
void on_report_send_with_rtcp_xr_local(const LinphoneCall *call, SalStreamType stream_type, const LinphoneContent *content){
82
	char * body = (char*)linphone_content_get_buffer(content);
83 84 85
	char * remote_metrics_start = __strstr(body, "RemoteMetrics:");
	reporting_session_report_t * report = call->log->reporting.reports[stream_type];
	on_report_send_mandatory(call,stream_type,content);
86 87
	BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "LocalMetrics:"));
	BC_ASSERT_TRUE(!remote_metrics_start || on_report_send_verify_metrics(&report->local_metrics,body) < remote_metrics_start);
88
}
89
void on_report_send_with_rtcp_xr_remote(const LinphoneCall *call, SalStreamType stream_type, const LinphoneContent *content){
90
	char * body = (char*)linphone_content_get_buffer(content);
91 92 93 94
	reporting_session_report_t * report = call->log->reporting.reports[stream_type];

	on_report_send_mandatory(call,stream_type,content);
	if (report->remote_metrics.rtcp_sr_count+report->remote_metrics.rtcp_xr_count>0){
95 96
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "RemoteMetrics:"));
		BC_ASSERT_PTR_NOT_NULL(body=__strstr(body, "Timestamps:"));
97 98 99
		on_report_send_verify_metrics(&report->remote_metrics,body);
	}
}
100
void on_report_send_with_rtcp_xr_both(const LinphoneCall *call, SalStreamType stream_type, const LinphoneContent *content){
101 102 103 104
	on_report_send_with_rtcp_xr_local(call,stream_type,content);
	on_report_send_with_rtcp_xr_remote(call,stream_type,content);
}

105
bool_t create_call_for_quality_reporting_tests(
106 107 108
		LinphoneCoreManager* marie,
		LinphoneCoreManager* pauline,
		LinphoneCall** call_marie,
109 110 111 112 113 114 115
		LinphoneCall** call_pauline,
		LinphoneCallParams * params_marie,
		LinphoneCallParams * params_pauline
		) {


	bool_t call_succeeded = call_with_params(marie,pauline,params_marie,params_pauline);
116
	BC_ASSERT_TRUE(call_succeeded);
117 118 119
	if (call_succeeded) {
		if (call_marie) {
			*call_marie = linphone_core_get_current_call(marie->lc);
120
			BC_ASSERT_PTR_NOT_NULL(*call_marie);
121 122 123
		}
		if (call_pauline) {
			*call_pauline = linphone_core_get_current_call(pauline->lc);
124
			BC_ASSERT_PTR_NOT_NULL(*call_pauline);
125 126 127
		}
	}
	return call_succeeded;
128 129
}

130
static void quality_reporting_not_used_without_config(void) {
131
	LinphoneCoreManager* marie = linphone_core_manager_new( "marie_quality_reporting_rc");
132
	LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
133 134 135
	LinphoneCall* call_marie = NULL;
	LinphoneCall* call_pauline = NULL;

136
	if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, NULL, NULL))  {
137
		// marie has stats collection enabled but pauline has not
138 139
		BC_ASSERT_TRUE(linphone_proxy_config_quality_reporting_enabled(call_marie->dest_proxy));
		BC_ASSERT_FALSE(linphone_proxy_config_quality_reporting_enabled(call_pauline->dest_proxy));
140

141
		// this field should be already filled
142
		BC_ASSERT_PTR_NOT_NULL(call_marie->log->reporting.reports[0]->info.local_addr.ip);
143

144
		// but not this one since it is updated at the end of call
145
		BC_ASSERT_PTR_NULL(call_marie->log->reporting.reports[0]->dialog_id);
Simon Morlat's avatar
Simon Morlat committed
146
		end_call(marie, pauline);
147
	}
148

149 150 151
	linphone_core_manager_destroy(marie);
	linphone_core_manager_destroy(pauline);
}
152

153
static void quality_reporting_not_sent_if_call_not_started(void) {
154
	LinphoneCoreManager* marie = linphone_core_manager_new( "marie_quality_reporting_rc");
155
	LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
156 157 158 159 160
	LinphoneCallLog* out_call_log;
	LinphoneCall* out_call;

	linphone_core_set_max_calls(pauline->lc,0);
	out_call = linphone_core_invite(marie->lc,"pauline");
161 162
	BC_ASSERT_PTR_NOT_NULL(out_call);
	if(out_call == NULL) goto end;
163 164
	linphone_call_ref(out_call);

165 166
	BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallError,1, 10000));
	BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallError,1, int, "%d");
167 168 169

	if (ms_list_size(linphone_core_get_call_logs(marie->lc))>0) {
		out_call_log=(LinphoneCallLog*)(linphone_core_get_call_logs(marie->lc)->data);
170 171
		BC_ASSERT_PTR_NOT_NULL(out_call_log);
		BC_ASSERT_EQUAL(linphone_call_log_get_status(out_call_log),LinphoneCallAborted, int, "%d");
172 173 174 175 176 177 178
	}
	linphone_call_unref(out_call);

	// wait a few time...
	wait_for_until(marie->lc,NULL,NULL,0,1000);

	// since the callee was busy, there should be no publish to do
179 180
	BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0, int, "%d");
	BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d");
181
end:
182 183 184
	linphone_core_manager_destroy(marie);
	linphone_core_manager_destroy(pauline);
}
185

186
static void quality_reporting_not_sent_if_low_bandwidth(void) {
187
	LinphoneCoreManager* marie = linphone_core_manager_new( "marie_quality_reporting_rc");
188
	LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
189 190
	LinphoneCallParams* marie_params;

191
	marie_params=linphone_core_create_call_params(marie->lc, NULL);
192 193
	linphone_call_params_enable_low_bandwidth(marie_params,TRUE);

194
	if (create_call_for_quality_reporting_tests(marie, pauline, NULL, NULL, marie_params, NULL)) {
Simon Morlat's avatar
Simon Morlat committed
195
		end_call(marie, pauline);
196

197 198
		BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0, int, "%d");
		BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d");
199 200
	}
	linphone_call_params_destroy(marie_params);
201 202 203 204
	linphone_core_manager_destroy(marie);
	linphone_core_manager_destroy(pauline);
}

205
void on_report_send_remove_fields(const LinphoneCall *call, SalStreamType stream_type, const LinphoneContent *content){
206
	char *body = (char*)linphone_content_get_buffer(content);
207 208 209 210
	/*corrupt start of the report*/
	strncpy(body, "corrupted report is corrupted", strlen("corrupted report is corrupted"));
}

211
static void quality_reporting_invalid_report(void) {
212
	LinphoneCoreManager* marie = linphone_core_manager_new( "marie_quality_reporting_rc");
213
	LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
214 215 216
	LinphoneCall* call_marie = NULL;
	LinphoneCall* call_pauline = NULL;

217 218
	if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, NULL, NULL)) {
		linphone_reporting_set_on_report_send(call_marie, on_report_send_remove_fields);
219

Simon Morlat's avatar
Simon Morlat committed
220
		end_call(marie, pauline);
221

222 223
		BC_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1));
		BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishError,1,3000));
224
		BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishError,1, int, "%d");
225
		BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d");
226
	}
227 228 229 230
	linphone_core_manager_destroy(marie);
	linphone_core_manager_destroy(pauline);
}

231
static void quality_reporting_at_call_termination(void) {
232
	LinphoneCoreManager* marie = linphone_core_manager_new( "marie_quality_reporting_rc");
233
	LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_rtcp_xr");
234 235 236
	LinphoneCall* call_marie = NULL;
	LinphoneCall* call_pauline = NULL;

237 238
	if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, NULL, NULL)) {
		linphone_reporting_set_on_report_send(call_marie, on_report_send_with_rtcp_xr_remote);
239

240
		linphone_core_terminate_all_calls(marie->lc);
241

242
		// now dialog id should be filled
243
		BC_ASSERT_PTR_NOT_NULL(call_marie->log->reporting.reports[0]->dialog_id);
244

245 246
		BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphoneCallReleased,1, 10000));
		BC_ASSERT_TRUE(wait_for_until(pauline->lc,NULL,&pauline->stat.number_of_LinphoneCallReleased,1, 10000));
247

248 249
		BC_ASSERT_PTR_NULL(linphone_core_get_current_call(marie->lc));
		BC_ASSERT_PTR_NULL(linphone_core_get_current_call(pauline->lc));
250

251
		// PUBLISH submission to the collector should be ok
252
		BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphonePublishProgress,1));
253
		BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,1, int, "%d");
254
		BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphonePublishOk,1));
255
	}
256 257 258 259
	linphone_core_manager_destroy(marie);
	linphone_core_manager_destroy(pauline);
}

260
static void quality_reporting_interval_report(void) {
261 262
	LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc_rtcp_xr");
	LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_rtcp_xr");
263 264 265
	LinphoneCall* call_marie = NULL;
	LinphoneCall* call_pauline = NULL;

266 267
	if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, NULL, NULL))  {
		linphone_reporting_set_on_report_send(call_marie, on_report_send_mandatory);
268
		linphone_proxy_config_set_quality_reporting_interval(call_marie->dest_proxy, 1);
269

270 271
		BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(marie->lc));
		BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(pauline->lc));
272

273
		// PUBLISH submission to the collector should be ok
274 275
		BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1,60000));
		BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,1,60000));
Simon Morlat's avatar
Simon Morlat committed
276
		end_call(marie, pauline);
277
	}
278 279 280 281
	linphone_core_manager_destroy(marie);
	linphone_core_manager_destroy(pauline);
}

282
static void quality_reporting_session_report_if_video_stopped(void) {
283
	LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc_rtcp_xr");
284
	LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
285
	LinphoneCall* call_pauline = NULL;
286
	LinphoneCall* call_marie = NULL;
287 288 289 290 291 292 293
	LinphoneCallParams* pauline_params;
	LinphoneCallParams* marie_params;

	linphone_core_enable_video_capture(marie->lc, TRUE);
	linphone_core_enable_video_display(marie->lc, FALSE);
	linphone_core_enable_video_capture(pauline->lc, TRUE);
	linphone_core_enable_video_display(pauline->lc, FALSE);
294
	marie_params=linphone_core_create_call_params(marie->lc, NULL);
295
	linphone_call_params_enable_video(marie_params,TRUE);
296
	pauline_params=linphone_core_create_call_params(pauline->lc, NULL);
297 298
	linphone_call_params_enable_video(pauline_params,TRUE);

299 300
	if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, marie_params, pauline_params)) {
		linphone_reporting_set_on_report_send(call_marie, on_report_send_with_rtcp_xr_local);
301

302 303
		BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,0, int, "%d");
		BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d");
304

305 306
		BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,NULL,0,3000));
		BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline)));
307

308 309 310
		/*remove video*/
		linphone_call_params_enable_video(pauline_params,FALSE);
		linphone_core_update_call(pauline->lc,call_pauline,pauline_params);
311

312 313
		BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1,10000));
		BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,1,10000));
314

315
		BC_ASSERT_FALSE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline)));
316

Simon Morlat's avatar
Simon Morlat committed
317
		end_call(marie, pauline);
318

319 320
		BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,2,5000));
		BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,2,5000));
321 322 323
	}
	linphone_call_params_destroy(marie_params);
	linphone_call_params_destroy(pauline_params);
324 325 326 327 328

	linphone_core_manager_destroy(marie);
	linphone_core_manager_destroy(pauline);
}

329
void publish_report_with_route_state_changed(LinphoneCore *lc, LinphoneEvent *ev, LinphonePublishState state){
330 331
	if (state == LinphonePublishProgress) {
		BC_ASSERT_STRING_EQUAL(linphone_address_as_string(linphone_event_get_resource(ev)), linphone_proxy_config_get_quality_reporting_collector(linphone_core_get_default_proxy_config(lc)));
332 333 334
	}
}

335
static void quality_reporting_sent_using_custom_route(void) {
336 337 338 339 340
	LinphoneCoreManager* marie = linphone_core_manager_new( "marie_quality_reporting_rc");
	LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
	LinphoneCall* call_marie = NULL;
	LinphoneCall* call_pauline = NULL;

341 342 343 344
	LinphoneCoreVTable publish_vtable = {0};
	publish_vtable.publish_state_changed = publish_report_with_route_state_changed;
	linphone_core_add_listener(marie->lc, &publish_vtable);

345 346 347 348
	//INVALID collector: sip.linphone.org do not collect reports, so it will throw a 404 Not Found error
	linphone_proxy_config_set_quality_reporting_collector(linphone_core_get_default_proxy_config(marie->lc), "sip:sip.linphone.org");

	if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, NULL, NULL)) {
Simon Morlat's avatar
Simon Morlat committed
349
		end_call(marie, pauline);
350 351 352 353 354 355 356 357 358 359 360

		// PUBLISH submission to the collector should be ERROR since route is not valid
		BC_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphonePublishProgress,1));
		BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishProgress,1, int, "%d");
		BC_ASSERT_TRUE(wait_for_until(marie->lc,NULL,&marie->stat.number_of_LinphonePublishError,1,10000));
		BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0,int, "%d");
	}
	linphone_core_manager_destroy(marie);
	linphone_core_manager_destroy(pauline);
}

361 362 363 364 365 366 367 368
static void quality_reporting_interval_report_video_and_rtt(void) {
	LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc_rtcp_xr");
	LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_rtcp_xr");
	LinphoneCall* call_marie = NULL;
	LinphoneCall* call_pauline = NULL;
	LinphoneCallParams* pauline_params;
	LinphoneCallParams* marie_params;
 	LinphoneChatRoom *pauline_chat_room;
369

370 371 372 373
	linphone_core_enable_video_capture(marie->lc, TRUE);
	linphone_core_enable_video_display(marie->lc, FALSE);
	linphone_core_enable_video_capture(pauline->lc, TRUE);
	linphone_core_enable_video_display(pauline->lc, FALSE);
374
	marie_params=linphone_core_create_call_params(marie->lc, NULL);
375 376
	linphone_call_params_enable_video(marie_params,TRUE);
	linphone_call_params_enable_realtime_text(marie_params,TRUE);
377
	pauline_params=linphone_core_create_call_params(pauline->lc, NULL);
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394
	linphone_call_params_enable_video(pauline_params,TRUE);
	linphone_call_params_enable_realtime_text(pauline_params,TRUE);

	if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, marie_params, pauline_params))  {
		linphone_reporting_set_on_report_send(call_marie, on_report_send_mandatory);
		linphone_proxy_config_set_quality_reporting_interval(call_marie->dest_proxy, 1);

		BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,NULL,0,3000));
		BC_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(call_pauline)));
		BC_ASSERT_TRUE(linphone_call_params_realtime_text_enabled(linphone_call_get_current_params(call_pauline)));

		BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(marie->lc));
		BC_ASSERT_PTR_NOT_NULL(linphone_core_get_current_call(pauline->lc));

		// PUBLISH submission to the collector should be ok
		BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishProgress,1,60000));
		BC_ASSERT_TRUE(wait_for_until(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePublishOk,1,60000));
395

396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
		pauline_chat_room = linphone_call_get_chat_room(call_pauline);
		BC_ASSERT_PTR_NOT_NULL(pauline_chat_room);
		if (pauline_chat_room) {
			const char* message = "Lorem Ipsum Belledonnum Communicatum";
			int i;
			LinphoneChatMessage* rtt_message = linphone_chat_room_create_message(pauline_chat_room,NULL);
			LinphoneChatRoom *marie_chat_room = linphone_call_get_chat_room(call_marie);

			for (i = 0; i < strlen(message); i++) {
				linphone_chat_message_put_char(rtt_message, message[i]);
				BC_ASSERT_TRUE(wait_for_until(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneIsComposingActiveReceived, i+1, 1000));
				BC_ASSERT_EQUAL(linphone_chat_room_get_char(marie_chat_room), message[i], char, "%c");
			}
			linphone_chat_room_send_chat_message(pauline_chat_room, rtt_message);
		}
411

412 413
		end_call(marie, pauline);
	}
414

415 416
	linphone_call_params_destroy(marie_params);
	linphone_call_params_destroy(pauline_params);
417

418 419 420 421
	linphone_core_manager_destroy(marie);
	linphone_core_manager_destroy(pauline);
}

422 423 424
test_t quality_reporting_tests[] = {
	{ "Not used if no config", quality_reporting_not_used_without_config},
	{ "Call term session report not sent if call did not start", quality_reporting_not_sent_if_call_not_started},
425
	{ "Call term session report not sent if low bandwidth", quality_reporting_not_sent_if_low_bandwidth},
426
	{ "Call term session report invalid if missing mandatory fields", quality_reporting_invalid_report},
427 428
	{ "Call term session report sent if call ended normally", quality_reporting_at_call_termination},
	{ "Interval report if interval is configured", quality_reporting_interval_report},
429
	{ "Interval report if interval is configured with video and realtime text", quality_reporting_interval_report_video_and_rtt},
430
	{ "Session report sent if video stopped during call", quality_reporting_session_report_if_video_stopped},
431
	{ "Sent using custom route", quality_reporting_sent_using_custom_route},
432 433
};

434
test_suite_t quality_reporting_test_suite = {"QualityReporting", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,
435 436
											 sizeof(quality_reporting_tests) / sizeof(quality_reporting_tests[0]),
											 quality_reporting_tests};