Commit 2338c946 authored by Simon Morlat's avatar Simon Morlat
Browse files

fix routing of quality reporting publishes

parent 933748ee
......@@ -208,6 +208,11 @@ void sal_address_set_uri_params(SalAddress *addr, const char *params){
bool_t sal_address_has_uri_param(SalAddress *addr, const char *name){
belle_sip_parameters_t* parameters = BELLE_SIP_PARAMETERS(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(addr)));
belle_sip_parameters_has_parameter(parameters, name);
void sal_address_set_header(SalAddress *addr, const char *header_name, const char *header_value){
belle_sip_uri_set_header(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(addr)),header_name, header_value);
......@@ -271,8 +271,7 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
int ret = 0;
LinphoneEvent *lev;
LinphoneAddress *request_uri;
char * domain;
const char* route;
const char* collector_uri;
/*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))){
......@@ -353,14 +352,21 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
route = linphone_proxy_config_get_quality_reporting_collector(call->dest_proxy);
domain = ms_strdup_printf("sip:%s", linphone_proxy_config_get_domain(call->dest_proxy));
request_uri = linphone_address_new(route ? route : domain);
collector_uri = linphone_proxy_config_get_quality_reporting_collector(call->dest_proxy);
if (!collector_uri){
collector_uri = ms_strdup_printf("sip:%s", linphone_proxy_config_get_domain(call->dest_proxy));
request_uri = linphone_address_new(collector_uri);
lev=linphone_core_create_publish(call->core, request_uri, "vq-rtcpxr", expires);
if (route) {
ms_message("Publishing report with custom route %s", route);
sal_op_set_route(lev->op, route);
/* Special exception for quality report PUBLISH: if the collector_uri has any transport related parameters
* (port, transport, maddr), then it is sent directly.
* Otherwise it is routed as any LinphoneEvent publish, following proxy config policy.
if (sal_address_has_uri_param((SalAddress*)request_uri, "transport") ||
sal_address_has_uri_param((SalAddress*)request_uri, "maddr") ||
linphone_address_get_port(request_uri) != 0) {
ms_message("Publishing report with custom route %s", collector_uri);
sal_op_set_route(lev->op, collector_uri);
if (linphone_event_send_publish(lev, content) != 0){
......@@ -126,6 +126,7 @@ void sal_address_set_transport_name(SalAddress* addr,const char* transport);
void sal_address_set_method_param(SalAddress *addr, const char *method);
void sal_address_set_params(SalAddress *addr, const char *params);
void sal_address_set_uri_params(SalAddress *addr, const char *params);
bool_t sal_address_has_uri_param(SalAddress *addr, const char *name);
bool_t sal_address_is_ipv6(const SalAddress *addr);
bool_t sal_address_is_sip(const SalAddress *addr);
void sal_address_set_password(SalAddress *addr, const char *passwd);
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