Commit 1c6fe4dc authored by Gautier Pelloux-Prayer's avatar Gautier Pelloux-Prayer
Browse files

Quality reporting: collector address is now route address of the PUBLISH - if...

Quality reporting: collector address is now route address of the PUBLISH - if set to NULL, PUBLISH will be sent to proxy config domain
parent da2c63a6
......@@ -957,18 +957,20 @@ LINPHONE_PUBLIC void linphone_proxy_config_enable_quality_reporting(LinphoneProx
LINPHONE_PUBLIC bool_t linphone_proxy_config_quality_reporting_enabled(LinphoneProxyConfig *cfg);
/**
* Set the SIP address of the collector end-point when using quality reporting. This SIP address
* should be used on server-side to process packets directly then discard packets. Collector address
* should be a non existing account and should not received any packets.
* Set the route of the collector end-point when using quality reporting. This SIP address
* should be used on server-side to process packets directly before discarding packets. Collector address
* should be a non existing account and will not receive any messages.
* If NULL, reports will be send to the proxy domain.
* @param[in] cfg #LinphoneProxyConfig object
* @param[in] collector SIP address of the collector end-point.
* @param[in] collector route of the collector end-point, if NULL PUBLISH will be sent to the proxy domain.
*/
LINPHONE_PUBLIC void linphone_proxy_config_set_quality_reporting_collector(LinphoneProxyConfig *cfg, const char *collector);
/**
* Get the SIP address of the collector end-point when using quality reporting. This SIP address
* should be used on server-side to process packets directly then discard packets. Collector address
* should be a non existing account and should not received any packets.
* Get the route of the collector end-point when using quality reporting. This SIP address
* should be used on server-side to process packets directly before discarding packets. Collector address
* should be a non existing account and will not receive any messages.
* If NULL, reports will be send to the proxy domain.
* @param[in] cfg #LinphoneProxyConfig object
* @return The SIP address of the collector end-point.
*/
......
......@@ -258,12 +258,14 @@ static void append_metrics_to_buffer(char ** buffer, size_t * size, size_t * off
static int send_report(LinphoneCall* call, reporting_session_report_t * report, const char * report_event) {
LinphoneContent *content = linphone_content_new();
LinphoneAddress *addr;
int expires = -1;
size_t offset = 0;
size_t size = 2048;
char * buffer;
int ret = 0;
LinphoneEvent *lev;
LinphoneAddress *request_uri;
char * domain;
/*if we are on a low bandwidth network, do not send reports to not overload it*/
if (linphone_call_params_low_bandwidth_enabled(linphone_call_get_current_params(call))){
......@@ -286,14 +288,6 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
goto end;
}
addr = linphone_address_new(linphone_proxy_config_get_quality_reporting_collector(call->dest_proxy));
if (addr == NULL) {
ms_warning("QualityReporting[%p]: Asked to submit reporting statistics but no collector address found"
, call);
ret = 3;
goto end;
}
buffer = (char *) belle_sip_malloc(size);
linphone_content_set_type(content, "application");
linphone_content_set_subtype(content, "vq-rtcpxr");
......@@ -341,7 +335,18 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
content);
}
if (! linphone_core_publish(call->core, addr, "vq-rtcpxr", expires, content)){
domain = ms_strdup_printf("sip:%s", linphone_proxy_config_get_domain(call->dest_proxy));
request_uri = linphone_address_new(domain);
ms_free(domain);
lev=linphone_core_create_publish(call->core, request_uri, "vq-rtcpxr", expires);
if (linphone_proxy_config_get_quality_reporting_collector(call->dest_proxy) != NULL) {
sal_op_set_route(lev->op, linphone_proxy_config_get_quality_reporting_collector(call->dest_proxy));
}
if (! linphone_event_send_publish(lev, content)){
linphone_event_unref(lev);
lev=NULL;
ret=4;
} else {
reset_avg_metrics(report);
......@@ -352,8 +357,7 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
STR_REASSIGN(report->qos_analyzer.output, NULL);
}
linphone_address_destroy(addr);
linphone_address_destroy(request_uri);
linphone_content_unref(content);
end:
......
......@@ -142,19 +142,16 @@ bool_t create_call_for_quality_reporting_tests(
}
static void quality_reporting_not_used_without_config() {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
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;
if (create_call_for_quality_reporting_tests(marie, pauline, &call_marie, &call_pauline, NULL, NULL)) {
// marie has stats collection enabled but pauline has not
// marie has stats collection enabled but pauline has not
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));
BC_ASSERT_STRING_EQUAL(linphone_proxy_config_get_quality_reporting_collector(call_marie->dest_proxy),
"sip:collector@sip.example.org");
// this field should be already filled
BC_ASSERT_PTR_NOT_NULL(call_marie->log->reporting.reports[0]->info.local_addr.ip);
......@@ -166,7 +163,7 @@ static void quality_reporting_not_used_without_config() {
}
static void quality_reporting_not_sent_if_call_not_started() {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_quality_reporting_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneCallLog* out_call_log;
LinphoneCall* out_call;
......@@ -197,7 +194,7 @@ static void quality_reporting_not_sent_if_call_not_started() {
}
static void quality_reporting_not_sent_if_low_bandwidth() {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_quality_reporting_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc");
LinphoneCallParams* marie_params;
......@@ -222,7 +219,7 @@ void on_report_send_remove_fields(const LinphoneCall *call, SalStreamType stream
}
static void quality_reporting_invalid_report() {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
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;
......@@ -234,6 +231,7 @@ static void quality_reporting_invalid_report() {
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));
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishError,1, int, "%d");
BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,0, int, "%d");
}
linphone_core_manager_destroy(marie);
......@@ -241,7 +239,7 @@ static void quality_reporting_invalid_report() {
}
static void quality_reporting_at_call_termination() {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_quality_reporting_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_rc_rtcp_xr");
LinphoneCall* call_marie = NULL;
LinphoneCall* call_pauline = NULL;
......@@ -262,6 +260,7 @@ static void quality_reporting_at_call_termination() {
// PUBLISH submission to the collector should be ok
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(marie->lc,NULL,&marie->stat.number_of_LinphonePublishOk,1));
}
linphone_core_manager_destroy(marie);
......
......@@ -22,8 +22,6 @@ reg_expires=3600
reg_sendregister=1
publish=0
dial_escape_plus=0
quality_reporting_collector=sip:collector@sip.example.org
quality_reporting_enabled=1
[friend_0]
url="Paupoche" <sip:pauline@sip.example.org>
......
[sip]
sip_port=-1
sip_tcp_port=-1
sip_tls_port=-1
default_proxy=0
ping_with_options=0
register_only_when_network_is_up=0
composing_idle_timeout=1
[auth_info_0]
username=marie
userid=marie
passwd=secret
realm=sip.example.org
[proxy_0]
reg_proxy=sip.example.org;transport=tcp
reg_route=sip.example.org;transport=tcp;lr
reg_identity=sip:marie@sip.example.org
reg_expires=3600
reg_sendregister=1
publish=0
dial_escape_plus=0
quality_reporting_collector=sip:collector@sip.example.org
quality_reporting_enabled=1
[friend_0]
url="Paupoche" <sip:pauline@sip.example.org>
pol=accept
subscribe=0
[rtp]
audio_rtp_port=20070-22070
video_rtp_port=24000-25000
[video]
display=0
capture=0
show_local=0
size=vga
enabled=0
self_view=0
automatically_initiate=0
automatically_accept=0
device=StaticImage: Static picture
[sound]
echocancellation=0 #to not overload cpu in case of VG
......@@ -22,8 +22,6 @@ reg_expires=3600
reg_sendregister=1
publish=0
dial_escape_plus=0
quality_reporting_collector=sip:collector@sip.example.org
quality_reporting_enabled=1
[friend_0]
url="Paupoche" <sip:pauline@sip.example.org>
......
......@@ -22,8 +22,6 @@ reg_expires=3600
reg_sendregister=1
publish=0
dial_escape_plus=0
quality_reporting_collector=sip:collector@sip2.linphone.org
quality_reporting_enabled=1
[friend_0]
url="Paupoche" <sip:pauline@sip2.linphone.org>
......
......@@ -23,8 +23,6 @@ reg_expires=3600
reg_sendregister=1
publish=0
dial_escape_plus=0
quality_reporting_collector=sip:collector@sip.example.org
quality_reporting_enabled=1
[friend_0]
url="Paupoche" <sip:pauline@sip.example.org>
......
......@@ -23,8 +23,6 @@ reg_expires=3600
reg_sendregister=1
publish=0
dial_escape_plus=0
quality_reporting_collector=sip:collector@sip.example.org
quality_reporting_enabled=1
[friend_0]
url="Paupoche" <sip:pauline@sip.example.org>
......
......@@ -23,8 +23,6 @@ reg_expires=3600
reg_sendregister=1
publish=0
dial_escape_plus=0
quality_reporting_collector=sip:collector@sip.example.org
quality_reporting_enabled=1
[friend_0]
url="Paupoche" <sip:pauline@sip.example.org>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment