Quality reporting: on call end, send a PUBLISH message with call quality data (work in progress)

parent f9c8c72c
......@@ -64,7 +64,8 @@ LOCAL_SRC_FILES := \
xml.c \
xml2lpc.c \
lpc2xml.c \
remote_provisioning.c
remote_provisioning.c \
quality_reporting.c
ifndef LINPHONE_VERSION
LINPHONE_VERSION = "Devel"
......
......@@ -203,6 +203,7 @@
<ClCompile Include="..\..\..\coreapi\offeranswer.c" />
<ClCompile Include="..\..\..\coreapi\presence.c" />
<ClCompile Include="..\..\..\coreapi\proxy.c" />
<ClCompile Include="..\..\..\coreapi\quality_reporting.c" />
<ClCompile Include="..\..\..\coreapi\sal.c" />
<ClCompile Include="..\..\..\coreapi\siplogin.c" />
<ClCompile Include="..\..\..\coreapi\sipsetup.c" />
......@@ -275,4 +276,4 @@
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsPhone\v$(TargetPlatformVersion)\Microsoft.Cpp.WindowsPhone.$(TargetPlatformVersion).targets" Condition="'$(Platform)'=='ARM'" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
</Project>
......@@ -74,6 +74,7 @@ set(SOURCE_FILES
offeranswer.c
presence.c
proxy.c
quality_reporting.c
remote_provisioning.c
sal.c
siplogin.c
......
......@@ -56,6 +56,7 @@ liblinphone_la_SOURCES=\
xml2lpc.c \
lpc2xml.c \
remote_provisioning.c \
quality_reporting.c \
$(GITVERSION_FILE)
if BUILD_UPNP
......
......@@ -782,6 +782,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
Indeed it does not change the state of the call (still paused or running)*/
call->state=cstate;
}
if (cstate==LinphoneCallEnd || cstate==LinphoneCallError){
switch(call->non_op_error.reason){
case SalReasonDeclined:
......
......@@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "sipsetup.h"
#include "lpconfig.h"
#include "private.h"
#include "quality_reporting.h"
#include <math.h>
#include <ortp/telephonyevents.h>
......@@ -3469,6 +3470,8 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){
/*stop ringing*/
linphone_core_stop_ringing(lc);
linphone_quality_reporting_submit(call);
linphone_call_stop_media_streams(call);
#ifdef BUILD_UPNP
......
/*
linphone
Copyright (C) 2014 - 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
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
#include "linphonecore.h"
#include "private.h"
#include "sal/sal.h"
#define PRINT2(x, f) ms_message(#x ": " #f, x)
#define PRINT(x) PRINT2(x, "%s")
void linphone_quality_reporting_submit(LinphoneCall* call) {
// example at http://tools.ietf.org/html/rfc6035#section-4.7.3
// only if this is a linphone account
// only if call succeeded
// to: collector@sip.linphone.com
// executed AFTER BYE's "OK" response has been received
// expires value?
// un envoi à faire par stream ? (ssrc différent pour chaque stream)
// memory leaks
LinphoneContent content = {0};
LinphoneAddress *addr;
int expires = 3600;
const char *remote_identity;
const char *local_identity;
const char *orig_identity;
const char *local_ip = call->localdesc->addr; //or call->localip ?
const char *remote_ip = "TODO";
uint32_t local_ssrc = rtp_session_get_send_ssrc(call->audiostream->ms.session);
uint32_t remote_ssrc = rtp_session_get_recv_ssrc(call->audiostream->ms.session);
int local_port = 0; //TODO
int remote_port = 0;//linphone_address_get_port(linphone_call_get_remote_address(call));
if (call->dir == LinphoneCallIncoming) {
remote_identity = linphone_address_as_string(call->log->from);
local_identity = linphone_address_as_string(call->log->to);
orig_identity = remote_identity;
} else {
remote_identity = linphone_address_as_string(call->log->to);
local_identity = linphone_address_as_string(call->log->from);
orig_identity = local_identity;
}
ms_message("Submitting PUBLISH packet for call between %s and %s", local_identity, remote_identity);
PRINT(call->dest_proxy->contact_params);
PRINT(call->dest_proxy->contact_uri_params);
PRINT(call->dest_proxy->dial_prefix);
PRINT(call->dest_proxy->realm);
PRINT(call->dest_proxy->type);
PRINT(call->dest_proxy->reg_identity);
PRINT(call->dest_proxy->reg_proxy);
PRINT(call->dest_proxy->reg_route);
PRINT(sal_op_get_route(call->op));
PRINT(sal_op_get_from(call->op));
PRINT(sal_op_get_to(call->op));
PRINT(sal_op_get_proxy(call->op));
PRINT(sal_op_get_remote_contact(call->op));
PRINT(sal_op_get_network_origin(call->op));
PRINT(call->log->refkey);
PRINT(call->localdesc->addr);
PRINT2(call->log->start_date_time, "%ld");
PRINT2(call->log->start_date_time + call->log->duration, "%ld");
PRINT(linphone_timestamp_to_rfc3339_string(call->log->start_date_time));
content.type = ms_strdup("application");
content.subtype = ms_strdup("vq-rtcpxr");
content.data = ms_strdup_printf(_("VQSessionReport: CallTerm\r\n"));
content.data = ms_strdup_printf(_("%sCallID: %s\r\n"), content.data, call->log->call_id);
content.data = ms_strdup_printf(_("%sLocalID: %s\r\n"), content.data, local_identity);
content.data = ms_strdup_printf(_("%sRemoteID: %s\r\n"), content.data, remote_identity);
content.data = ms_strdup_printf(_("%sOrigID: %s\r\n"), content.data, orig_identity);
// content.data = ms_strdup_printf(_("%sLocalGroup: %s\r\n"), content.data, "TO_DO");
// content.data = ms_strdup_printf(_("%sRemoteGroup: %s\r\n"), content.data, "TO_DO");
content.data = ms_strdup_printf(_("%sLocalAddr: IP=%s PORT=%d SSRC=%d\r\n"), content.data, local_ip, local_port, local_ssrc);
// content.data = ms_strdup_printf(_("%sLocalMAC: %s\r\n"), content.data, "TO_DO");
content.data = ms_strdup_printf(_("%sRemoteAddr: IP=%s PORT=%d SSRC=%d\r\n"), content.data, remote_ip, remote_port, remote_ssrc);
// content.data = ms_strdup_printf(_("%sRemoteMAC: %s\r\n"), content.data, "TO_DO");
content.data = ms_strdup_printf(_("%sLocalMetrics:\r\n"), content.data);
content.data = ms_strdup_printf(_("%sTimestamps: START=%s STOP=%s\r\n"), content.data,
linphone_timestamp_to_rfc3339_string(call->log->start_date_time),
linphone_timestamp_to_rfc3339_string(call->log->start_date_time + call->log->duration));
content.data = ms_strdup_printf(_("%sRemoteMetrics:\r\n"), content.data, "TO_DO");
content.data = ms_strdup_printf(_("%sRemoteMetrics:\r\n"), content.data, "TO_DO");
content.data = ms_strdup_printf(_("%sTimestamps: %s\r\n"), content.data, "TO_DO");
content.data = ms_strdup_printf(_("%sDialogID: %s\r\n"), content.data, "TO_DO");
content.size = strlen((char*)content.data);
addr = linphone_address_new("sip:collector@sip.linphone.org");
ms_message("packet content: %s", (char*)content.data);
linphone_core_publish(call->core, addr, "vq-rtcpxr", expires, &content);
linphone_address_destroy(addr);
}
/*
linphone
Copyright (C) 2014 - 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
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef quality_reporting_h
#define quality_reporting_h
#include "linphonecore.h"
#ifdef __cplusplus
extern "C"{
#endif
void linphone_quality_reporting_submit(LinphoneCall* call);
#ifdef __cplusplus
}
#endif
#endif
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