Use the c-tools for the Call object.

This commit is contained in:
Ghislain MARY 2017-09-21 15:33:44 +02:00
parent 553d8b1c3d
commit 3c28b14440
30 changed files with 3052 additions and 2829 deletions

View file

@ -169,7 +169,7 @@ static void call_received(SalOp *h) {
LinphoneCall *call = linphone_call_new_incoming(lc, fromAddr, toAddr, h);
linphone_address_unref(fromAddr);
linphone_address_unref(toAddr);
L_GET_PRIVATE(linphone_call_get_cpp_obj(call).get())->startIncomingNotification();
L_GET_PRIVATE_FROM_C_STRUCT(call, Call)->startIncomingNotification();
}
static void call_rejected(SalOp *h){

View file

@ -76,12 +76,6 @@ LinphoneInfoMessage *linphone_core_create_info_message(LinphoneCore *lc){
return belle_sip_object_new(LinphoneInfoMessage);
}
LinphoneStatus linphone_call_send_info_message(LinphoneCall *call, const LinphoneInfoMessage *info) {
SalBodyHandler *body_handler = sal_body_handler_from_content(info->content);
sal_op_set_sent_custom_header(linphone_call_get_op(call), info->headers);
return sal_send_info(linphone_call_get_op(call), NULL, NULL, body_handler);
}
void linphone_info_message_add_header(LinphoneInfoMessage *im, const char *name, const char *value){
im->headers=sal_custom_header_append(im->headers, name, value);
}
@ -98,6 +92,10 @@ const LinphoneContent * linphone_info_message_get_content(const LinphoneInfoMess
return (im->content && linphone_content_get_type(im->content)) ? im->content : NULL;
}
SalCustomHeader *linphone_info_message_get_headers (const LinphoneInfoMessage *im) {
return im->headers;
}
void linphone_core_notify_info_message(LinphoneCore* lc,SalOp *op, SalBodyHandler *body_handler){
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
if (call){

File diff suppressed because it is too large Load diff

View file

@ -454,14 +454,6 @@ int lc_callback_obj_invoke(LCCallbackObj *obj, LinphoneCore *lc){
return 0;
}
bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call){
//return TRUE if the unique(for the moment) incoming call asked to be autoanswered
if(call)
return sal_call_autoanswer_asked(linphone_call_get_op(call));
else
return FALSE;
}
int linphone_core_get_current_call_duration(const LinphoneCore *lc){
LinphoneCall *call=linphone_core_get_current_call((LinphoneCore *)lc);
if (call) return linphone_call_get_duration(call);
@ -3232,7 +3224,7 @@ void linphone_core_iterate(LinphoneCore *lc){
/* Get immediately a reference to next one in case the one we are going to examine is destroyed
* and removed during linphone_call_start_invite() */
calls = bctbx_list_next(calls);
L_GET_PRIVATE(linphone_call_get_cpp_obj(call).get())->iterate(current_real_time, one_second_elapsed);
L_GET_PRIVATE_FROM_C_STRUCT(call, Call)->iterate(current_real_time, one_second_elapsed);
}
if (linphone_core_video_preview_enabled(lc)){
@ -3558,9 +3550,9 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
if (linphone_call_params_get_local_conference_mode(params) == FALSE)
#endif
lc->current_call=call;
bool defer = L_GET_PRIVATE(linphone_call_get_cpp_obj(call).get())->initiateOutgoing();
bool defer = L_GET_PRIVATE_FROM_C_STRUCT(call, Call)->initiateOutgoing();
if (!defer) {
if (L_GET_PRIVATE(linphone_call_get_cpp_obj(call).get())->startInvite(nullptr) != 0) {
if (L_GET_PRIVATE_FROM_C_STRUCT(call, Call)->startInvite(nullptr) != 0) {
/* The call has already gone to error and released state, so do not return it */
call = nullptr;
}

View file

@ -228,19 +228,7 @@ typedef struct _PortConfig{
int rtcp_port;
}PortConfig;
struct _LinphoneCallCbs {
belle_sip_object_t base;
void *user_data;
LinphoneCallCbsDtmfReceivedCb dtmf_received_cb;
LinphoneCallCbsEncryptionChangedCb encryption_changed_cb;
LinphoneCallCbsInfoMessageReceivedCb info_message_received_cb;
LinphoneCallCbsStateChangedCb state_changed_cb;
LinphoneCallCbsStatsUpdatedCb stats_updated_cb;
LinphoneCallCbsTransferStateChangedCb transfer_state_changed_cb;
LinphoneCallCbsAckProcessingCb ack_processing;
};
LinphoneCallCbs * _linphone_call_cbs_new(void);
LinphoneCallCbs *_linphone_call_cbs_new(void);
void linphone_call_notify_state_changed(LinphoneCall *call, LinphoneCallState cstate, const char *message);
@ -416,8 +404,21 @@ LINPHONE_PUBLIC void linphone_core_enable_short_turn_refresh(LinphoneCore *lc, b
void linphone_call_update_ice_state_in_call_stats(LinphoneCall *call);
LINPHONE_PUBLIC void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev);
void linphone_call_stats_update(LinphoneCallStats *stats, MediaStream *stream);
void linphone_call_stats_uninit(LinphoneCallStats *stats);
LinphoneCallStats *_linphone_call_stats_new(void);
void _linphone_call_stats_uninit(LinphoneCallStats *stats);
void _linphone_call_stats_clone(LinphoneCallStats *dst, const LinphoneCallStats *src);
void _linphone_call_stats_set_ice_state (LinphoneCallStats *stats, LinphoneIceState state);
void _linphone_call_stats_set_type (LinphoneCallStats *stats, LinphoneStreamType type);
void _linphone_call_stats_set_received_rtcp (LinphoneCallStats *stats, mblk_t *m);
void _linphone_call_stats_set_sent_rtcp (LinphoneCallStats *stats, mblk_t *m);
int _linphone_call_stats_get_updated (const LinphoneCallStats *stats);
void _linphone_call_stats_set_updated (LinphoneCallStats *stats, int updated);
void _linphone_call_stats_set_rtp_stats (LinphoneCallStats *stats, const rtp_stats_t *rtpStats);
void _linphone_call_stats_set_download_bandwidth (LinphoneCallStats *stats, float bandwidth);
void _linphone_call_stats_set_upload_bandwidth (LinphoneCallStats *stats, float bandwidth);
void _linphone_call_stats_set_rtcp_download_bandwidth (LinphoneCallStats *stats, float bandwidth);
void _linphone_call_stats_set_rtcp_upload_bandwidth (LinphoneCallStats *stats, float bandwidth);
void _linphone_call_stats_set_ip_family_of_remote (LinphoneCallStats *stats, LinphoneAddressFamily family);
void linphone_call_update_local_media_description_from_ice_or_upnp(LinphoneCall *call);
void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md, bool_t is_offer);
void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMediaDescription *md);
@ -1520,7 +1521,6 @@ void linphone_error_info_from_sal_op(LinphoneErrorInfo *ei, const SalOp *op);
void payload_type_set_enable(OrtpPayloadType *pt, bool_t value);
bool_t payload_type_enabled(const OrtpPayloadType *pt);
bool_t is_payload_type_number_available(const MSList *l, int number, const OrtpPayloadType *ignore);
LinphonePayloadType *linphone_payload_type_new(LinphoneCore *lc, OrtpPayloadType *ortp_pt);
bool_t _linphone_core_check_payload_type_usability(const LinphoneCore *lc, const OrtpPayloadType *pt);
OrtpPayloadType *linphone_payload_type_get_ortp_pt(const LinphonePayloadType *pt);
@ -1592,40 +1592,6 @@ BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneVideoActivationPolicy);
LINPHONE_PUBLIC LinphoneVideoActivationPolicy *linphone_video_activation_policy_new(void);
/**
* The LinphoneCallStats objects carries various statistic informations regarding quality of audio or video streams.
*
* To receive these informations periodically and as soon as they are computed, the application is invited to place a #LinphoneCoreCallStatsUpdatedCb callback in the LinphoneCoreVTable structure
* it passes for instantiating the LinphoneCore object (see linphone_core_new() ).
*
* At any time, the application can access last computed statistics using linphone_call_get_audio_stats() or linphone_call_get_video_stats().
**/
struct _LinphoneCallStats {
belle_sip_object_t base;
void *user_data;
LinphoneStreamType type; /**< Type of the stream which the stats refer to */
jitter_stats_t jitter_stats; /**<jitter buffer statistics, see oRTP documentation for details */
mblk_t *received_rtcp; /**<Last RTCP packet received, as a mblk_t structure. See oRTP documentation for details how to extract information from it*/
mblk_t *sent_rtcp;/**<Last RTCP packet sent, as a mblk_t structure. See oRTP documentation for details how to extract information from it*/
float round_trip_delay; /**<Round trip propagation time in seconds if known, -1 if unknown.*/
LinphoneIceState ice_state; /**< State of ICE processing. */
LinphoneUpnpState upnp_state; /**< State of uPnP processing. */
float download_bandwidth; /**<Download bandwidth measurement of received stream, expressed in kbit/s, including IP/UDP/RTP headers*/
float upload_bandwidth; /**<Download bandwidth measurement of sent stream, expressed in kbit/s, including IP/UDP/RTP headers*/
float local_late_rate; /**<percentage of packet received too late over last second*/
float local_loss_rate; /**<percentage of lost packet over last second*/
int updated; /**< Tell which RTCP packet has been updated (received_rtcp or sent_rtcp). Can be either LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE or LINPHONE_CALL_STATS_SENT_RTCP_UPDATE */
float rtcp_download_bandwidth; /**<RTCP download bandwidth measurement of received stream, expressed in kbit/s, including IP/UDP/RTP headers*/
float rtcp_upload_bandwidth; /**<RTCP download bandwidth measurement of sent stream, expressed in kbit/s, including IP/UDP/RTP headers*/
rtp_stats_t rtp_stats; /**< RTP stats */
int rtp_remote_family; /**< Ip adress family of the remote destination */
int clockrate; /*RTP clockrate of the stream, provided here for easily converting timestamp units expressed in RTCP packets in milliseconds*/
bool_t rtcp_received_via_mux; /*private flag, for non-regression test only*/
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneCallStats);
LinphoneCallStats *linphone_call_stats_new(void);
/** Belle Sip-based objects need unique ids
*/
@ -1825,6 +1791,9 @@ const char* _linphone_config_load_from_xml_string(LpConfig *lpc, const char *buf
LinphoneNatPolicy * linphone_config_create_nat_policy_from_section(const LinphoneConfig *config, const char* section);
SalCustomHeader *linphone_info_message_get_headers (const LinphoneInfoMessage *im);
#ifdef __cplusplus
}
#endif

View file

@ -76,6 +76,9 @@ set(ROOT_HEADER_FILES
set(C_API_HEADER_FILES
c-address.h
c-api.h
c-call.h
c-call-cbs.h
c-call-stats.h
c-callbacks.h
c-chat-message.h
c-chat-message-cbs.h

View file

@ -0,0 +1,169 @@
/*
* c-call-cbs.h
* Copyright (C) 2017 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 3 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/>.
*/
#ifndef _C_CALL_CBS_H_
#define _C_CALL_CBS_H_
#include "linphone/api/c-callbacks.h"
#include "linphone/api/c-types.h"
// =============================================================================
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
/**
* @addtogroup call_control
* @{
*/
/**
* Acquire a reference to the LinphoneCallCbs object.
* @param[in] cbs LinphoneCallCbs object.
* @return The same LinphoneCallCbs object.
*/
LINPHONE_PUBLIC LinphoneCallCbs *linphone_call_cbs_ref (LinphoneCallCbs *cbs);
/**
* Release reference to the LinphoneCallCbs object.
* @param[in] cbs LinphoneCallCbs object.
*/
LINPHONE_PUBLIC void linphone_call_cbs_unref (LinphoneCallCbs *cbs);
/**
* Retrieve the user pointer associated with the LinphoneCallCbs object.
* @param[in] cbs LinphoneCallCbs object.
* @return The user pointer associated with the LinphoneCallCbs object.
*/
LINPHONE_PUBLIC void *linphone_call_cbs_get_user_data (const LinphoneCallCbs *cbs);
/**
* Assign a user pointer to the LinphoneCallCbs object.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] ud The user pointer to associate with the LinphoneCallCbs object.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_user_data (LinphoneCallCbs *cbs, void *ud);
/**
* Get the dtmf received callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current dtmf received callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsDtmfReceivedCb linphone_call_cbs_get_dtmf_received (LinphoneCallCbs *cbs);
/**
* Set the dtmf received callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The dtmf received callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_dtmf_received (LinphoneCallCbs *cbs, LinphoneCallCbsDtmfReceivedCb cb);
/**
* Get the encryption changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current encryption changed callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsEncryptionChangedCb linphone_call_cbs_get_encryption_changed (LinphoneCallCbs *cbs);
/**
* Set the encryption changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The encryption changed callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_encryption_changed (LinphoneCallCbs *cbs, LinphoneCallCbsEncryptionChangedCb cb);
/**
* Get the info message received callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current info message received callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsInfoMessageReceivedCb linphone_call_cbs_get_info_message_received (LinphoneCallCbs *cbs);
/**
* Set the info message received callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The info message received callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_info_message_received (LinphoneCallCbs *cbs, LinphoneCallCbsInfoMessageReceivedCb cb);
/**
* Get the state changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current state changed callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsStateChangedCb linphone_call_cbs_get_state_changed (LinphoneCallCbs *cbs);
/**
* Set the state changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The state changed callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_state_changed (LinphoneCallCbs *cbs, LinphoneCallCbsStateChangedCb cb);
/**
* Get the stats updated callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current stats updated callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsStatsUpdatedCb linphone_call_cbs_get_stats_updated (LinphoneCallCbs *cbs);
/**
* Set the stats updated callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The stats updated callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_stats_updated (LinphoneCallCbs *cbs, LinphoneCallCbsStatsUpdatedCb cb);
/**
* Get the transfer state changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current transfer state changed callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsTransferStateChangedCb linphone_call_cbs_get_transfer_state_changed (LinphoneCallCbs *cbs);
/**
* Set the transfer state changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The transfer state changed callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_transfer_state_changed (LinphoneCallCbs *cbs, LinphoneCallCbsTransferStateChangedCb cb);
/**
* Get the ACK processing callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current ack processing callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsAckProcessingCb linphone_call_cbs_get_ack_processing (LinphoneCallCbs *cbs);
/**
* Set ACK processing callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The ack processing callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_ack_processing (LinphoneCallCbs *cbs, LinphoneCallCbsAckProcessingCb cb);
/**
* @}
*/
#ifdef __cplusplus
}
#endif // ifdef __cplusplus
#endif // ifndef _C_CALL_CBS_H_

View file

@ -0,0 +1,201 @@
/*
* c-call-stats.h
* Copyright (C) 2017 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 3 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/>.
*/
#ifndef _C_CALL_STATS_H_
#define _C_CALL_STATS_H_
#include <ortp/rtp.h>
#include "linphone/api/c-callbacks.h"
#include "linphone/api/c-types.h"
// =============================================================================
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
/**
* @addtogroup call_misc
* @{
*/
#define LINPHONE_CALL_STATS_AUDIO ((int)LinphoneStreamTypeAudio)
#define LINPHONE_CALL_STATS_VIDEO ((int)LinphoneStreamTypeVideo)
#define LINPHONE_CALL_STATS_TEXT ((int)LinphoneStreamTypeText)
#define LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE (1 << 0) /**< received_rtcp field of LinphoneCallStats object has been updated */
#define LINPHONE_CALL_STATS_SENT_RTCP_UPDATE (1 << 1) /**< sent_rtcp field of LinphoneCallStats object has been updated */
#define LINPHONE_CALL_STATS_PERIODICAL_UPDATE (1 << 2) /**< Every seconds LinphoneCallStats object has been updated */
/**
* Increment refcount.
* @param[in] stats LinphoneCallStats object
* @ingroup misc
**/
LINPHONE_PUBLIC LinphoneCallStats *linphone_call_stats_ref (LinphoneCallStats *stats);
/**
* Decrement refcount and possibly free the object.
* @param[in] stats LinphoneCallStats object
* @ingroup misc
**/
LINPHONE_PUBLIC void linphone_call_stats_unref (LinphoneCallStats *stats);
/**
* Gets the user data in the LinphoneCallStats object
* @param[in] stats the LinphoneCallStats
* @return the user data
* @ingroup misc
*/
LINPHONE_PUBLIC void *linphone_call_stats_get_user_data (const LinphoneCallStats *stats);
/**
* Sets the user data in the LinphoneCallStats object
* @param[in] stats the LinphoneCallStats object
* @param[in] data the user data
* @ingroup misc
*/
LINPHONE_PUBLIC void linphone_call_stats_set_user_data (LinphoneCallStats *stats, void *data);
/**
* Get the type of the stream the stats refer to.
* @param[in] stats LinphoneCallStats object
* @return The type of the stream the stats refer to
*/
LINPHONE_PUBLIC LinphoneStreamType linphone_call_stats_get_type (const LinphoneCallStats *stats);
/**
* Get the local loss rate since last report
* @return The sender loss rate
**/
LINPHONE_PUBLIC float linphone_call_stats_get_sender_loss_rate (const LinphoneCallStats *stats);
/**
* Gets the remote reported loss rate since last report
* @return The receiver loss rate
**/
LINPHONE_PUBLIC float linphone_call_stats_get_receiver_loss_rate (const LinphoneCallStats *stats);
/**
* Get the local loss rate since last report
* @return The local loss rate
**/
LINPHONE_PUBLIC float linphone_call_stats_get_local_loss_rate (const LinphoneCallStats *stats);
/**
* Gets the local late rate since last report
* @return The local late rate
**/
LINPHONE_PUBLIC float linphone_call_stats_get_local_late_rate (const LinphoneCallStats *stats);
/**
* Gets the local interarrival jitter
* @param[in] stats LinphoneCallStats object
* @return The interarrival jitter at last emitted sender report
**/
LINPHONE_PUBLIC float linphone_call_stats_get_sender_interarrival_jitter (const LinphoneCallStats *stats);
/**
* Gets the remote reported interarrival jitter
* @param[in] stats LinphoneCallStats object
* @return The interarrival jitter at last received receiver report
**/
LINPHONE_PUBLIC float linphone_call_stats_get_receiver_interarrival_jitter (const LinphoneCallStats *stats);
LINPHONE_PUBLIC const rtp_stats_t *linphone_call_stats_get_rtp_stats (const LinphoneCallStats *stats);
/**
* Gets the cumulative number of late packets
* @param[in] stats LinphoneCallStats object
* @return The cumulative number of late packets
**/
LINPHONE_PUBLIC uint64_t linphone_call_stats_get_late_packets_cumulative_number (const LinphoneCallStats *stats);
/**
* Get the bandwidth measurement of the received stream, expressed in kbit/s, including IP/UDP/RTP headers.
* @param[in] stats LinphoneCallStats object
* @return The bandwidth measurement of the received stream in kbit/s.
*/
LINPHONE_PUBLIC float linphone_call_stats_get_download_bandwidth (const LinphoneCallStats *stats);
/**
* Get the bandwidth measurement of the sent stream, expressed in kbit/s, including IP/UDP/RTP headers.
* @param[in] stats LinphoneCallStats object
* @return The bandwidth measurement of the sent stream in kbit/s.
*/
LINPHONE_PUBLIC float linphone_call_stats_get_upload_bandwidth (const LinphoneCallStats *stats);
/**
* Get the bandwidth measurement of the received RTCP, expressed in kbit/s, including IP/UDP/RTP headers.
* @param[in] stats LinphoneCallStats object
* @return The bandwidth measurement of the received RTCP in kbit/s.
*/
LINPHONE_PUBLIC float linphone_call_stats_get_rtcp_download_bandwidth (const LinphoneCallStats *stats);
/**
* Get the bandwidth measurement of the sent RTCP, expressed in kbit/s, including IP/UDP/RTP headers.
* @param[in] stats LinphoneCallStats object
* @return The bandwidth measurement of the sent RTCP in kbit/s.
*/
LINPHONE_PUBLIC float linphone_call_stats_get_rtcp_upload_bandwidth( const LinphoneCallStats *stats);
/**
* Get the state of ICE processing.
* @param[in] stats LinphoneCallStats object
* @return The state of ICE processing.
*/
LINPHONE_PUBLIC LinphoneIceState linphone_call_stats_get_ice_state (const LinphoneCallStats *stats);
/**
* Get the state of uPnP processing.
* @param[in] stats LinphoneCallStats object
* @return The state of uPnP processing.
*/
LINPHONE_PUBLIC LinphoneUpnpState linphone_call_stats_get_upnp_state (const LinphoneCallStats *stats);
/**
* Get the IP address family of the remote peer.
* @param[in] stats LinphoneCallStats object
* @return The IP address family of the remote peer.
*/
LINPHONE_PUBLIC LinphoneAddressFamily linphone_call_stats_get_ip_family_of_remote (const LinphoneCallStats *stats);
/**
* Get the jitter buffer size in ms.
* @param[in] stats LinphoneCallStats object
* @return The jitter buffer size in ms.
*/
LINPHONE_PUBLIC float linphone_call_stats_get_jitter_buffer_size_ms (const LinphoneCallStats *stats);
/**
* Get the round trip delay in s.
* @param[in] stats LinphoneCallStats object
* @return The round trip delay in s.
*/
LINPHONE_PUBLIC float linphone_call_stats_get_round_trip_delay (const LinphoneCallStats *stats);
/**
* @}
*/
#ifdef __cplusplus
}
#endif // ifdef __cplusplus
#endif // ifndef _C_CALL_STATS_H_

View file

@ -0,0 +1,794 @@
/*
* c-call.h
* Copyright (C) 2017 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 3 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/>.
*/
#ifndef _C_CALL_H_
#define _C_CALL_H_
#include <ortp/rtpsession.h>
#include "linphone/api/c-types.h"
// =============================================================================
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
/**
* @addtogroup call_control
* @{
*/
/**
* Acquire a reference to the call.
* An application that wishes to retain a pointer to call object
* must use this function to unsure the pointer remains
* valid. Once the application no more needs this pointer,
* it must call linphone_call_unref().
* @param[in] call The call.
* @return The same call.
**/
LINPHONE_PUBLIC LinphoneCall *linphone_call_ref (LinphoneCall *call);
/**
* Release reference to the call.
* @param[in] call The call.
**/
LINPHONE_PUBLIC void linphone_call_unref (LinphoneCall *call);
/**
* Retrieve the user pointer associated with the call.
* @param[in] call The call.
* @return The user pointer associated with the call.
**/
LINPHONE_PUBLIC void *linphone_call_get_user_data (const LinphoneCall *call);
/**
* Assign a user pointer to the call.
* @param[in] call The call.
* @param[in] ud The user pointer to associate with the call.
**/
LINPHONE_PUBLIC void linphone_call_set_user_data (LinphoneCall *call, void *ud);
/**
* Get the core that has created the specified call.
* @param[in] call LinphoneCall object
* @return The LinphoneCore object that has created the specified call.
*/
LINPHONE_PUBLIC LinphoneCore * linphone_call_get_core (const LinphoneCall *call);
/**
* Retrieves the call's current state.
**/
LINPHONE_PUBLIC LinphoneCallState linphone_call_get_state (const LinphoneCall *call);
/**
* Tell whether a call has been asked to autoanswer
* @param[in] call LinphoneCall object
* @return A boolean value telling whether the call has been asked to autoanswer
**/
LINPHONE_PUBLIC bool_t linphone_call_asked_to_autoanswer (LinphoneCall *call);
/**
* Returns the remote address associated to this call
**/
LINPHONE_PUBLIC const LinphoneAddress *linphone_call_get_remote_address (const LinphoneCall *call);
/**
* Returns the to address with its headers associated to this call
**/
LINPHONE_PUBLIC const LinphoneAddress *linphone_call_get_to_address (const LinphoneCall * call);
/**
* Returns the value of the header name
**/
LINPHONE_PUBLIC const char *linphone_call_get_to_header (const LinphoneCall *call, const char *name);
/**
* Returns the remote address associated to this call as a string.
* The result string must be freed by user using ms_free().
**/
LINPHONE_PUBLIC char *linphone_call_get_remote_address_as_string (const LinphoneCall *call);
/**
* Returns the diversion address associated to this call
**/
LINPHONE_PUBLIC const LinphoneAddress * linphone_call_get_diversion_address (const LinphoneCall *call);
/**
* Returns direction of the call (incoming or outgoing).
**/
LINPHONE_PUBLIC LinphoneCallDir linphone_call_get_dir (const LinphoneCall *call);
/**
* Gets the call log associated to this call.
* @param[in] call LinphoneCall object
* @return The LinphoneCallLog associated with the specified LinphoneCall
**/
LINPHONE_PUBLIC LinphoneCallLog *linphone_call_get_call_log (const LinphoneCall *call);
/**
* Gets the refer-to uri (if the call was transfered).
* @param[in] call LinphoneCall object
* @return The refer-to uri of the call (if it was transfered)
**/
LINPHONE_PUBLIC const char *linphone_call_get_refer_to (const LinphoneCall *call);
/**
* 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.
**/
LINPHONE_PUBLIC bool_t linphone_call_has_transfer_pending (const LinphoneCall *call);
/**
* 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.
* @param[in] call LinphoneCall object
* @return The transferer call if the specified call was started automatically as a result of an incoming transfer request, NULL otherwise
**/
LINPHONE_PUBLIC LinphoneCall *linphone_call_get_transferer_call (const LinphoneCall *call);
/**
* When this call has received a transfer request, returns the new call that was automatically created as a result of the transfer.
**/
LINPHONE_PUBLIC LinphoneCall *linphone_call_get_transfer_target_call (const LinphoneCall *call);
/**
* 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.
**/
LINPHONE_PUBLIC LinphoneCall *linphone_call_get_replaced_call (LinphoneCall *call);
/**
* Returns call's duration in seconds.
**/
LINPHONE_PUBLIC int linphone_call_get_duration (const LinphoneCall *call);
/**
* Returns current parameters associated to the call.
**/
LINPHONE_PUBLIC const LinphoneCallParams *linphone_call_get_current_params (LinphoneCall *call);
/**
* Returns call parameters proposed by remote.
*
* This is useful when receiving an incoming call, to know whether the remote party
* supports video, encryption or whatever.
**/
LINPHONE_PUBLIC const LinphoneCallParams *linphone_call_get_remote_params (LinphoneCall *call);
/**
* Indicate whether camera input should be sent to remote end.
**/
LINPHONE_PUBLIC void linphone_call_enable_camera (LinphoneCall *lc, bool_t enabled);
/**
* Returns TRUE if camera pictures are allowed to be sent to the remote party.
**/
LINPHONE_PUBLIC bool_t linphone_call_camera_enabled (const LinphoneCall *lc);
/**
* Take a photo of currently received video and write it into a jpeg file.
* Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.
* @param call a LinphoneCall
* @param file a path where to write the jpeg content.
* @return 0 if successfull, -1 otherwise (typically if jpeg format is not supported).
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_take_video_snapshot (LinphoneCall *call, const char *file);
/**
* Take a photo of currently captured video and write it into a jpeg file.
* Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.
* @param call a LinphoneCall
* @param file a path where to write the jpeg content.
* @return 0 if successfull, -1 otherwise (typically if jpeg format is not supported).
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_take_preview_snapshot (LinphoneCall *call, const char *file);
/**
* Returns the reason for a call termination (either error or normal termination)
**/
LINPHONE_PUBLIC LinphoneReason linphone_call_get_reason (const LinphoneCall *call);
/**
* Returns full details about call errors or termination reasons.
* @param call LinphoneCall object on which we want the information error
* @return LinphoneErrorInfo object holding the reason error.
*/
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_call_get_error_info (const LinphoneCall *call);
/**
* Returns the far end's user agent description string, if available.
**/
LINPHONE_PUBLIC const char *linphone_call_get_remote_user_agent (LinphoneCall *call);
/**
* Returns the far end's sip contact as a string, if available.
**/
LINPHONE_PUBLIC const char *linphone_call_get_remote_contact (LinphoneCall *call);
/**
* Returns the ZRTP authentication token to verify.
* @param call the LinphoneCall
* @return the authentication token to verify.
**/
LINPHONE_PUBLIC const char *linphone_call_get_authentication_token (LinphoneCall *call);
/**
* Returns whether ZRTP authentication token is verified.
* If not, it must be verified by users as described in ZRTP procedure.
* Once done, the application must inform of the results with linphone_call_set_authentication_token_verified().
* @param call the LinphoneCall
* @return TRUE if authentication token is verifed, false otherwise.
**/
LINPHONE_PUBLIC bool_t linphone_call_get_authentication_token_verified (const LinphoneCall *call);
/**
* Set the result of ZRTP short code verification by user.
* If remote party also does the same, it will update the ZRTP cache so that user's verification will not be required for the two users.
* @param call the LinphoneCall
* @param verified whether the ZRTP SAS is verified.
**/
LINPHONE_PUBLIC void linphone_call_set_authentication_token_verified (LinphoneCall *call, bool_t verified);
/**
* Request remote side to send us a Video Fast Update.
**/
LINPHONE_PUBLIC void linphone_call_send_vfu_request (LinphoneCall *call);
LINPHONE_PUBLIC void linphone_call_set_next_video_frame_decoded_callback (LinphoneCall *call, LinphoneCallCbFunc cb, void *ud);
/**
* Returns the current transfer state, if a transfer has been initiated from this call.
* @see linphone_core_transfer_call() , linphone_core_transfer_call_to_another()
**/
LINPHONE_PUBLIC LinphoneCallState linphone_call_get_transfer_state (LinphoneCall *call);
/**
* Perform a zoom of the video displayed during a call.
* @param call the call.
* @param zoom_factor a floating point number describing the zoom factor. A value 1.0 corresponds to no zoom applied.
* @param cx a floating point number pointing the horizontal center of the zoom to be applied. This value should be between 0.0 and 1.0.
* @param cy a floating point number pointing the vertical center of the zoom to be applied. This value should be between 0.0 and 1.0.
*
* cx and cy are updated in return in case their coordinates were too excentrated for the requested zoom factor. The zoom ensures that all the screen is fullfilled with the video.
**/
LINPHONE_PUBLIC void linphone_call_zoom_video (LinphoneCall *call, float zoom_factor, float *cx, float *cy);
/**
* Send the specified dtmf.
*
* The dtmf is automatically played to the user.
* @param call The LinphoneCall object
* @param dtmf The dtmf name specified as a char, such as '0', '#' etc...
* @return 0 if successful, -1 on error.
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_send_dtmf (LinphoneCall *call, char dtmf);
/**
* Send a list of dtmf.
*
* The dtmfs are automatically sent to remote, separated by some needed customizable delay.
* Sending is canceled if the call state changes to something not LinphoneCallStreamsRunning.
* @param call The LinphoneCall object
* @param dtmfs A dtmf sequence such as '123#123123'
* @return -2 if there is already a DTMF sequence, -1 if call is not ready, 0 otherwise.
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_send_dtmfs (LinphoneCall *call, const char *dtmfs);
/**
* Stop current DTMF sequence sending.
*
* Please note that some DTMF could be already sent,
* depending on when this function call is delayed from #linphone_call_send_dtmfs. This
* function will be automatically called if call state change to anything but LinphoneCallStreamsRunning.
* @param call The LinphoneCall object
**/
LINPHONE_PUBLIC void linphone_call_cancel_dtmfs (LinphoneCall *call);
/**
* Return TRUE if this call is currently part of a conference
* @param call #LinphoneCall
* @return TRUE if part of a conference.
* @deprecated Use linphone_call_get_conference() instead.
* @donotwrap
*/
LINPHONE_PUBLIC LINPHONE_DEPRECATED bool_t linphone_call_is_in_conference (const LinphoneCall *call);
/**
* Return the associated conference object
* @param call #LinphoneCall
* @return A pointer on #LinphoneConference or NULL if the call is not part of any conference.
*/
LINPHONE_PUBLIC LinphoneConference *linphone_call_get_conference (const LinphoneCall *call);
/**
* Change the playback output device (currently only used for blackberry)
* @param call
* @param route the wanted audio route (earpiece, speaker, ...)
**/
LINPHONE_PUBLIC void linphone_call_set_audio_route (LinphoneCall *call, LinphoneAudioRoute route);
/**
* Returns the number of stream for the given call.
* Currently there is only two (Audio, Video), but later there will be more.
* @param call
* @return 2
**/
LINPHONE_PUBLIC int linphone_call_get_stream_count (const LinphoneCall *call);
/**
* Returns the type of stream for the given stream index.
* @param call
* @param stream_index
* @return the type (MSAudio, MSVideo, MSText) of the stream of given index.
**/
LINPHONE_PUBLIC MSFormatType linphone_call_get_stream_type (const LinphoneCall *call, int stream_index);
/**
* Returns the meta rtp transport for the given stream index.
* @param call
* @param stream_index
* @return a pointer to the meta rtp transport if it exists, NULL otherwise
**/
LINPHONE_PUBLIC RtpTransport *linphone_call_get_meta_rtp_transport (const LinphoneCall *call, int stream_index);
/**
* Returns the meta rtcp transport for the given stream index.
* @param call
* @param stream_index
* @return a pointer to the meta rtcp transport if it exists, NULL otherwise
**/
LINPHONE_PUBLIC RtpTransport *linphone_call_get_meta_rtcp_transport (const LinphoneCall *call, int stream_index);
/**
* Pauses the call. If a music file has been setup using linphone_core_set_play_file(),
* this file will be played to the remote user.
* The only way to resume a paused call is to call linphone_call_resume().
* @param[in] call LinphoneCall object
* @return 0 on success, -1 on failure
* @see linphone_call_resume()
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_pause (LinphoneCall *call);
/**
* Resumes a call.
* The call needs to have been paused previously with linphone_call_pause().
* @param[in] call LinphoneCall object
* @return 0 on success, -1 on failure
* @see linphone_call_pause()
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_resume (LinphoneCall *call);
/**
* Terminates a call.
* @param[in] call LinphoneCall object
* @return 0 on success, -1 on failure
**/LINPHONE_PUBLIC LinphoneStatus linphone_call_terminate (LinphoneCall *call);
/**
* Terminates a call.
* @param[in] call LinphoneCall object
* @param[in] ei LinphoneErrorInfo
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_terminate_with_error_info (LinphoneCall *call, const LinphoneErrorInfo *ei);
/**
* Redirect the specified call to the given redirect URI.
* @param[in] call A LinphoneCall object
* @param[in] redirect_uri The URI to redirect the call to
* @return 0 if successful, -1 on error.
*/
LINPHONE_PUBLIC LinphoneStatus linphone_call_redirect (LinphoneCall *call, const char *redirect_uri);
/**
* Decline a pending incoming call, with a reason.
* @param[in] call A LinphoneCall object that must be in the IncomingReceived state
* @param[in] reason The reason for rejecting the call: LinphoneReasonDeclined or LinphoneReasonBusy
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_decline (LinphoneCall *call, LinphoneReason reason);
/**
* Decline a pending incoming call, with a LinphoneErrorInfo object.
* @param[in] call A LinphoneCall object that must be in the IncomingReceived state
* @param[in] ei LinphoneErrorInfo containing more information on the call rejection.
* @return 0 on success, -1 on failure
*/
LINPHONE_PUBLIC int linphone_call_decline_with_error_info (LinphoneCall *call, const LinphoneErrorInfo *ei);
/**
* Accept an incoming call.
*
* Basically the application is notified of incoming calls within the
* call_state_changed callback of the #LinphoneCoreVTable structure, where it will receive
* a LinphoneCallIncoming event with the associated LinphoneCall object.
* The application can later accept the call using this method.
* @param[in] call A LinphoneCall object
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept (LinphoneCall *call);
/**
* Accept an incoming call, with parameters.
*
* Basically the application is notified of incoming calls within the
* call_state_changed callback of the #LinphoneCoreVTable structure, where it will receive
* a LinphoneCallIncoming event with the associated LinphoneCall object.
* The application can later accept the call using this method.
* @param[in] call A LinphoneCall object
* @param[in] params The specific parameters for this call, for example whether video is accepted or not. Use NULL to use default parameters
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_with_params (LinphoneCall *call, const LinphoneCallParams *params);
/**
* Accept an early media session for an incoming call.
* This is identical as calling linphone_call_accept_early_media_with_params() with NULL parameters.
* @param[in] call A LinphoneCall object
* @return 0 if successful, -1 otherwise
* @see linphone_call_accept_early_media_with_params()
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_early_media (LinphoneCall *call);
/**
* When receiving an incoming, accept to start a media session as early-media.
* This means the call is not accepted but audio & video streams can be established if the remote party supports early media.
* However, unlike after call acceptance, mic and camera input are not sent during early-media, though received audio & video are played normally.
* The call can then later be fully accepted using linphone_call_accept() or linphone_call_accept_with_params().
* @param[in] call A LinphoneCall object
* @param[in] params The call parameters to use (can be NULL)
* @return 0 if successful, -1 otherwise
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_early_media_with_params (LinphoneCall *call, const LinphoneCallParams *params);
/**
* Updates a running call according to supplied call parameters or parameters changed in the LinphoneCore.
* In this version this is limited to the following use cases:
* - setting up/down the video stream according to the video parameter of the LinphoneCallParams (see linphone_call_params_enable_video() ).
* - changing the size of the transmitted video after calling linphone_core_set_preferred_video_size()
* In case no changes are requested through the LinphoneCallParams argument, then this argument can be omitted and set to NULL.
* WARNING: Updating a call in the LinphoneCallPaused state will still result in a paused call even if the media directions set in the
* params are sendrecv. To resume a paused call, you need to call linphone_call_resume().
*
* @param[in] call A LinphoneCall object
* @param[in] params The new call parameters to use (may be NULL)
* @return 0 if successful, -1 otherwise.
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_update (LinphoneCall *call, const LinphoneCallParams *params);
/**
* When receiving a #LinphoneCallUpdatedByRemote state notification, prevent LinphoneCore from performing an automatic answer.
*
* When receiving a #LinphoneCallUpdatedByRemote state notification (ie an incoming reINVITE), the default behaviour of
* LinphoneCore is defined by the "defer_update_default" option of the "sip" section of the config. If this option is 0 (the default)
* then the LinphoneCore automatically answers the reINIVTE with call parameters unchanged.
* However when for example when the remote party updated the call to propose a video stream, it can be useful
* to prompt the user before answering. This can be achieved by calling linphone_core_defer_call_update() during
* the call state notification, to deactivate the automatic answer that would just confirm the audio but reject the video.
* Then, when the user responds to dialog prompt, it becomes possible to call linphone_call_accept_update() to answer
* the reINVITE, with eventually video enabled in the LinphoneCallParams argument.
*
* The #LinphoneCallUpdatedByRemote notification can also arrive when receiving an INVITE without SDP. In such case, an unchanged offer is made
* in the 200Ok, and when the ACK containing the SDP answer is received, #LinphoneCallUpdatedByRemote is triggered to notify the application of possible
* changes in the media session. However in such case defering the update has no meaning since we just generating an offer.
*
* @param[in] call A LinphoneCall object
* @return 0 if successful, -1 if the linphone_call_defer_update() was done outside a valid #LinphoneCallUpdatedByRemote notification
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_defer_update (LinphoneCall *call);
/**
* Accept call modifications initiated by other end.
*
* This call may be performed in response to a #LinphoneCallUpdatedByRemote state notification.
* When such notification arrives, the application can decide to call linphone_call_defer_update() so that it can
* have the time to prompt the user. linphone_call_get_remote_params() can be used to get information about the call parameters
* requested by the other party, such as whether a video stream is requested.
*
* When the user accepts or refuse the change, linphone_call_accept_update() can be done to answer to the other party.
* If params is NULL, then the same call parameters established before the update request will continue to be used (no change).
* If params is not NULL, then the update will be accepted according to the parameters passed.
* Typical example is when a user accepts to start video, then params should indicate that video stream should be used
* (see linphone_call_params_enable_video()).
* @param[in] call A LinphoneCall object
* @param[in] params A LinphoneCallParams object describing the call parameters to accept
* @return 0 if successful, -1 otherwise (actually when this function call is performed outside ot #LinphoneCallUpdatedByRemote state)
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_update (LinphoneCall *call, const LinphoneCallParams *params);
/**
* Performs a simple call transfer to the specified destination.
* The remote endpoint is expected to issue a new call to the specified destination.
* The current call remains active and thus can be later paused or terminated.
* It is possible to follow the progress of the transfer provided that transferee sends notification about it.
* In this case, the transfer_state_changed callback of the #LinphoneCoreVTable is invoked to notify of the state of the new call at the other party.
* The notified states are #LinphoneCallOutgoingInit , #LinphoneCallOutgoingProgress, #LinphoneCallOutgoingRinging and #LinphoneCallConnected.
* @param[in] call The call to be transfered
* @param[in] refer_to The destination the call is to be refered to
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_transfer (LinphoneCall *call, const char *refer_to);
/**
* Transfers a call to destination of another running call. This is used for "attended transfer" scenarios.
* The transfered call is supposed to be in paused state, so that it is able to accept the transfer immediately.
* The destination call is a call previously established to introduce the transfered person.
* This method will send a transfer request to the transfered person. The phone of the transfered is then
* expected to automatically call to the destination of the transfer. The receiver of the transfer will then automatically
* close the call with us (the 'dest' call).
* It is possible to follow the progress of the transfer provided that transferee sends notification about it.
* In this case, the transfer_state_changed callback of the #LinphoneCoreVTable is invoked to notify of the state of the new call at the other party.
* The notified states are #LinphoneCallOutgoingInit , #LinphoneCallOutgoingProgress, #LinphoneCallOutgoingRinging and #LinphoneCallConnected.
* @param[in] call A running call you want to transfer
* @param[in] dest A running call whose remote person will receive the transfer
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_transfer_to_another (LinphoneCall *call, LinphoneCall *dest);
/**
* @}
*/
/**
* @addtogroup media_parameters
* @{
*/
/**
* Get the native window handle of the video window, casted as an unsigned long.
**/
LINPHONE_PUBLIC void * linphone_call_get_native_video_window_id(const LinphoneCall *call);
/**
* Set the native video window id where the video is to be displayed.
* For MacOS, Linux, Windows: if not set or 0 a window will be automatically created, unless the special id -1 is given.
**/
LINPHONE_PUBLIC void linphone_call_set_native_video_window_id(LinphoneCall *call, void * id);
/**
* Enables or disable echo cancellation for this call
* @param call
* @param val
**/
LINPHONE_PUBLIC void linphone_call_enable_echo_cancellation(LinphoneCall *call, bool_t val) ;
/**
* Returns TRUE if echo cancellation is enabled.
**/
LINPHONE_PUBLIC bool_t linphone_call_echo_cancellation_enabled(const LinphoneCall *call);
/**
* Enables or disable echo limiter for this call
* @param call
* @param val
**/
LINPHONE_PUBLIC void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val);
/**
* Returns TRUE if echo limiter is enabled.
**/
LINPHONE_PUBLIC bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call);
/**
* @}
*/
/**
* @addtogroup call_misc
* @{
*/
/**
* Create a new chat room for messaging from a call if not already existing, else return existing one.
* No reference is given to the caller: the chat room will be deleted when the call is ended.
* @param call #LinphoneCall object
* @return #LinphoneChatRoom where messaging can take place.
*/
LINPHONE_PUBLIC LinphoneChatRoom * linphone_call_get_chat_room(LinphoneCall *call);
/**
* Get the mesured playback volume level (received from remote) in dbm0.
* @param call The call.
* @return float Volume level in percentage.
*/
LINPHONE_PUBLIC float linphone_call_get_play_volume(const LinphoneCall *call);
/**
* Get the mesured record volume level (sent to remote) in dbm0.
* @param call The call.
* @return float Volume level in percentage.
*/
LINPHONE_PUBLIC float linphone_call_get_record_volume(const LinphoneCall *call);
/**
* Get speaker volume gain.
* If the sound backend supports it, the returned gain is equal to the gain set
* with the system mixer.
* @param call The call.
* @return Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ].
* In case of failure, a negative value is returned
*/
LINPHONE_PUBLIC float linphone_call_get_speaker_volume_gain(const LinphoneCall *call);
/**
* Set speaker volume gain.
* If the sound backend supports it, the new gain will synchronized with the system mixer.
* @param call The call.
* @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ].
*/
LINPHONE_PUBLIC void linphone_call_set_speaker_volume_gain(LinphoneCall *call, float volume);
/**
* Get microphone volume gain.
* If the sound backend supports it, the returned gain is equal to the gain set
* with the system mixer.
* @param call The call.
* @return double Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ].
* In case of failure, a negative value is returned
*/
LINPHONE_PUBLIC float linphone_call_get_microphone_volume_gain(const LinphoneCall *call);
/**
* Set microphone volume gain.
* If the sound backend supports it, the new gain will synchronized with the system mixer.
* @param call The call.
* @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ].
*/
LINPHONE_PUBLIC void linphone_call_set_microphone_volume_gain(LinphoneCall *call, float volume);
/**
* 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 <br>
* 3-4 = average quality <br>
* 2-3 = poor quality <br>
* 1-2 = very poor quality <br>
* 0-1 = can't be worse, mostly unusable <br>
*
* @return The function returns -1 if no quality measurement is available, for example if no
* active audio stream exist. Otherwise it returns the quality rating.
**/
LINPHONE_PUBLIC float linphone_call_get_current_quality(const LinphoneCall *call);
/**
* Returns call quality averaged over all the duration of the call.
*
* See linphone_call_get_current_quality() for more details about quality measurement.
**/
LINPHONE_PUBLIC float linphone_call_get_average_quality(const LinphoneCall *call);
/**
* Start call recording.
* The output file where audio is recorded must be previously specified with linphone_call_params_set_record_file().
**/
LINPHONE_PUBLIC void linphone_call_start_recording(LinphoneCall *call);
/**
* Stop call recording.
**/
LINPHONE_PUBLIC void linphone_call_stop_recording(LinphoneCall *call);
/**
* Get a player associated with the call to play a local file and stream it to the remote peer.
* @param[in] call LinphoneCall object
* @return A LinphonePlayer object
*/
LINPHONE_PUBLIC LinphonePlayer * linphone_call_get_player(LinphoneCall *call);
/**
* Indicates whether an operation is in progress at the media side.
* It can be a bad idea to initiate signaling operations (adding video, pausing the call, removing video, changing video parameters) while
* the media is busy in establishing the connection (typically ICE connectivity checks). It can result in failures generating loss of time
* in future operations in the call.
* Applications are invited to check this function after each call state change to decide whether certain operations are permitted or not.
* @param call the call
* @return TRUE if media is busy in establishing the connection, FALSE otherwise.
**/
LINPHONE_PUBLIC bool_t linphone_call_media_in_progress(const LinphoneCall *call);
/**
* Call generic OpenGL render for a given call.
* @param call The call.
*/
LINPHONE_PUBLIC void linphone_call_ogl_render(const LinphoneCall *call);
/**
* Send a LinphoneInfoMessage through an established call
* @param call the call
* @param info the info message
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_send_info_message(LinphoneCall *call, const LinphoneInfoMessage *info);
/**
* Return a copy of the call statistics for a particular stream type.
* @param call the call
* @param type the stream type
**/
LINPHONE_PUBLIC LinphoneCallStats *linphone_call_get_stats(LinphoneCall *call, LinphoneStreamType type);
LINPHONE_PUBLIC LinphoneCallStats *linphone_call_get_audio_stats(LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCallStats *linphone_call_get_video_stats(LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCallStats *linphone_call_get_text_stats(LinphoneCall *call);
/**
* Add a listener in order to be notified of LinphoneCall events. Once an event is received, registred LinphoneCallCbs are
* invoked sequencially.
* @param[in] call LinphoneCall object to monitor.
* @param[in] cbs A LinphoneCallCbs object holding the callbacks you need. A reference is taken by the LinphoneCall until you invoke linphone_call_remove_callbacks().
*/
LINPHONE_PUBLIC void linphone_call_add_callbacks(LinphoneCall *call, LinphoneCallCbs *cbs);
/**
* Remove a listener from a LinphoneCall
* @param[in] call LinphoneCall object
* @param[in] cbs LinphoneCallCbs object to remove.
*/
LINPHONE_PUBLIC void linphone_call_remove_callbacks(LinphoneCall *call, LinphoneCallCbs *cbs);
/**
* Gets the current LinphoneCallCbs.
* This is meant only to be called from a callback to be able to get the user_data associated with the LinphoneCallCbs that is calling the callback.
* @param[in] call LinphoneCall object
* @return The LinphoneCallCbs that has called the last callback
*/
LINPHONE_PUBLIC LinphoneCallCbs *linphone_call_get_current_callbacks(const LinphoneCall *call);
/**
* Set call parameters - advanced and not recommended feature - use with caution.
* Local call parameters applicable to an outgoing or incoming shall usually be passed to linphone_core_invite_address_with_params() or
* linphone_call_accept_with_params().
* However, in some cases it might be desirable from a software design standpoint to modify local parameters outside of the application layer, typically
* in the purpose of implementing a custom logic including special headers in INVITE or 200Ok requests, driven by a call_state_changed listener method.
* This function accepts to assign a new LinphoneCallParams only in LinphoneCallOutgoingInit and LinphoneCallIncomingReceived states.
* @param call the LinphoneCall object
**/
LINPHONE_PUBLIC void linphone_call_set_params(LinphoneCall *call, const LinphoneCallParams *params);
/**
* Returns local parameters associated with the call.
* This is typically the parameters passed at call initiation to linphone_core_invite_address_with_params() or linphone_call_accept_with_params(), or some default
* parameters if no LinphoneCallParams was explicitely passed during call initiation.
* @param call the LinphoneCall object
* @return the call's local parameters.
**/
LINPHONE_PUBLIC const LinphoneCallParams * linphone_call_get_params(LinphoneCall *call);
/**
* @}
*/
#ifdef __cplusplus
}
#endif // ifdef __cplusplus
#endif // ifndef _C_CALL_H_

View file

@ -29,6 +29,68 @@
extern "C" {
#endif // ifdef __cplusplus
/**
* @addtogroup call_control
* @{
**/
/**
* Callback for being notified of received DTMFs.
* @param call LinphoneCall object that received the dtmf
* @param dtmf The ascii code of the dtmf
*/
typedef void (*LinphoneCallCbsDtmfReceivedCb)(LinphoneCall *call, int dtmf);
/**
* Call encryption changed callback.
* @param call LinphoneCall object whose encryption is changed.
* @param on Whether encryption is activated.
* @param authentication_token An authentication_token, currently set for ZRTP kind of encryption only.
*/
typedef void (*LinphoneCallCbsEncryptionChangedCb)(LinphoneCall *call, bool_t on, const char *authentication_token);
/**
* Callback for receiving info messages.
* @param call LinphoneCall whose info message belongs to.
* @param msg LinphoneInfoMessage object.
*/
typedef void (*LinphoneCallCbsInfoMessageReceivedCb)(LinphoneCall *call, const LinphoneInfoMessage *msg);
/**
* Call state notification callback.
* @param call LinphoneCall whose state is changed.
* @param cstate The new state of the call
* @param message An informational message about the state.
*/
typedef void (*LinphoneCallCbsStateChangedCb)(LinphoneCall *call, LinphoneCallState cstate, const char *message);
/**
* Callback for receiving quality statistics for calls.
* @param call LinphoneCall object whose statistics are notified
* @param stats LinphoneCallStats object
*/
typedef void (*LinphoneCallCbsStatsUpdatedCb)(LinphoneCall *call, const LinphoneCallStats *stats);
/**
* Callback for notifying progresses of transfers.
* @param call LinphoneCall that was transfered
* @param cstate The state of the call to transfer target at the far end.
*/
typedef void (*LinphoneCallCbsTransferStateChangedCb)(LinphoneCall *call, LinphoneCallState cstate);
/**
* Callback for notifying the processing SIP ACK messages.
* @param call LinphoneCall for which an ACK is being received or sent
* @param ack the ACK message
* @param is_received if TRUE this ACK is an incoming one, otherwise it is an ACK about to be sent.
*/
typedef void (*LinphoneCallCbsAckProcessingCb)(LinphoneCall *call, LinphoneHeaders *ack, bool_t is_received);
/**
* @}
**/
/**
* @addtogroup chatroom
* @{

View file

@ -69,11 +69,24 @@ typedef unsigned char bool_t;
*/
typedef struct _LinphoneAddress LinphoneAddress;
/**
* The LinphoneCall object represents a call issued or received by the LinphoneCore
* @ingroup call_control
**/
typedef struct _LinphoneCall LinphoneCall;
// -----------------------------------------------------------------------------
// Chatroom.
// -----------------------------------------------------------------------------
/** Callback prototype */
typedef void (*LinphoneCallCbFunc) (LinphoneCall *call, void *ud);
/**
* That class holds all the callbacks which are called by LinphoneCall objects.
*
* Use linphone_factory_create_call_cbs() to create an instance. Then, call the
* callback setters on the events you need to monitor and pass the object to
* a LinphoneCall instance through linphone_call_add_callbacks().
* @ingroup call_control
*/
typedef struct _LinphoneCallCbs LinphoneCallCbs;
/**
* A chat room is the place where text messages are exchanged.

View file

@ -20,910 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef LINPHONE_CALL_H
#define LINPHONE_CALL_H
#include <mediastreamer2/mscommon.h>
#include "linphone/types.h"
/**
* @addtogroup call_control
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* Acquire a reference to the call.
* An application that wishes to retain a pointer to call object
* must use this function to unsure the pointer remains
* valid. Once the application no more needs this pointer,
* it must call linphone_call_unref().
* @param[in] call The call.
* @return The same call.
**/
LINPHONE_PUBLIC LinphoneCall * linphone_call_ref(LinphoneCall *call);
/**
* Release reference to the call.
* @param[in] call The call.
**/
LINPHONE_PUBLIC void linphone_call_unref(LinphoneCall *call);
/**
* Retrieve the user pointer associated with the call.
* @param[in] call The call.
* @return The user pointer associated with the call.
**/
LINPHONE_PUBLIC void * linphone_call_get_user_data(const LinphoneCall *call);
/**
* Assign a user pointer to the call.
* @param[in] call The call.
* @param[in] ud The user pointer to associate with the call.
**/
LINPHONE_PUBLIC void linphone_call_set_user_data(LinphoneCall *call, void *ud);
/**
* Get the core that has created the specified call.
* @param[in] call LinphoneCall object
* @return The LinphoneCore object that has created the specified call.
*/
LINPHONE_PUBLIC LinphoneCore * linphone_call_get_core(const LinphoneCall *call);
/**
* Retrieves the call's current state.
**/
LINPHONE_PUBLIC LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
/**
* Tell whether a call has been asked to autoanswer
* @param[in] call LinphoneCall object
* @return A boolean value telling whether the call has been asked to autoanswer
**/
LINPHONE_PUBLIC bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
/**
* Returns the remote address associated to this call
**/
LINPHONE_PUBLIC const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
/**
* Returns the to address with its headers associated to this call
**/
LINPHONE_PUBLIC const LinphoneAddress * linphone_call_get_to_address(const LinphoneCall * call);
/**
* Returns the value of the header name
**/
LINPHONE_PUBLIC const char * linphone_call_get_to_header(const LinphoneCall *call, const char *name);
/**
* Returns the remote address associated to this call as a string.
* The result string must be freed by user using ms_free().
**/
LINPHONE_PUBLIC char * linphone_call_get_remote_address_as_string(const LinphoneCall *call);
/**
* Returns the diversion address associated to this call
**/
LINPHONE_PUBLIC const LinphoneAddress * linphone_call_get_diversion_address(const LinphoneCall *call);
/**
* Returns direction of the call (incoming or outgoing).
**/
LINPHONE_PUBLIC LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call);
/**
* Gets the call log associated to this call.
* @param[in] call LinphoneCall object
* @return The LinphoneCallLog associated with the specified LinphoneCall
**/
LINPHONE_PUBLIC LinphoneCallLog * linphone_call_get_call_log(const LinphoneCall *call);
/**
* Gets the refer-to uri (if the call was transfered).
* @param[in] call LinphoneCall object
* @return The refer-to uri of the call (if it was transfered)
**/
LINPHONE_PUBLIC const char * linphone_call_get_refer_to(const LinphoneCall *call);
/**
* 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.
**/
LINPHONE_PUBLIC bool_t linphone_call_has_transfer_pending(const LinphoneCall *call);
/**
* 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.
* @param[in] call LinphoneCall object
* @return The transferer call if the specified call was started automatically as a result of an incoming transfer request, NULL otherwise
**/
LINPHONE_PUBLIC LinphoneCall * linphone_call_get_transferer_call(const LinphoneCall *call);
/**
* When this call has received a transfer request, returns the new call that was automatically created as a result of the transfer.
**/
LINPHONE_PUBLIC LinphoneCall * linphone_call_get_transfer_target_call(const LinphoneCall *call);
/**
* 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.
**/
LINPHONE_PUBLIC LinphoneCall * linphone_call_get_replaced_call(LinphoneCall *call);
/**
* Returns call's duration in seconds.
**/
LINPHONE_PUBLIC int linphone_call_get_duration(const LinphoneCall *call);
/**
* Returns current parameters associated to the call.
**/
LINPHONE_PUBLIC const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call);
/**
* Returns call parameters proposed by remote.
*
* This is useful when receiving an incoming call, to know whether the remote party
* supports video, encryption or whatever.
**/
LINPHONE_PUBLIC const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call);
/**
* Indicate whether camera input should be sent to remote end.
**/
LINPHONE_PUBLIC void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
/**
* Returns TRUE if camera pictures are allowed to be sent to the remote party.
**/
LINPHONE_PUBLIC bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
/**
* Take a photo of currently received video and write it into a jpeg file.
* Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.
* @param call a LinphoneCall
* @param file a path where to write the jpeg content.
* @return 0 if successfull, -1 otherwise (typically if jpeg format is not supported).
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
/**
* Take a photo of currently captured video and write it into a jpeg file.
* Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.
* @param call a LinphoneCall
* @param file a path where to write the jpeg content.
* @return 0 if successfull, -1 otherwise (typically if jpeg format is not supported).
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_take_preview_snapshot(LinphoneCall *call, const char *file);
/**
* Returns the reason for a call termination (either error or normal termination)
**/
LINPHONE_PUBLIC LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
/**
* Returns full details about call errors or termination reasons.
* @param call LinphoneCall object on which we want the information error
* @return LinphoneErrorInfo object holding the reason error.
*/
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_call_get_error_info(const LinphoneCall *call);
/**
* Returns the far end's user agent description string, if available.
**/
LINPHONE_PUBLIC const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
/**
* Returns the far end's sip contact as a string, if available.
**/
LINPHONE_PUBLIC const char *linphone_call_get_remote_contact(LinphoneCall *call);
/**
* Returns the ZRTP authentication token to verify.
* @param call the LinphoneCall
* @return the authentication token to verify.
**/
LINPHONE_PUBLIC const char * linphone_call_get_authentication_token(LinphoneCall *call);
/**
* Returns whether ZRTP authentication token is verified.
* If not, it must be verified by users as described in ZRTP procedure.
* Once done, the application must inform of the results with linphone_call_set_authentication_token_verified().
* @param call the LinphoneCall
* @return TRUE if authentication token is verifed, false otherwise.
**/
LINPHONE_PUBLIC bool_t linphone_call_get_authentication_token_verified(const LinphoneCall *call);
/**
* Set the result of ZRTP short code verification by user.
* If remote party also does the same, it will update the ZRTP cache so that user's verification will not be required for the two users.
* @param call the LinphoneCall
* @param verified whether the ZRTP SAS is verified.
**/
LINPHONE_PUBLIC void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t verified);
/**
* Request remote side to send us a Video Fast Update.
**/
LINPHONE_PUBLIC void linphone_call_send_vfu_request(LinphoneCall *call);
/** @deprecated Use linphone_call_get_user_data() instead. */
#define linphone_call_get_user_pointer(call) linphone_call_get_user_data(call)
/** @deprecated Use linphone_call_set_user_data() instead. */
#define linphone_call_set_user_pointer(call, ud) linphone_call_set_user_data(call, ud)
LINPHONE_PUBLIC void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void *user_data);
/**
* Returns the current transfer state, if a transfer has been initiated from this call.
* @see linphone_core_transfer_call() , linphone_core_transfer_call_to_another()
**/
LINPHONE_PUBLIC LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call);
/**
* Perform a zoom of the video displayed during a call.
* @param call the call.
* @param zoom_factor a floating point number describing the zoom factor. A value 1.0 corresponds to no zoom applied.
* @param cx a floating point number pointing the horizontal center of the zoom to be applied. This value should be between 0.0 and 1.0.
* @param cy a floating point number pointing the vertical center of the zoom to be applied. This value should be between 0.0 and 1.0.
*
* cx and cy are updated in return in case their coordinates were too excentrated for the requested zoom factor. The zoom ensures that all the screen is fullfilled with the video.
**/
LINPHONE_PUBLIC void linphone_call_zoom_video(LinphoneCall *call, float zoom_factor, float *cx, float *cy);
/**
* Send the specified dtmf.
*
* The dtmf is automatically played to the user.
* @param call The LinphoneCall object
* @param dtmf The dtmf name specified as a char, such as '0', '#' etc...
* @return 0 if successful, -1 on error.
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_send_dtmf(LinphoneCall *call, char dtmf);
/**
* Send a list of dtmf.
*
* The dtmfs are automatically sent to remote, separated by some needed customizable delay.
* Sending is canceled if the call state changes to something not LinphoneCallStreamsRunning.
* @param call The LinphoneCall object
* @param dtmfs A dtmf sequence such as '123#123123'
* @return -2 if there is already a DTMF sequence, -1 if call is not ready, 0 otherwise.
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_send_dtmfs(LinphoneCall *call, const char *dtmfs);
/**
* Stop current DTMF sequence sending.
*
* Please note that some DTMF could be already sent,
* depending on when this function call is delayed from #linphone_call_send_dtmfs. This
* function will be automatically called if call state change to anything but LinphoneCallStreamsRunning.
* @param call The LinphoneCall object
**/
LINPHONE_PUBLIC void linphone_call_cancel_dtmfs(LinphoneCall *call);
/**
* Return TRUE if this call is currently part of a conference
* @param call #LinphoneCall
* @return TRUE if part of a conference.
* @deprecated Use linphone_call_get_conference() instead.
* @donotwrap
*/
LINPHONE_PUBLIC LINPHONE_DEPRECATED bool_t linphone_call_is_in_conference(const LinphoneCall *call);
/**
* Return the associated conference object
* @param call #LinphoneCall
* @return A pointer on #LinphoneConference or NULL if the call is not part of any conference.
*/
LINPHONE_PUBLIC LinphoneConference * linphone_call_get_conference(const LinphoneCall *call);
/**
* Change the playback output device (currently only used for blackberry)
* @param call
* @param route the wanted audio route (earpiece, speaker, ...)
**/
LINPHONE_PUBLIC void linphone_call_set_audio_route(LinphoneCall *call, LinphoneAudioRoute route);
/**
* Returns the number of stream for the given call.
* Currently there is only two (Audio, Video), but later there will be more.
* @param call
* @return 2
**/
LINPHONE_PUBLIC int linphone_call_get_stream_count(const LinphoneCall *call);
/**
* Returns the type of stream for the given stream index.
* @param call
* @param stream_index
* @return the type (MSAudio, MSVideo, MSText) of the stream of given index.
**/
LINPHONE_PUBLIC MSFormatType linphone_call_get_stream_type(const LinphoneCall *call, int stream_index);
/**
* Returns the meta rtp transport for the given stream index.
* @param call
* @param stream_index
* @return a pointer to the meta rtp transport if it exists, NULL otherwise
**/
LINPHONE_PUBLIC RtpTransport * linphone_call_get_meta_rtp_transport(const LinphoneCall *call, int stream_index);
/**
* Returns the meta rtcp transport for the given stream index.
* @param call
* @param stream_index
* @return a pointer to the meta rtcp transport if it exists, NULL otherwise
**/
LINPHONE_PUBLIC RtpTransport * linphone_call_get_meta_rtcp_transport(const LinphoneCall *call, int stream_index);
/**
* Pauses the call. If a music file has been setup using linphone_core_set_play_file(),
* this file will be played to the remote user.
* The only way to resume a paused call is to call linphone_call_resume().
* @param[in] call LinphoneCall object
* @return 0 on success, -1 on failure
* @see linphone_call_resume()
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_pause(LinphoneCall *call);
/**
* Resumes a call.
* The call needs to have been paused previously with linphone_call_pause().
* @param[in] call LinphoneCall object
* @return 0 on success, -1 on failure
* @see linphone_call_pause()
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_resume(LinphoneCall *call);
/**
* Terminates a call.
* @param[in] call LinphoneCall object
* @return 0 on success, -1 on failure
**/LINPHONE_PUBLIC LinphoneStatus linphone_call_terminate(LinphoneCall *call);
/**
* Terminates a call.
* @param[in] call LinphoneCall object
* @param[in] ei LinphoneErrorInfo
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_terminate_with_error_info(LinphoneCall *call, const LinphoneErrorInfo *ei);
/**
* Redirect the specified call to the given redirect URI.
* @param[in] call A LinphoneCall object
* @param[in] redirect_uri The URI to redirect the call to
* @return 0 if successful, -1 on error.
*/
LINPHONE_PUBLIC LinphoneStatus linphone_call_redirect(LinphoneCall *call, const char *redirect_uri);
/**
* Decline a pending incoming call, with a reason.
* @param[in] call A LinphoneCall object that must be in the IncomingReceived state
* @param[in] reason The reason for rejecting the call: LinphoneReasonDeclined or LinphoneReasonBusy
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_decline(LinphoneCall * call, LinphoneReason reason);
/**
* Decline a pending incoming call, with a LinphoneErrorInfo object.
* @param[in] call A LinphoneCall object that must be in the IncomingReceived state
* @param[in] ei LinphoneErrorInfo containing more information on the call rejection.
* @return 0 on success, -1 on failure
*/
LINPHONE_PUBLIC int linphone_call_decline_with_error_info(LinphoneCall * call, const LinphoneErrorInfo *ei);
/**
* Accept an incoming call.
*
* Basically the application is notified of incoming calls within the
* call_state_changed callback of the #LinphoneCoreVTable structure, where it will receive
* a LinphoneCallIncoming event with the associated LinphoneCall object.
* The application can later accept the call using this method.
* @param[in] call A LinphoneCall object
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept(LinphoneCall *call);
/**
* Accept an incoming call, with parameters.
*
* Basically the application is notified of incoming calls within the
* call_state_changed callback of the #LinphoneCoreVTable structure, where it will receive
* a LinphoneCallIncoming event with the associated LinphoneCall object.
* The application can later accept the call using this method.
* @param[in] call A LinphoneCall object
* @param[in] params The specific parameters for this call, for example whether video is accepted or not. Use NULL to use default parameters
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_with_params(LinphoneCall *call, const LinphoneCallParams *params);
/**
* Accept an early media session for an incoming call.
* This is identical as calling linphone_call_accept_early_media_with_params() with NULL parameters.
* @param[in] call A LinphoneCall object
* @return 0 if successful, -1 otherwise
* @see linphone_call_accept_early_media_with_params()
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_early_media(LinphoneCall *call);
/**
* When receiving an incoming, accept to start a media session as early-media.
* This means the call is not accepted but audio & video streams can be established if the remote party supports early media.
* However, unlike after call acceptance, mic and camera input are not sent during early-media, though received audio & video are played normally.
* The call can then later be fully accepted using linphone_call_accept() or linphone_call_accept_with_params().
* @param[in] call A LinphoneCall object
* @param[in] params The call parameters to use (can be NULL)
* @return 0 if successful, -1 otherwise
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_early_media_with_params(LinphoneCall *call, const LinphoneCallParams *params);
/**
* Updates a running call according to supplied call parameters or parameters changed in the LinphoneCore.
* In this version this is limited to the following use cases:
* - setting up/down the video stream according to the video parameter of the LinphoneCallParams (see linphone_call_params_enable_video() ).
* - changing the size of the transmitted video after calling linphone_core_set_preferred_video_size()
* In case no changes are requested through the LinphoneCallParams argument, then this argument can be omitted and set to NULL.
* WARNING: Updating a call in the LinphoneCallPaused state will still result in a paused call even if the media directions set in the
* params are sendrecv. To resume a paused call, you need to call linphone_call_resume().
*
* @param[in] call A LinphoneCall object
* @param[in] params The new call parameters to use (may be NULL)
* @return 0 if successful, -1 otherwise.
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_update(LinphoneCall *call, const LinphoneCallParams *params);
/**
* When receiving a #LinphoneCallUpdatedByRemote state notification, prevent LinphoneCore from performing an automatic answer.
*
* When receiving a #LinphoneCallUpdatedByRemote state notification (ie an incoming reINVITE), the default behaviour of
* LinphoneCore is defined by the "defer_update_default" option of the "sip" section of the config. If this option is 0 (the default)
* then the LinphoneCore automatically answers the reINIVTE with call parameters unchanged.
* However when for example when the remote party updated the call to propose a video stream, it can be useful
* to prompt the user before answering. This can be achieved by calling linphone_core_defer_call_update() during
* the call state notification, to deactivate the automatic answer that would just confirm the audio but reject the video.
* Then, when the user responds to dialog prompt, it becomes possible to call linphone_call_accept_update() to answer
* the reINVITE, with eventually video enabled in the LinphoneCallParams argument.
*
* The #LinphoneCallUpdatedByRemote notification can also arrive when receiving an INVITE without SDP. In such case, an unchanged offer is made
* in the 200Ok, and when the ACK containing the SDP answer is received, #LinphoneCallUpdatedByRemote is triggered to notify the application of possible
* changes in the media session. However in such case defering the update has no meaning since we just generating an offer.
*
* @param[in] call A LinphoneCall object
* @return 0 if successful, -1 if the linphone_call_defer_update() was done outside a valid #LinphoneCallUpdatedByRemote notification
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_defer_update(LinphoneCall *call);
/**
* Accept call modifications initiated by other end.
*
* This call may be performed in response to a #LinphoneCallUpdatedByRemote state notification.
* When such notification arrives, the application can decide to call linphone_call_defer_update() so that it can
* have the time to prompt the user. linphone_call_get_remote_params() can be used to get information about the call parameters
* requested by the other party, such as whether a video stream is requested.
*
* When the user accepts or refuse the change, linphone_call_accept_update() can be done to answer to the other party.
* If params is NULL, then the same call parameters established before the update request will continue to be used (no change).
* If params is not NULL, then the update will be accepted according to the parameters passed.
* Typical example is when a user accepts to start video, then params should indicate that video stream should be used
* (see linphone_call_params_enable_video()).
* @param[in] call A LinphoneCall object
* @param[in] params A LinphoneCallParams object describing the call parameters to accept
* @return 0 if successful, -1 otherwise (actually when this function call is performed outside ot #LinphoneCallUpdatedByRemote state)
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_accept_update(LinphoneCall *call, const LinphoneCallParams *params);
/**
* Performs a simple call transfer to the specified destination.
* The remote endpoint is expected to issue a new call to the specified destination.
* The current call remains active and thus can be later paused or terminated.
* It is possible to follow the progress of the transfer provided that transferee sends notification about it.
* In this case, the transfer_state_changed callback of the #LinphoneCoreVTable is invoked to notify of the state of the new call at the other party.
* The notified states are #LinphoneCallOutgoingInit , #LinphoneCallOutgoingProgress, #LinphoneCallOutgoingRinging and #LinphoneCallConnected.
* @param[in] call The call to be transfered
* @param[in] refer_to The destination the call is to be refered to
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_transfer(LinphoneCall *call, const char *refer_to);
/**
* Transfers a call to destination of another running call. This is used for "attended transfer" scenarios.
* The transfered call is supposed to be in paused state, so that it is able to accept the transfer immediately.
* The destination call is a call previously established to introduce the transfered person.
* This method will send a transfer request to the transfered person. The phone of the transfered is then
* expected to automatically call to the destination of the transfer. The receiver of the transfer will then automatically
* close the call with us (the 'dest' call).
* It is possible to follow the progress of the transfer provided that transferee sends notification about it.
* In this case, the transfer_state_changed callback of the #LinphoneCoreVTable is invoked to notify of the state of the new call at the other party.
* The notified states are #LinphoneCallOutgoingInit , #LinphoneCallOutgoingProgress, #LinphoneCallOutgoingRinging and #LinphoneCallConnected.
* @param[in] call A running call you want to transfer
* @param[in] dest A running call whose remote person will receive the transfer
* @return 0 on success, -1 on failure
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_transfer_to_another(LinphoneCall *call, LinphoneCall *dest);
/**
* Acquire a reference to the LinphoneCallCbs object.
* @param[in] cbs LinphoneCallCbs object.
* @return The same LinphoneCallCbs object.
*/
LINPHONE_PUBLIC LinphoneCallCbs *linphone_call_cbs_ref(LinphoneCallCbs *cbs);
/**
* Release reference to the LinphoneCallCbs object.
* @param[in] cbs LinphoneCallCbs object.
*/
LINPHONE_PUBLIC void linphone_call_cbs_unref(LinphoneCallCbs *cbs);
/**
* Retrieve the user pointer associated with the LinphoneCallCbs object.
* @param[in] cbs LinphoneCallCbs object.
* @return The user pointer associated with the LinphoneCallCbs object.
*/
LINPHONE_PUBLIC void *linphone_call_cbs_get_user_data(const LinphoneCallCbs *cbs);
/**
* Assign a user pointer to the LinphoneCallCbs object.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] ud The user pointer to associate with the LinphoneCallCbs object.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_user_data(LinphoneCallCbs *cbs, void *user_data);
/**
* Get the dtmf received callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current dtmf received callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsDtmfReceivedCb linphone_call_cbs_get_dtmf_received(LinphoneCallCbs *cbs);
/**
* Set the dtmf received callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The dtmf received callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_dtmf_received(LinphoneCallCbs *cbs, LinphoneCallCbsDtmfReceivedCb cb);
/**
* Get the encryption changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current encryption changed callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsEncryptionChangedCb linphone_call_cbs_get_encryption_changed(LinphoneCallCbs *cbs);
/**
* Set the encryption changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The encryption changed callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_encryption_changed(LinphoneCallCbs *cbs, LinphoneCallCbsEncryptionChangedCb cb);
/**
* Get the info message received callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current info message received callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsInfoMessageReceivedCb linphone_call_cbs_get_info_message_received(LinphoneCallCbs *cbs);
/**
* Set the info message received callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The info message received callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_info_message_received(LinphoneCallCbs *cbs, LinphoneCallCbsInfoMessageReceivedCb cb);
/**
* Get the state changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current state changed callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsStateChangedCb linphone_call_cbs_get_state_changed(LinphoneCallCbs *cbs);
/**
* Set the state changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The state changed callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_state_changed(LinphoneCallCbs *cbs, LinphoneCallCbsStateChangedCb cb);
/**
* Get the stats updated callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current stats updated callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsStatsUpdatedCb linphone_call_cbs_get_stats_updated(LinphoneCallCbs *cbs);
/**
* Set the stats updated callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The stats updated callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_stats_updated(LinphoneCallCbs *cbs, LinphoneCallCbsStatsUpdatedCb cb);
/**
* Get the transfer state changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current transfer state changed callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsTransferStateChangedCb linphone_call_cbs_get_transfer_state_changed(LinphoneCallCbs *cbs);
/**
* Set the transfer state changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The transfer state changed callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_transfer_state_changed(LinphoneCallCbs *cbs, LinphoneCallCbsTransferStateChangedCb cb);
/**
* Get the ACK processing callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current ack processing callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsAckProcessingCb linphone_call_cbs_get_ack_processing(LinphoneCallCbs *cbs);
/**
* Set ACK processing callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The ack processing callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_ack_processing(LinphoneCallCbs *cbs, LinphoneCallCbsAckProcessingCb cb);
/**
* @}
*/
/**
* @addtogroup media_parameters
* @{
*/
/**
* Get the native window handle of the video window, casted as an unsigned long.
**/
LINPHONE_PUBLIC void * linphone_call_get_native_video_window_id(const LinphoneCall *call);
/**
* Set the native video window id where the video is to be displayed.
* For MacOS, Linux, Windows: if not set or 0 a window will be automatically created, unless the special id -1 is given.
**/
LINPHONE_PUBLIC void linphone_call_set_native_video_window_id(LinphoneCall *call, void * id);
/**
* Enables or disable echo cancellation for this call
* @param call
* @param val
**/
LINPHONE_PUBLIC void linphone_call_enable_echo_cancellation(LinphoneCall *call, bool_t val) ;
/**
* Returns TRUE if echo cancellation is enabled.
**/
LINPHONE_PUBLIC bool_t linphone_call_echo_cancellation_enabled(const LinphoneCall *call);
/**
* Enables or disable echo limiter for this call
* @param call
* @param val
**/
LINPHONE_PUBLIC void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val);
/**
* Returns TRUE if echo limiter is enabled.
**/
LINPHONE_PUBLIC bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call);
/**
* @}
*/
/**
* @addtogroup call_misc
* @{
*/
/**
* Create a new chat room for messaging from a call if not already existing, else return existing one.
* No reference is given to the caller: the chat room will be deleted when the call is ended.
* @param call #LinphoneCall object
* @return #LinphoneChatRoom where messaging can take place.
*/
LINPHONE_PUBLIC LinphoneChatRoom * linphone_call_get_chat_room(LinphoneCall *call);
/**
* Get the mesured playback volume level (received from remote) in dbm0.
* @param call The call.
* @return float Volume level in percentage.
*/
LINPHONE_PUBLIC float linphone_call_get_play_volume(const LinphoneCall *call);
/**
* Get the mesured record volume level (sent to remote) in dbm0.
* @param call The call.
* @return float Volume level in percentage.
*/
LINPHONE_PUBLIC float linphone_call_get_record_volume(const LinphoneCall *call);
/**
* Get speaker volume gain.
* If the sound backend supports it, the returned gain is equal to the gain set
* with the system mixer.
* @param call The call.
* @return Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ].
* In case of failure, a negative value is returned
*/
LINPHONE_PUBLIC float linphone_call_get_speaker_volume_gain(const LinphoneCall *call);
/**
* Set speaker volume gain.
* If the sound backend supports it, the new gain will synchronized with the system mixer.
* @param call The call.
* @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ].
*/
LINPHONE_PUBLIC void linphone_call_set_speaker_volume_gain(LinphoneCall *call, float volume);
/**
* Get microphone volume gain.
* If the sound backend supports it, the returned gain is equal to the gain set
* with the system mixer.
* @param call The call.
* @return double Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ].
* In case of failure, a negative value is returned
*/
LINPHONE_PUBLIC float linphone_call_get_microphone_volume_gain(const LinphoneCall *call);
/**
* Set microphone volume gain.
* If the sound backend supports it, the new gain will synchronized with the system mixer.
* @param call The call.
* @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ].
*/
LINPHONE_PUBLIC void linphone_call_set_microphone_volume_gain(LinphoneCall *call, float volume);
/**
* 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 <br>
* 3-4 = average quality <br>
* 2-3 = poor quality <br>
* 1-2 = very poor quality <br>
* 0-1 = can't be worse, mostly unusable <br>
*
* @return The function returns -1 if no quality measurement is available, for example if no
* active audio stream exist. Otherwise it returns the quality rating.
**/
LINPHONE_PUBLIC float linphone_call_get_current_quality(const LinphoneCall *call);
/**
* Returns call quality averaged over all the duration of the call.
*
* See linphone_call_get_current_quality() for more details about quality measurement.
**/
LINPHONE_PUBLIC float linphone_call_get_average_quality(const LinphoneCall *call);
/**
* Start call recording.
* The output file where audio is recorded must be previously specified with linphone_call_params_set_record_file().
**/
LINPHONE_PUBLIC void linphone_call_start_recording(LinphoneCall *call);
/**
* Stop call recording.
**/
LINPHONE_PUBLIC void linphone_call_stop_recording(LinphoneCall *call);
/**
* Get a player associated with the call to play a local file and stream it to the remote peer.
* @param[in] call LinphoneCall object
* @return A LinphonePlayer object
*/
LINPHONE_PUBLIC LinphonePlayer * linphone_call_get_player(LinphoneCall *call);
/**
* Indicates whether an operation is in progress at the media side.
* It can be a bad idea to initiate signaling operations (adding video, pausing the call, removing video, changing video parameters) while
* the media is busy in establishing the connection (typically ICE connectivity checks). It can result in failures generating loss of time
* in future operations in the call.
* Applications are invited to check this function after each call state change to decide whether certain operations are permitted or not.
* @param call the call
* @return TRUE if media is busy in establishing the connection, FALSE otherwise.
**/
LINPHONE_PUBLIC bool_t linphone_call_media_in_progress(const LinphoneCall *call);
/**
* Call generic OpenGL render for a given call.
* @param call The call.
*/
LINPHONE_PUBLIC void linphone_call_ogl_render(const LinphoneCall *call);
/**
* Send a LinphoneInfoMessage through an established call
* @param call the call
* @param info the info message
**/
LINPHONE_PUBLIC LinphoneStatus linphone_call_send_info_message(LinphoneCall *call, const LinphoneInfoMessage *info);
/**
* Return a copy of the call statistics for a particular stream type.
* @param call the call
* @param type the stream type
**/
LINPHONE_PUBLIC LinphoneCallStats *linphone_call_get_stats(LinphoneCall *call, LinphoneStreamType type);
LINPHONE_PUBLIC LinphoneCallStats *linphone_call_get_audio_stats(LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCallStats *linphone_call_get_video_stats(LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCallStats *linphone_call_get_text_stats(LinphoneCall *call);
/**
* Add a listener in order to be notified of LinphoneCall events. Once an event is received, registred LinphoneCallCbs are
* invoked sequencially.
* @param[in] call LinphoneCall object to monitor.
* @param[in] cbs A LinphoneCallCbs object holding the callbacks you need. A reference is taken by the LinphoneCall until you invoke linphone_call_remove_callbacks().
*/
LINPHONE_PUBLIC void linphone_call_add_callbacks(LinphoneCall *call, LinphoneCallCbs *cbs);
/**
* Remove a listener from a LinphoneCall
* @param[in] call LinphoneCall object
* @param[in] cbs LinphoneCallCbs object to remove.
*/
LINPHONE_PUBLIC void linphone_call_remove_callbacks(LinphoneCall *call, LinphoneCallCbs *cbs);
/**
* Gets the current LinphoneCallCbs.
* This is meant only to be called from a callback to be able to get the user_data associated with the LinphoneCallCbs that is calling the callback.
* @param[in] call LinphoneCall object
* @return The LinphoneCallCbs that has called the last callback
*/
LINPHONE_PUBLIC LinphoneCallCbs *linphone_call_get_current_callbacks(const LinphoneCall *call);
/**
* Set call parameters - advanced and not recommended feature - use with caution.
* Local call parameters applicable to an outgoing or incoming shall usually be passed to linphone_core_invite_address_with_params() or
* linphone_call_accept_with_params().
* However, in some cases it might be desirable from a software design standpoint to modify local parameters outside of the application layer, typically
* in the purpose of implementing a custom logic including special headers in INVITE or 200Ok requests, driven by a call_state_changed listener method.
* This function accepts to assign a new LinphoneCallParams only in LinphoneCallOutgoingInit and LinphoneCallIncomingReceived states.
* @param call the LinphoneCall object
**/
LINPHONE_PUBLIC void linphone_call_set_params(LinphoneCall *call, const LinphoneCallParams *params);
/**
* Returns local parameters associated with the call.
* This is typically the parameters passed at call initiation to linphone_core_invite_address_with_params() or linphone_call_accept_with_params(), or some default
* parameters if no LinphoneCallParams was explicitely passed during call initiation.
* @param call the LinphoneCall object
* @return the call's local parameters.
**/
LINPHONE_PUBLIC const LinphoneCallParams * linphone_call_get_params(LinphoneCall *call);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#include "linphone/api/c-call.h"
#endif /* LINPHONE_CALL_H */

View file

@ -20,164 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef LINPHONE_CALL_STATS_H
#define LINPHONE_CALL_STATS_H
#include "linphone/types.h"
#include "linphone/api/c-call-stats.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @addtogroup call_misc
* @{
*/
#define LINPHONE_CALL_STATS_AUDIO ((int)LinphoneStreamTypeAudio)
#define LINPHONE_CALL_STATS_VIDEO ((int)LinphoneStreamTypeVideo)
#define LINPHONE_CALL_STATS_TEXT ((int)LinphoneStreamTypeText)
#define LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE (1 << 0) /**< received_rtcp field of LinphoneCallStats object has been updated */
#define LINPHONE_CALL_STATS_SENT_RTCP_UPDATE (1 << 1) /**< sent_rtcp field of LinphoneCallStats object has been updated */
#define LINPHONE_CALL_STATS_PERIODICAL_UPDATE (1 << 2) /**< Every seconds LinphoneCallStats object has been updated */
/**
* Increment refcount.
* @param[in] stats LinphoneCallStats object
* @ingroup misc
**/
LINPHONE_PUBLIC LinphoneCallStats *linphone_call_stats_ref(LinphoneCallStats *stats);
/**
* Decrement refcount and possibly free the object.
* @param[in] stats LinphoneCallStats object
* @ingroup misc
**/
LINPHONE_PUBLIC void linphone_call_stats_unref(LinphoneCallStats *stats);
/**
* Gets the user data in the LinphoneCallStats object
* @param[in] stats the LinphoneCallStats
* @return the user data
* @ingroup misc
*/
LINPHONE_PUBLIC void *linphone_call_stats_get_user_data(const LinphoneCallStats *stats);
/**
* Sets the user data in the LinphoneCallStats object
* @param[in] stats the LinphoneCallStats object
* @param[in] data the user data
* @ingroup misc
*/
LINPHONE_PUBLIC void linphone_call_stats_set_user_data(LinphoneCallStats *stats, void *data);
/**
* Get the type of the stream the stats refer to.
* @param[in] stats LinphoneCallStats object
* @return The type of the stream the stats refer to
*/
LINPHONE_PUBLIC LinphoneStreamType linphone_call_stats_get_type(const LinphoneCallStats *stats);
/**
* Get the local loss rate since last report
* @return The sender loss rate
**/
LINPHONE_PUBLIC float linphone_call_stats_get_sender_loss_rate(const LinphoneCallStats *stats);
/**
* Gets the remote reported loss rate since last report
* @return The receiver loss rate
**/
LINPHONE_PUBLIC float linphone_call_stats_get_receiver_loss_rate(const LinphoneCallStats *stats);
/**
* Get the local loss rate since last report
* @return The local loss rate
**/
LINPHONE_PUBLIC float linphone_call_stats_get_local_loss_rate(const LinphoneCallStats *stats);
/**
* Gets the local late rate since last report
* @return The local late rate
**/
LINPHONE_PUBLIC float linphone_call_stats_get_local_late_rate(const LinphoneCallStats *stats);
/**
* Gets the local interarrival jitter
* @param[in] stats LinphoneCallStats object
* @return The interarrival jitter at last emitted sender report
**/
LINPHONE_PUBLIC float linphone_call_stats_get_sender_interarrival_jitter(const LinphoneCallStats *stats);
/**
* Gets the remote reported interarrival jitter
* @param[in] stats LinphoneCallStats object
* @return The interarrival jitter at last received receiver report
**/
LINPHONE_PUBLIC float linphone_call_stats_get_receiver_interarrival_jitter(const LinphoneCallStats *stats);
LINPHONE_PUBLIC const rtp_stats_t *linphone_call_stats_get_rtp_stats(const LinphoneCallStats *stats);
/**
* Gets the cumulative number of late packets
* @param[in] stats LinphoneCallStats object
* @return The cumulative number of late packets
**/
LINPHONE_PUBLIC uint64_t linphone_call_stats_get_late_packets_cumulative_number(const LinphoneCallStats *stats);
/**
* Get the bandwidth measurement of the received stream, expressed in kbit/s, including IP/UDP/RTP headers.
* @param[in] stats LinphoneCallStats object
* @return The bandwidth measurement of the received stream in kbit/s.
*/
LINPHONE_PUBLIC float linphone_call_stats_get_download_bandwidth(const LinphoneCallStats *stats);
/**
* Get the bandwidth measurement of the sent stream, expressed in kbit/s, including IP/UDP/RTP headers.
* @param[in] stats LinphoneCallStats object
* @return The bandwidth measurement of the sent stream in kbit/s.
*/
LINPHONE_PUBLIC float linphone_call_stats_get_upload_bandwidth(const LinphoneCallStats *stats);
/**
* Get the state of ICE processing.
* @param[in] stats LinphoneCallStats object
* @return The state of ICE processing.
*/
LINPHONE_PUBLIC LinphoneIceState linphone_call_stats_get_ice_state(const LinphoneCallStats *stats);
/**
* Get the state of uPnP processing.
* @param[in] stats LinphoneCallStats object
* @return The state of uPnP processing.
*/
LINPHONE_PUBLIC LinphoneUpnpState linphone_call_stats_get_upnp_state(const LinphoneCallStats *stats);
/**
* Get the IP address family of the remote peer.
* @param[in] stats LinphoneCallStats object
* @return The IP address family of the remote peer.
*/
LINPHONE_PUBLIC LinphoneAddressFamily linphone_call_stats_get_ip_family_of_remote(const LinphoneCallStats *stats);
/**
* Get the jitter buffer size in ms.
* @param[in] stats LinphoneCallStats object
* @return The jitter buffer size in ms.
*/
LINPHONE_PUBLIC float linphone_call_stats_get_jitter_buffer_size_ms(const LinphoneCallStats *stats);
/**
* Get the round trip delay in s.
* @param[in] stats LinphoneCallStats object
* @return The round trip delay in s.
*/
LINPHONE_PUBLIC float linphone_call_stats_get_round_trip_delay(const LinphoneCallStats *stats);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
#endif /* LINPHONE_ADDRESS_H */
#endif /* LINPHONE_CALL_STATS_H */

View file

@ -34,67 +34,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* @}
**/
/**
* @addtogroup call_control
* @{
**/
/**
* Callback for being notified of received DTMFs.
* @param call LinphoneCall object that received the dtmf
* @param dtmf The ascii code of the dtmf
*/
typedef void (*LinphoneCallCbsDtmfReceivedCb)(LinphoneCall *call, int dtmf);
/**
* Call encryption changed callback.
* @param call LinphoneCall object whose encryption is changed.
* @param on Whether encryption is activated.
* @param authentication_token An authentication_token, currently set for ZRTP kind of encryption only.
*/
typedef void (*LinphoneCallCbsEncryptionChangedCb)(LinphoneCall *call, bool_t on, const char *authentication_token);
/**
* Callback for receiving info messages.
* @param call LinphoneCall whose info message belongs to.
* @param msg LinphoneInfoMessage object.
*/
typedef void (*LinphoneCallCbsInfoMessageReceivedCb)(LinphoneCall *call, const LinphoneInfoMessage *msg);
/**
* Call state notification callback.
* @param call LinphoneCall whose state is changed.
* @param cstate The new state of the call
* @param message An informational message about the state.
*/
typedef void (*LinphoneCallCbsStateChangedCb)(LinphoneCall *call, LinphoneCallState cstate, const char *message);
/**
* Callback for receiving quality statistics for calls.
* @param call LinphoneCall object whose statistics are notified
* @param stats LinphoneCallStats object
*/
typedef void (*LinphoneCallCbsStatsUpdatedCb)(LinphoneCall *call, const LinphoneCallStats *stats);
/**
* Callback for notifying progresses of transfers.
* @param call LinphoneCall that was transfered
* @param cstate The state of the call to transfer target at the far end.
*/
typedef void (*LinphoneCallCbsTransferStateChangedCb)(LinphoneCall *call, LinphoneCallState cstate);
/**
* Callback for notifying the processing SIP ACK messages.
* @param call LinphoneCall for which an ACK is being received or sent
* @param ack the ACK message
* @param is_received if TRUE this ACK is an incoming one, otherwise it is an ACK about to be sent.
*/
typedef void (*LinphoneCallCbsAckProcessingCb)(LinphoneCall *call, LinphoneHeaders *ack, bool_t is_received);
/**
* @}
**/
/**
* @addtogroup initializing
* @{

View file

@ -241,25 +241,6 @@ typedef enum _LinphoneAVPFMode {
**/
typedef struct _LinphoneBuffer LinphoneBuffer;
/**
* The LinphoneCall object represents a call issued or received by the LinphoneCore
* @ingroup call_control
**/
typedef struct _LinphoneCall LinphoneCall;
/**
* That class holds all the callbacks which are called by LinphoneCall objects.
*
* Use linphone_factory_create_call_cbs() to create an instance. Then, call the
* callback setters on the events you need to monitor and pass the object to
* a LinphoneCall instance through linphone_call_add_callbacks().
* @ingroup call_control
*/
typedef struct _LinphoneCallCbs LinphoneCallCbs;
/** Callback prototype */
typedef void (*LinphoneCallCbFunc)(LinphoneCall *call, void *user_data);
/**
* Enum representing the direction of a call.
* @ingroup call_logs

View file

@ -103,7 +103,10 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
address/address.cpp
c-wrapper/api/c-address.cpp
c-wrapper/api/c-call.cpp
c-wrapper/api/c-call-cbs.cpp
c-wrapper/api/c-call-params.cpp
c-wrapper/api/c-call-stats.cpp
c-wrapper/api/c-chat-message.cpp
c-wrapper/api/c-chat-message-cbs.cpp
c-wrapper/api/c-chat-room.cpp

View file

@ -0,0 +1,125 @@
/*
* c-call-cbs.cpp
* Copyright (C) 2017 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 3 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 "linphone/api/c-call-cbs.h"
#include "c-wrapper/c-wrapper.h"
// =============================================================================
struct _LinphoneCallCbs {
belle_sip_object_t base;
void *userData;
LinphoneCallCbsDtmfReceivedCb dtmfReceivedCb;
LinphoneCallCbsEncryptionChangedCb encryptionChangedCb;
LinphoneCallCbsInfoMessageReceivedCb infoMessageReceivedCb;
LinphoneCallCbsStateChangedCb stateChangedCb;
LinphoneCallCbsStatsUpdatedCb statsUpdatedCb;
LinphoneCallCbsTransferStateChangedCb transferStateChangedCb;
LinphoneCallCbsAckProcessingCb ackProcessing;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneCallCbs);
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneCallCbs);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneCallCbs, belle_sip_object_t,
NULL, // destroy
NULL, // clone
NULL, // marshal
FALSE
);
// =============================================================================
LinphoneCallCbs *_linphone_call_cbs_new (void) {
return belle_sip_object_new(LinphoneCallCbs);
}
LinphoneCallCbs *linphone_call_cbs_ref (LinphoneCallCbs *cbs) {
belle_sip_object_ref(cbs);
return cbs;
}
void linphone_call_cbs_unref (LinphoneCallCbs *cbs) {
belle_sip_object_unref(cbs);
}
void *linphone_call_cbs_get_user_data (const LinphoneCallCbs *cbs) {
return cbs->userData;
}
void linphone_call_cbs_set_user_data (LinphoneCallCbs *cbs, void *ud) {
cbs->userData = ud;
}
LinphoneCallCbsDtmfReceivedCb linphone_call_cbs_get_dtmf_received (LinphoneCallCbs *cbs) {
return cbs->dtmfReceivedCb;
}
void linphone_call_cbs_set_dtmf_received (LinphoneCallCbs *cbs, LinphoneCallCbsDtmfReceivedCb cb) {
cbs->dtmfReceivedCb = cb;
}
LinphoneCallCbsEncryptionChangedCb linphone_call_cbs_get_encryption_changed (LinphoneCallCbs *cbs) {
return cbs->encryptionChangedCb;
}
void linphone_call_cbs_set_encryption_changed (LinphoneCallCbs *cbs, LinphoneCallCbsEncryptionChangedCb cb) {
cbs->encryptionChangedCb = cb;
}
LinphoneCallCbsInfoMessageReceivedCb linphone_call_cbs_get_info_message_received (LinphoneCallCbs *cbs) {
return cbs->infoMessageReceivedCb;
}
void linphone_call_cbs_set_info_message_received (LinphoneCallCbs *cbs, LinphoneCallCbsInfoMessageReceivedCb cb) {
cbs->infoMessageReceivedCb = cb;
}
LinphoneCallCbsStateChangedCb linphone_call_cbs_get_state_changed (LinphoneCallCbs *cbs) {
return cbs->stateChangedCb;
}
void linphone_call_cbs_set_state_changed (LinphoneCallCbs *cbs, LinphoneCallCbsStateChangedCb cb) {
cbs->stateChangedCb = cb;
}
LinphoneCallCbsStatsUpdatedCb linphone_call_cbs_get_stats_updated (LinphoneCallCbs *cbs) {
return cbs->statsUpdatedCb;
}
void linphone_call_cbs_set_stats_updated (LinphoneCallCbs *cbs, LinphoneCallCbsStatsUpdatedCb cb) {
cbs->statsUpdatedCb = cb;
}
LinphoneCallCbsTransferStateChangedCb linphone_call_cbs_get_transfer_state_changed (LinphoneCallCbs *cbs) {
return cbs->transferStateChangedCb;
}
void linphone_call_cbs_set_transfer_state_changed (LinphoneCallCbs *cbs, LinphoneCallCbsTransferStateChangedCb cb) {
cbs->transferStateChangedCb = cb;
}
LinphoneCallCbsAckProcessingCb linphone_call_cbs_get_ack_processing (LinphoneCallCbs *cbs){
return cbs->ackProcessing;
}
void linphone_call_cbs_set_ack_processing (LinphoneCallCbs *cbs, LinphoneCallCbsAckProcessingCb cb){
cbs->ackProcessing = cb;
}

View file

@ -0,0 +1,343 @@
/*
* c-call-stats.cpp
* Copyright (C) 2017 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 3 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 "linphone/api/c-call-stats.h"
#include "c-wrapper/c-wrapper.h"
// =============================================================================
void _linphone_call_stats_clone (LinphoneCallStats *dst, const LinphoneCallStats *src);
/**
* The LinphoneCallStats objects carries various statistic informations regarding quality of audio or video streams.
*
* To receive these informations periodically and as soon as they are computed, the application is invited to place a #LinphoneCoreCallStatsUpdatedCb callback in the LinphoneCoreVTable structure
* it passes for instantiating the LinphoneCore object (see linphone_core_new() ).
*
* At any time, the application can access last computed statistics using linphone_call_get_audio_stats() or linphone_call_get_video_stats().
**/
struct _LinphoneCallStats {
belle_sip_object_t base;
void *user_data;
LinphoneStreamType type; /**< Type of the stream which the stats refer to */
jitter_stats_t jitter_stats; /**<jitter buffer statistics, see oRTP documentation for details */
mblk_t *received_rtcp; /**<Last RTCP packet received, as a mblk_t structure. See oRTP documentation for details how to extract information from it*/
mblk_t *sent_rtcp;/**<Last RTCP packet sent, as a mblk_t structure. See oRTP documentation for details how to extract information from it*/
float round_trip_delay; /**<Round trip propagation time in seconds if known, -1 if unknown.*/
LinphoneIceState ice_state; /**< State of ICE processing. */
LinphoneUpnpState upnp_state; /**< State of uPnP processing. */
float download_bandwidth; /**<Download bandwidth measurement of received stream, expressed in kbit/s, including IP/UDP/RTP headers*/
float upload_bandwidth; /**<Download bandwidth measurement of sent stream, expressed in kbit/s, including IP/UDP/RTP headers*/
float local_late_rate; /**<percentage of packet received too late over last second*/
float local_loss_rate; /**<percentage of lost packet over last second*/
int updated; /**< Tell which RTCP packet has been updated (received_rtcp or sent_rtcp). Can be either LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE or LINPHONE_CALL_STATS_SENT_RTCP_UPDATE */
float rtcp_download_bandwidth; /**<RTCP download bandwidth measurement of received stream, expressed in kbit/s, including IP/UDP/RTP headers*/
float rtcp_upload_bandwidth; /**<RTCP download bandwidth measurement of sent stream, expressed in kbit/s, including IP/UDP/RTP headers*/
rtp_stats_t rtp_stats; /**< RTP stats */
int rtp_remote_family; /**< Ip adress family of the remote destination */
int clockrate; /*RTP clockrate of the stream, provided here for easily converting timestamp units expressed in RTCP packets in milliseconds*/
bool_t rtcp_received_via_mux; /*private flag, for non-regression test only*/
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneCallStats);
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneCallStats);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneCallStats, belle_sip_object_t,
NULL, // destroy
_linphone_call_stats_clone, // clone
NULL, // marshal
FALSE
);
// =============================================================================
// Private functions
// =============================================================================
LinphoneCallStats *_linphone_call_stats_new () {
LinphoneCallStats *stats = belle_sip_object_new(LinphoneCallStats);
return stats;
}
void _linphone_call_stats_uninit (LinphoneCallStats *stats) {
if (stats->received_rtcp) {
freemsg(stats->received_rtcp);
stats->received_rtcp=NULL;
}
if (stats->sent_rtcp){
freemsg(stats->sent_rtcp);
stats->sent_rtcp=NULL;
}
}
void _linphone_call_stats_clone (LinphoneCallStats *dst, const LinphoneCallStats *src) {
/*
* Save the belle_sip_object_t part, copy the entire structure and restore the belle_sip_object_t part
*/
belle_sip_object_t tmp = dst->base;
memcpy(dst, src, sizeof(LinphoneCallStats));
dst->base = tmp;
dst->received_rtcp = NULL;
dst->sent_rtcp = NULL;
}
void _linphone_call_stats_set_ice_state (LinphoneCallStats *stats, LinphoneIceState state) {
stats->ice_state = state;
}
void _linphone_call_stats_set_type (LinphoneCallStats *stats, LinphoneStreamType type) {
stats->type = type;
}
void _linphone_call_stats_set_received_rtcp (LinphoneCallStats *stats, mblk_t *m) {
stats->received_rtcp = m;
}
void _linphone_call_stats_set_sent_rtcp (LinphoneCallStats *stats, mblk_t *m) {
stats->sent_rtcp = m;
}
int _linphone_call_stats_get_updated (const LinphoneCallStats *stats) {
return stats->updated;
}
void _linphone_call_stats_set_updated (LinphoneCallStats *stats, int updated) {
stats->updated = updated;
}
void _linphone_call_stats_set_rtp_stats (LinphoneCallStats *stats, const rtp_stats_t *rtpStats) {
memcpy(&(stats->rtp_stats), rtpStats, sizeof(*rtpStats));
}
void _linphone_call_stats_set_download_bandwidth (LinphoneCallStats *stats, float bandwidth) {
stats->download_bandwidth = bandwidth;
}
void _linphone_call_stats_set_upload_bandwidth (LinphoneCallStats *stats, float bandwidth) {
stats->upload_bandwidth = bandwidth;
}
void _linphone_call_stats_set_rtcp_download_bandwidth (LinphoneCallStats *stats, float bandwidth) {
stats->rtcp_download_bandwidth = bandwidth;
}
void _linphone_call_stats_set_rtcp_upload_bandwidth (LinphoneCallStats *stats, float bandwidth) {
stats->rtcp_upload_bandwidth = bandwidth;
}
void _linphone_call_stats_set_ip_family_of_remote (LinphoneCallStats *stats, LinphoneAddressFamily family) {
stats->rtp_remote_family = family;
}
// =============================================================================
// Public functions
// =============================================================================
LinphoneCallStats *linphone_call_stats_ref (LinphoneCallStats* stats) {
return (LinphoneCallStats*) belle_sip_object_ref(stats);
}
void linphone_call_stats_unref (LinphoneCallStats* stats) {
belle_sip_object_unref(stats);
}
void *linphone_call_stats_get_user_data (const LinphoneCallStats *stats) {
return stats->user_data;
}
void linphone_call_stats_set_user_data (LinphoneCallStats *stats, void *data) {
stats->user_data = data;
}
void linphone_call_stats_update (LinphoneCallStats *stats, MediaStream *stream) {
PayloadType *pt;
RtpSession *session = stream->sessions.rtp_session;
const MSQualityIndicator *qi = media_stream_get_quality_indicator(stream);
if (qi) {
stats->local_late_rate=ms_quality_indicator_get_local_late_rate(qi);
stats->local_loss_rate=ms_quality_indicator_get_local_loss_rate(qi);
}
media_stream_get_local_rtp_stats(stream, &stats->rtp_stats);
pt = rtp_profile_get_payload(rtp_session_get_profile(session), rtp_session_get_send_payload_type(session));
stats->clockrate = pt ? pt->clock_rate : 8000;
}
/*do not change the prototype of this function, it is also used internally in linphone-daemon.*/
void linphone_call_stats_fill (LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev) {
OrtpEventType evt=ortp_event_get_type(ev);
OrtpEventData *evd=ortp_event_get_data(ev);
if (evt == ORTP_EVENT_RTCP_PACKET_RECEIVED) {
stats->round_trip_delay = rtp_session_get_round_trip_propagation(ms->sessions.rtp_session);
if(stats->received_rtcp != NULL)
freemsg(stats->received_rtcp);
stats->received_rtcp = evd->packet;
stats->rtcp_received_via_mux = evd->info.socket_type == OrtpRTPSocket;
evd->packet = NULL;
stats->updated = LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE;
linphone_call_stats_update(stats,ms);
} else if (evt == ORTP_EVENT_RTCP_PACKET_EMITTED) {
memcpy(&stats->jitter_stats, rtp_session_get_jitter_stats(ms->sessions.rtp_session), sizeof(jitter_stats_t));
if (stats->sent_rtcp != NULL)
freemsg(stats->sent_rtcp);
stats->sent_rtcp = evd->packet;
evd->packet = NULL;
stats->updated = LINPHONE_CALL_STATS_SENT_RTCP_UPDATE;
linphone_call_stats_update(stats,ms);
}
}
LinphoneStreamType linphone_call_stats_get_type (const LinphoneCallStats *stats) {
return stats->type;
}
float linphone_call_stats_get_sender_loss_rate (const LinphoneCallStats *stats) {
const report_block_t *srb = NULL;
if (!stats || !stats->sent_rtcp)
return 0.0;
/* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */
if (stats->sent_rtcp->b_cont != NULL)
msgpullup(stats->sent_rtcp, -1);
do{
if (rtcp_is_SR(stats->sent_rtcp))
srb = rtcp_SR_get_report_block(stats->sent_rtcp, 0);
else if (rtcp_is_RR(stats->sent_rtcp))
srb = rtcp_RR_get_report_block(stats->sent_rtcp, 0);
if (srb) break;
}while (rtcp_next_packet(stats->sent_rtcp));
rtcp_rewind(stats->sent_rtcp);
if (!srb)
return 0.0;
return 100.0f * (float)report_block_get_fraction_lost(srb) / 256.0f;
}
float linphone_call_stats_get_receiver_loss_rate (const LinphoneCallStats *stats) {
const report_block_t *rrb = NULL;
if (!stats || !stats->received_rtcp)
return 0.0;
/* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */
if (stats->received_rtcp->b_cont != NULL)
msgpullup(stats->received_rtcp, -1);
do{
if (rtcp_is_RR(stats->received_rtcp))
rrb = rtcp_RR_get_report_block(stats->received_rtcp, 0);
else if (rtcp_is_SR(stats->received_rtcp))
rrb = rtcp_SR_get_report_block(stats->received_rtcp, 0);
if (rrb) break;
}while (rtcp_next_packet(stats->received_rtcp));
rtcp_rewind(stats->received_rtcp);
if (!rrb)
return 0.0;
return 100.0f * (float)report_block_get_fraction_lost(rrb) / 256.0f;
}
float linphone_call_stats_get_local_loss_rate (const LinphoneCallStats *stats) {
return stats->local_loss_rate;
}
float linphone_call_stats_get_local_late_rate (const LinphoneCallStats *stats) {
return stats->local_late_rate;
}
float linphone_call_stats_get_sender_interarrival_jitter (const LinphoneCallStats *stats) {
const report_block_t *srb = NULL;
if (!stats || !stats->sent_rtcp)
return 0.0;
/* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */
if (stats->sent_rtcp->b_cont != NULL)
msgpullup(stats->sent_rtcp, -1);
if (rtcp_is_SR(stats->sent_rtcp))
srb = rtcp_SR_get_report_block(stats->sent_rtcp, 0);
else if (rtcp_is_RR(stats->sent_rtcp))
srb = rtcp_RR_get_report_block(stats->sent_rtcp, 0);
if (!srb)
return 0.0;
if (stats->clockrate == 0)
return 0.0;
return (float)report_block_get_interarrival_jitter(srb) / (float)stats->clockrate;
}
float linphone_call_stats_get_receiver_interarrival_jitter (const LinphoneCallStats *stats) {
const report_block_t *rrb = NULL;
if (!stats || !stats->received_rtcp)
return 0.0;
/* Perform msgpullup() to prevent crashes in rtcp_is_SR() or rtcp_is_RR() if the RTCP packet is composed of several mblk_t structure */
if (stats->received_rtcp->b_cont != NULL)
msgpullup(stats->received_rtcp, -1);
if (rtcp_is_SR(stats->received_rtcp))
rrb = rtcp_SR_get_report_block(stats->received_rtcp, 0);
else if (rtcp_is_RR(stats->received_rtcp))
rrb = rtcp_RR_get_report_block(stats->received_rtcp, 0);
if (!rrb)
return 0.0;
if (stats->clockrate == 0)
return 0.0;
return (float)report_block_get_interarrival_jitter(rrb) / (float)stats->clockrate;
}
const rtp_stats_t *linphone_call_stats_get_rtp_stats (const LinphoneCallStats *stats) {
return &stats->rtp_stats;
}
uint64_t linphone_call_stats_get_late_packets_cumulative_number (const LinphoneCallStats *stats) {
return linphone_call_stats_get_rtp_stats(stats)->outoftime;
}
float linphone_call_stats_get_download_bandwidth (const LinphoneCallStats *stats) {
return stats->download_bandwidth;
}
float linphone_call_stats_get_upload_bandwidth (const LinphoneCallStats *stats) {
return stats->upload_bandwidth;
}
float linphone_call_stats_get_rtcp_download_bandwidth (const LinphoneCallStats *stats) {
return stats->rtcp_download_bandwidth;
}
float linphone_call_stats_get_rtcp_upload_bandwidth (const LinphoneCallStats *stats) {
return stats->rtcp_upload_bandwidth;
}
LinphoneIceState linphone_call_stats_get_ice_state (const LinphoneCallStats *stats) {
return stats->ice_state;
}
LinphoneUpnpState linphone_call_stats_get_upnp_state (const LinphoneCallStats *stats) {
return stats->upnp_state;
}
LinphoneAddressFamily linphone_call_stats_get_ip_family_of_remote (const LinphoneCallStats *stats) {
return (LinphoneAddressFamily)stats->rtp_remote_family;
}
float linphone_call_stats_get_jitter_buffer_size_ms (const LinphoneCallStats *stats) {
return stats->jitter_stats.jitter_buffer_size_ms;
}
float linphone_call_stats_get_round_trip_delay (const LinphoneCallStats *stats) {
return stats->round_trip_delay;
}

1212
src/c-wrapper/api/c-call.cpp Normal file

File diff suppressed because it is too large Load diff

View file

@ -27,6 +27,8 @@
#define L_REGISTER_TYPE(C_TYPE) \
extern Linphone ## C_TYPE *_linphone_ ## C_TYPE ## _init ();
#define L_INIT(C_TYPE) \
_linphone_ ## C_TYPE ## _init ()
// =============================================================================

View file

@ -30,10 +30,6 @@
// =============================================================================
extern std::shared_ptr<LinphonePrivate::Call> linphone_call_get_cpp_obj(const LinphoneCall *call);
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class CallPrivate : public ObjectPrivate, CallListener {

View file

@ -372,13 +372,13 @@ LinphoneCallLog * Call::getLog () const {
return d->getActiveSession()->getLog();
}
RtpTransport * Call::getMetaRtcpTransport (int streamIndex) {
L_D(Call);
RtpTransport * Call::getMetaRtcpTransport (int streamIndex) const {
L_D(const Call);
return static_cast<MediaSession *>(d->getActiveSession().get())->getMetaRtcpTransport(streamIndex);
}
RtpTransport * Call::getMetaRtpTransport (int streamIndex) {
L_D(Call);
RtpTransport * Call::getMetaRtpTransport (int streamIndex) const {
L_D(const Call);
return static_cast<MediaSession *>(d->getActiveSession().get())->getMetaRtpTransport(streamIndex);
}
@ -447,8 +447,8 @@ LinphoneCallStats * Call::getStats (LinphoneStreamType type) const {
return static_cast<const MediaSession *>(d->getActiveSession().get())->getStats(type);
}
int Call::getStreamCount () {
L_D(Call);
int Call::getStreamCount () const {
L_D(const Call);
return static_cast<MediaSession *>(d->getActiveSession().get())->getStreamCount();
}

View file

@ -76,8 +76,8 @@ public:
int getDuration () const;
const LinphoneErrorInfo * getErrorInfo () const;
LinphoneCallLog * getLog () const;
RtpTransport * getMetaRtcpTransport (int streamIndex);
RtpTransport * getMetaRtpTransport (int streamIndex);
RtpTransport * getMetaRtcpTransport (int streamIndex) const;
RtpTransport * getMetaRtpTransport (int streamIndex) const;
float getMicrophoneVolumeGain () const;
void * getNativeVideoWindowId () const;
const MediaSessionParams * getParams () const;
@ -91,7 +91,7 @@ public:
float getSpeakerVolumeGain () const;
LinphoneCallState getState () const;
LinphoneCallStats * getStats (LinphoneStreamType type) const;
int getStreamCount ();
int getStreamCount () const;
MSFormatType getStreamType (int streamIndex) const;
LinphoneCallStats * getTextStats () const;
LinphoneCallStats * getVideoStats () const;

View file

@ -67,7 +67,7 @@ protected:
virtual LinphoneStatus startAcceptUpdate (LinphoneCallState nextState, const std::string &stateInfo);
virtual LinphoneStatus startUpdate ();
virtual void terminate ();
virtual void updateCurrentParams ();
virtual void updateCurrentParams () const;
void setContactOp ();
@ -83,7 +83,7 @@ protected:
CallSessionListener *listener = nullptr;
CallSessionParams *params = nullptr;
CallSessionParams *currentParams = nullptr;
mutable CallSessionParams *currentParams = nullptr;
CallSessionParams *remoteParams = nullptr;
LinphoneCallDir direction = LinphoneCallOutgoing;

View file

@ -512,7 +512,7 @@ LinphoneStatus CallSessionPrivate::checkForAcceptation () const {
bctbx_list_t *copy = bctbx_list_copy(linphone_core_get_calls(core));
for (bctbx_list_t *it = copy; it != nullptr; it = bctbx_list_next(it)) {
LinphoneCall *call = reinterpret_cast<LinphoneCall *>(bctbx_list_get_data(it));
shared_ptr<CallSession> session = linphone_call_get_cpp_obj(call)->getPrivate()->getActiveSession();
shared_ptr<CallSession> session = L_GET_PRIVATE_FROM_C_STRUCT(call, Call)->getActiveSession();
if (session.get() == q) continue;
switch (session->getState()) {
case LinphoneCallOutgoingInit:
@ -668,7 +668,7 @@ void CallSessionPrivate::terminate () {
setState(LinphoneCallEnd, "Call terminated");
}
void CallSessionPrivate::updateCurrentParams () {}
void CallSessionPrivate::updateCurrentParams () const {}
// -----------------------------------------------------------------------------
@ -1087,8 +1087,8 @@ string CallSession::getRemoteUserAgent () const {
return string();
}
CallSessionParams * CallSession::getCurrentParams () {
L_D(CallSession);
CallSessionParams * CallSession::getCurrentParams () const {
L_D(const CallSession);
d->updateCurrentParams();
return d->currentParams;
}

View file

@ -51,7 +51,7 @@ public:
LinphoneStatus terminate (const LinphoneErrorInfo *ei = nullptr);
LinphoneStatus update (const CallSessionParams *csp);
CallSessionParams *getCurrentParams ();
CallSessionParams *getCurrentParams () const;
LinphoneCallDir getDirection () const;
int getDuration () const;
const LinphoneErrorInfo * getErrorInfo () const;

View file

@ -219,7 +219,7 @@ private:
LinphoneStatus startAcceptUpdate (LinphoneCallState nextState, const std::string &stateInfo) override;
LinphoneStatus startUpdate () override;
void terminate () override;
void updateCurrentParams () override;
void updateCurrentParams () const override;
void accept (const MediaSessionParams *params);
LinphoneStatus acceptUpdate (const CallSessionParams *csp, LinphoneCallState nextState, const std::string &stateInfo) override;
@ -236,7 +236,7 @@ private:
static const int ecStateMaxLen;
MediaSessionParams *params = nullptr;
MediaSessionParams *currentParams = nullptr;
mutable MediaSessionParams *currentParams = nullptr;
MediaSessionParams *remoteParams = nullptr;
AudioStream *audioStream = nullptr;

View file

@ -72,11 +72,11 @@ MediaSessionPrivate::MediaSessionPrivate (const Conference &conference, const Ca
params = new MediaSessionParams(*(reinterpret_cast<const MediaSessionParams *>(csp)));
currentParams = new MediaSessionParams();
audioStats = linphone_call_stats_ref(linphone_call_stats_new());
audioStats = linphone_call_stats_ref(_linphone_call_stats_new());
initStats(audioStats, LinphoneStreamTypeAudio);
videoStats = linphone_call_stats_ref(linphone_call_stats_new());
videoStats = linphone_call_stats_ref(_linphone_call_stats_new());
initStats(videoStats, LinphoneStreamTypeVideo);
textStats = linphone_call_stats_ref(linphone_call_stats_new());
textStats = linphone_call_stats_ref(_linphone_call_stats_new());
initStats(textStats, LinphoneStreamTypeText);
int minPort, maxPort;
@ -498,9 +498,9 @@ void MediaSessionPrivate::deactivateIce () {
videoStream->ms.ice_check_list = nullptr;
if (textStream)
textStream->ms.ice_check_list = nullptr;
audioStats->ice_state = LinphoneIceStateNotActivated;
videoStats->ice_state = LinphoneIceStateNotActivated;
textStats->ice_state = LinphoneIceStateNotActivated;
_linphone_call_stats_set_ice_state(audioStats, LinphoneIceStateNotActivated);
_linphone_call_stats_set_ice_state(videoStats, LinphoneIceStateNotActivated);
_linphone_call_stats_set_ice_state(textStats, LinphoneIceStateNotActivated);
stopStreamsForIceGathering();
}
@ -845,10 +845,10 @@ void MediaSessionPrivate::updateRemoteSessionIdAndVer () {
// -----------------------------------------------------------------------------
void MediaSessionPrivate::initStats (LinphoneCallStats *stats, LinphoneStreamType type) {
stats->type = type;
stats->received_rtcp = nullptr;
stats->sent_rtcp = nullptr;
stats->ice_state = LinphoneIceStateNotActivated;
_linphone_call_stats_set_type(stats, type);
_linphone_call_stats_set_received_rtcp(stats, nullptr);
_linphone_call_stats_set_sent_rtcp(stats, nullptr);
_linphone_call_stats_set_ice_state(stats, LinphoneIceStateNotActivated);
}
void MediaSessionPrivate::notifyStatsUpdated (int streamIndex) const {
@ -861,8 +861,8 @@ void MediaSessionPrivate::notifyStatsUpdated (int streamIndex) const {
stats = textStats;
else
return;
if (stats->updated) {
switch (stats->updated) {
if (_linphone_call_stats_get_updated(stats)) {
switch (_linphone_call_stats_get_updated(stats)) {
case LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE:
case LINPHONE_CALL_STATS_SENT_RTCP_UPDATE:
#if 0
@ -874,7 +874,7 @@ void MediaSessionPrivate::notifyStatsUpdated (int streamIndex) const {
}
if (listener)
listener->onStatsUpdated(stats);
stats->updated = 0;
_linphone_call_stats_set_updated(stats, 0);
}
}
@ -924,8 +924,7 @@ int MediaSessionPrivate::selectFixedPort (int streamIndex, pair<int, int> portRa
bool alreadyUsed = false;
for (const bctbx_list_t *elem = linphone_core_get_calls(core); elem != nullptr; elem = bctbx_list_next(elem)) {
LinphoneCall *lcall = reinterpret_cast<LinphoneCall *>(bctbx_list_get_data(elem));
CallPrivate *callp = linphone_call_get_cpp_obj(lcall)->getPrivate();
MediaSession *session = dynamic_cast<MediaSession *>(callp->getConference()->getActiveParticipant()->getPrivate()->getSession().get());
MediaSession *session = dynamic_cast<MediaSession *>(L_GET_PRIVATE_FROM_C_STRUCT(lcall, Call)->getConference()->getActiveParticipant()->getPrivate()->getSession().get());
int existingPort = session->getPrivate()->mediaPorts[streamIndex].rtpPort;
if (existingPort == triedPort) {
alreadyUsed = true;
@ -947,8 +946,7 @@ int MediaSessionPrivate::selectRandomPort (int streamIndex, pair<int, int> portR
if (triedPort < portRange.first) triedPort = portRange.first + 2;
for (const bctbx_list_t *elem = linphone_core_get_calls(core); elem != nullptr; elem = bctbx_list_next(elem)) {
LinphoneCall *lcall = reinterpret_cast<LinphoneCall *>(bctbx_list_get_data(elem));
CallPrivate *callp = linphone_call_get_cpp_obj(lcall)->getPrivate();
MediaSession *session = dynamic_cast<MediaSession *>(callp->getConference()->getActiveParticipant()->getPrivate()->getSession().get());
MediaSession *session = dynamic_cast<MediaSession *>(L_GET_PRIVATE_FROM_C_STRUCT(lcall, Call)->getConference()->getActiveParticipant()->getPrivate()->getSession().get());
int existingPort = session->getPrivate()->mediaPorts[streamIndex].rtpPort;
if (existingPort == triedPort) {
alreadyUsed = true;
@ -2069,9 +2067,9 @@ void MediaSessionPrivate::freeResources () {
iceAgent->deleteSession();
for (int i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++)
ms_media_stream_sessions_uninit(&sessions[i]);
linphone_call_stats_uninit(audioStats);
linphone_call_stats_uninit(videoStats);
linphone_call_stats_uninit(textStats);
_linphone_call_stats_uninit(audioStats);
_linphone_call_stats_uninit(videoStats);
_linphone_call_stats_uninit(textStats);
}
void MediaSessionPrivate::handleIceEvents (OrtpEvent *ev) {
@ -3409,8 +3407,8 @@ void MediaSessionPrivate::fillLogStats (MediaStream *st) {
void MediaSessionPrivate::updateRtpStats (LinphoneCallStats *stats, int streamIndex) {
if (sessions[streamIndex].rtp_session) {
const rtp_stats_t *rtpStats = rtp_session_get_stats(sessions[streamIndex].rtp_session);
if (stats)
memcpy(&(stats->rtp_stats), rtpStats, sizeof(*rtpStats));
if (rtpStats)
_linphone_call_stats_set_rtp_stats(stats, rtpStats);
}
}
@ -3604,12 +3602,12 @@ void MediaSessionPrivate::reportBandwidth () {
reportBandwidthForStream(&textStream->ms, LinphoneStreamTypeText);
lInfo() << "Bandwidth usage for CallSession [" << q << "]:\n" << fixed << setprecision(2) <<
"\tRTP audio=[d=" << audioStats->download_bandwidth << ",u=" << audioStats->upload_bandwidth <<
"], video=[d=" << videoStats->download_bandwidth << ",u=" << videoStats->upload_bandwidth <<
"], text=[d=" << textStats->download_bandwidth << ",u=" << textStats->upload_bandwidth << "] kbits/sec\n" <<
"\tRTCP audio=[d=" << audioStats->rtcp_download_bandwidth << ",u=" << audioStats->rtcp_upload_bandwidth <<
"], video=[d=" << videoStats->rtcp_download_bandwidth << ",u=" << videoStats->rtcp_upload_bandwidth <<
"], text=[d=" << textStats->rtcp_download_bandwidth << ",u=" << textStats->rtcp_upload_bandwidth << "] kbits/sec";
"\tRTP audio=[d=" << linphone_call_stats_get_download_bandwidth(audioStats) << ",u=" << linphone_call_stats_get_upload_bandwidth(audioStats) <<
"], video=[d=" << linphone_call_stats_get_download_bandwidth(videoStats) << ",u=" << linphone_call_stats_get_upload_bandwidth(videoStats) <<
"], text=[d=" << linphone_call_stats_get_download_bandwidth(textStats) << ",u=" << linphone_call_stats_get_upload_bandwidth(textStats) << "] kbits/sec\n" <<
"\tRTCP audio=[d=" << linphone_call_stats_get_rtcp_download_bandwidth(audioStats) << ",u=" << linphone_call_stats_get_rtcp_upload_bandwidth(audioStats) <<
"], video=[d=" << linphone_call_stats_get_rtcp_download_bandwidth(videoStats) << ",u=" << linphone_call_stats_get_rtcp_upload_bandwidth(videoStats) <<
"], text=[d=" << linphone_call_stats_get_rtcp_download_bandwidth(textStats) << ",u=" << linphone_call_stats_get_rtcp_upload_bandwidth(textStats) << "] kbits/sec";
}
void MediaSessionPrivate::reportBandwidthForStream (MediaStream *ms, LinphoneStreamType type) {
@ -3624,19 +3622,20 @@ void MediaSessionPrivate::reportBandwidthForStream (MediaStream *ms, LinphoneStr
return;
bool active = ms ? (media_stream_get_state(ms) == MSStreamStarted) : false;
stats->download_bandwidth = active ? (float)(media_stream_get_down_bw(ms) * 1e-3) : 0.f;
stats->upload_bandwidth = active ? (float)(media_stream_get_up_bw(ms) * 1e-3) : 0.f;
stats->rtcp_download_bandwidth = active ? (float)(media_stream_get_rtcp_down_bw(ms) * 1e-3) : 0.f;
stats->rtcp_upload_bandwidth = active ? (float)(media_stream_get_rtcp_up_bw(ms) * 1e-3) : 0.f;
stats->rtp_remote_family = active ? (ortp_stream_is_ipv6(&ms->sessions.rtp_session->rtp.gs) ? LinphoneAddressFamilyInet6 : LinphoneAddressFamilyInet) : LinphoneAddressFamilyUnspec;
_linphone_call_stats_set_download_bandwidth(stats, active ? (float)(media_stream_get_down_bw(ms) * 1e-3) : 0.f);
_linphone_call_stats_set_upload_bandwidth(stats, active ? (float)(media_stream_get_up_bw(ms) * 1e-3) : 0.f);
_linphone_call_stats_set_rtcp_download_bandwidth(stats, active ? (float)(media_stream_get_rtcp_down_bw(ms) * 1e-3) : 0.f);
_linphone_call_stats_set_rtcp_upload_bandwidth(stats, active ? (float)(media_stream_get_rtcp_up_bw(ms) * 1e-3) : 0.f);
_linphone_call_stats_set_ip_family_of_remote(stats,
active ? (ortp_stream_is_ipv6(&ms->sessions.rtp_session->rtp.gs) ? LinphoneAddressFamilyInet6 : LinphoneAddressFamilyInet) : LinphoneAddressFamilyUnspec);
if (core->send_call_stats_periodical_updates) {
if (active)
linphone_call_stats_update(stats, ms);
stats->updated |= LINPHONE_CALL_STATS_PERIODICAL_UPDATE;
_linphone_call_stats_set_updated(stats, _linphone_call_stats_get_updated(stats) | LINPHONE_CALL_STATS_PERIODICAL_UPDATE);
if (listener)
listener->onStatsUpdated(stats);
stats->updated = 0;
_linphone_call_stats_set_updated(stats, 0);
}
}
@ -3767,7 +3766,7 @@ void MediaSessionPrivate::terminate () {
CallSessionPrivate::terminate();
}
void MediaSessionPrivate::updateCurrentParams () {
void MediaSessionPrivate::updateCurrentParams () const {
CallSessionPrivate::updateCurrentParams();
LinphoneVideoDefinition *vdef = linphone_video_definition_new(MS_VIDEO_SIZE_UNKNOWN_W, MS_VIDEO_SIZE_UNKNOWN_H, nullptr);
@ -4516,8 +4515,8 @@ float MediaSession::getAverageQuality () const {
return MediaSessionPrivate::aggregateQualityRatings(audioRating, videoRating);
}
MediaSessionParams * MediaSession::getCurrentParams () {
L_D(MediaSession);
MediaSessionParams * MediaSession::getCurrentParams () const {
L_D(const MediaSession);
d->updateCurrentParams();
return d->currentParams;
}
@ -4538,8 +4537,8 @@ const MediaSessionParams * MediaSession::getMediaParams () const {
return d->params;
}
RtpTransport * MediaSession::getMetaRtcpTransport (int streamIndex) {
L_D(MediaSession);
RtpTransport * MediaSession::getMetaRtcpTransport (int streamIndex) const {
L_D(const MediaSession);
if ((streamIndex < 0) || (streamIndex >= getStreamCount()))
return nullptr;
RtpTransport *metaRtp;
@ -4548,8 +4547,8 @@ RtpTransport * MediaSession::getMetaRtcpTransport (int streamIndex) {
return metaRtcp;
}
RtpTransport * MediaSession::getMetaRtpTransport (int streamIndex) {
L_D(MediaSession);
RtpTransport * MediaSession::getMetaRtpTransport (int streamIndex) const {
L_D(const MediaSession);
if ((streamIndex < 0) || (streamIndex >= getStreamCount()))
return nullptr;
RtpTransport *metaRtp;
@ -4676,7 +4675,7 @@ LinphoneCallStats * MediaSession::getStats (LinphoneStreamType type) const {
if (type == LinphoneStreamTypeUnknown)
return nullptr;
LinphoneCallStats *stats = nullptr;
LinphoneCallStats *statsCopy = linphone_call_stats_new();
LinphoneCallStats *statsCopy = _linphone_call_stats_new();
if (type == LinphoneStreamTypeAudio)
stats = d->audioStats;
else if (type == LinphoneStreamTypeVideo)
@ -4690,7 +4689,7 @@ LinphoneCallStats * MediaSession::getStats (LinphoneStreamType type) const {
return statsCopy;
}
int MediaSession::getStreamCount () {
int MediaSession::getStreamCount () const {
/* TODO: Revisit when multiple media streams will be implemented */
#ifdef VIDEO_ENABLED
if (getCurrentParams()->realtimeTextEnabled())
@ -4725,9 +4724,9 @@ LinphoneCallStats * MediaSession::getVideoStats () const {
bool MediaSession::mediaInProgress () const {
L_D(const MediaSession);
if ((d->audioStats->ice_state == LinphoneIceStateInProgress)
|| (d->videoStats->ice_state == LinphoneIceStateInProgress)
|| (d->textStats->ice_state == LinphoneIceStateInProgress))
if ((linphone_call_stats_get_ice_state(d->audioStats) == LinphoneIceStateInProgress)
|| (linphone_call_stats_get_ice_state(d->videoStats) == LinphoneIceStateInProgress)
|| (linphone_call_stats_get_ice_state(d->textStats) == LinphoneIceStateInProgress))
return true;
/* TODO: could check zrtp state */
return false;

View file

@ -69,11 +69,11 @@ public:
std::string getAuthenticationToken () const;
bool getAuthenticationTokenVerified () const;
float getAverageQuality () const;
MediaSessionParams *getCurrentParams ();
MediaSessionParams *getCurrentParams () const;
float getCurrentQuality () const;
const MediaSessionParams *getMediaParams () const;
RtpTransport * getMetaRtcpTransport (int streamIndex);
RtpTransport * getMetaRtpTransport (int streamIndex);
RtpTransport * getMetaRtcpTransport (int streamIndex) const;
RtpTransport * getMetaRtpTransport (int streamIndex) const;
float getMicrophoneVolumeGain () const;
void * getNativeVideoWindowId () const;
const CallSessionParams *getParams () const override;
@ -82,7 +82,7 @@ public:
const MediaSessionParams *getRemoteParams ();
float getSpeakerVolumeGain () const;
LinphoneCallStats * getStats (LinphoneStreamType type) const;
int getStreamCount ();
int getStreamCount () const;
MSFormatType getStreamType (int streamIndex) const;
LinphoneCallStats * getTextStats () const;
LinphoneCallStats * getVideoStats () const;

View file

@ -233,35 +233,35 @@ void IceAgent::updateIceStateInCallStats () {
LinphoneCallStats *textStats = mediaSession.getPrivate()->getStats(LinphoneStreamTypeText);
IceSessionState sessionState = ice_session_state(iceSession);
if ((sessionState == IS_Completed) || ((sessionState == IS_Failed) && ice_session_has_completed_check_list(iceSession))) {
audioStats->ice_state = LinphoneIceStateNotActivated;
_linphone_call_stats_set_ice_state(audioStats, LinphoneIceStateNotActivated);
if (audioCheckList && mediaSession.getMediaParams()->audioEnabled())
updateIceStateInCallStatsForStream(audioStats, audioCheckList);
videoStats->ice_state = LinphoneIceStateNotActivated;
_linphone_call_stats_set_ice_state(videoStats, LinphoneIceStateNotActivated);
if (videoCheckList && mediaSession.getMediaParams()->videoEnabled())
updateIceStateInCallStatsForStream(videoStats, videoCheckList);
textStats->ice_state = LinphoneIceStateNotActivated;
_linphone_call_stats_set_ice_state(textStats, LinphoneIceStateNotActivated);
if (textCheckList && mediaSession.getMediaParams()->realtimeTextEnabled())
updateIceStateInCallStatsForStream(textStats, textCheckList);
} else if (sessionState == IS_Running) {
if (audioCheckList && mediaSession.getMediaParams()->audioEnabled())
audioStats->ice_state = LinphoneIceStateInProgress;
_linphone_call_stats_set_ice_state(audioStats, LinphoneIceStateInProgress);
if (videoCheckList && mediaSession.getMediaParams()->videoEnabled())
videoStats->ice_state = LinphoneIceStateInProgress;
_linphone_call_stats_set_ice_state(videoStats, LinphoneIceStateInProgress);
if (textCheckList && mediaSession.getMediaParams()->realtimeTextEnabled())
textStats->ice_state = LinphoneIceStateInProgress;
_linphone_call_stats_set_ice_state(textStats, LinphoneIceStateInProgress);
} else {
if (audioCheckList && mediaSession.getMediaParams()->audioEnabled())
audioStats->ice_state = LinphoneIceStateFailed;
_linphone_call_stats_set_ice_state(audioStats, LinphoneIceStateFailed);
if (videoCheckList && mediaSession.getMediaParams()->videoEnabled())
videoStats->ice_state = LinphoneIceStateFailed;
_linphone_call_stats_set_ice_state(videoStats, LinphoneIceStateFailed);
if (textCheckList && mediaSession.getMediaParams()->realtimeTextEnabled())
textStats->ice_state = LinphoneIceStateFailed;
_linphone_call_stats_set_ice_state(textStats, LinphoneIceStateFailed);
}
lInfo() << "CallSession [" << &mediaSession << "] New ICE state: audio: [" << linphone_ice_state_to_string(audioStats->ice_state)
<< "] video: [" << linphone_ice_state_to_string(videoStats->ice_state)
<< "] text: [" << linphone_ice_state_to_string(textStats->ice_state) << "]";
lInfo() << "CallSession [" << &mediaSession << "] New ICE state: audio: [" << linphone_ice_state_to_string(linphone_call_stats_get_ice_state(audioStats))
<< "] video: [" << linphone_ice_state_to_string(linphone_call_stats_get_ice_state(videoStats))
<< "] text: [" << linphone_ice_state_to_string(linphone_call_stats_get_ice_state(textStats)) << "]";
}
void IceAgent::updateLocalMediaDescriptionFromIce (SalMediaDescription *desc) {
@ -387,7 +387,7 @@ void IceAgent::addLocalIceCandidates (int family, const char *addr, IceCheckList
ice_add_local_candidate(audioCl, "host", family, addr, rtpPort, 1, nullptr);
ice_add_local_candidate(audioCl, "host", family, addr, rtcpPort, 2, nullptr);
LinphoneCallStats *audioStats = mediaSession.getPrivate()->getStats(LinphoneStreamTypeAudio);
audioStats->ice_state = LinphoneIceStateInProgress;
_linphone_call_stats_set_ice_state(audioStats, LinphoneIceStateInProgress);
}
LinphoneCore *core = mediaSession.getPrivate()->getCore();
if (linphone_core_video_enabled(core) && videoCl && (ice_check_list_state(videoCl) != ICL_Completed) && !ice_check_list_candidates_gathered(videoCl)) {
@ -396,7 +396,7 @@ void IceAgent::addLocalIceCandidates (int family, const char *addr, IceCheckList
ice_add_local_candidate(videoCl, "host", family, addr, rtpPort, 1, nullptr);
ice_add_local_candidate(videoCl, "host", family, addr, rtcpPort, 2, nullptr);
LinphoneCallStats *videoStats = mediaSession.getPrivate()->getStats(LinphoneStreamTypeVideo);
videoStats->ice_state = LinphoneIceStateInProgress;
_linphone_call_stats_set_ice_state(videoStats, LinphoneIceStateInProgress);
}
if (mediaSession.getMediaParams()->realtimeTextEnabled() && textCl && (ice_check_list_state(textCl) != ICL_Completed) && !ice_check_list_candidates_gathered(textCl)) {
int rtpPort = mediaSession.getPrivate()->getRtpPort(LinphoneStreamTypeText);
@ -404,7 +404,7 @@ void IceAgent::addLocalIceCandidates (int family, const char *addr, IceCheckList
ice_add_local_candidate(textCl, "host", family, addr, rtpPort, 1, nullptr);
ice_add_local_candidate(textCl, "host", family, addr, rtcpPort, 2, nullptr);
LinphoneCallStats *textStats = mediaSession.getPrivate()->getStats(LinphoneStreamTypeText);
textStats->ice_state = LinphoneIceStateInProgress;
_linphone_call_stats_set_ice_state(textStats, LinphoneIceStateInProgress);
}
}
@ -671,14 +671,14 @@ void IceAgent::updateIceStateInCallStatsForStream (LinphoneCallStats *stats, Ice
if (ice_check_list_state(cl) == ICL_Completed) {
switch (ice_check_list_selected_valid_candidate_type(cl)) {
case ICT_HostCandidate:
stats->ice_state = LinphoneIceStateHostConnection;
_linphone_call_stats_set_ice_state(stats, LinphoneIceStateHostConnection);
break;
case ICT_ServerReflexiveCandidate:
case ICT_PeerReflexiveCandidate:
stats->ice_state = LinphoneIceStateReflexiveConnection;
_linphone_call_stats_set_ice_state(stats, LinphoneIceStateReflexiveConnection);
break;
case ICT_RelayedCandidate:
stats->ice_state = LinphoneIceStateRelayConnection;
_linphone_call_stats_set_ice_state(stats, LinphoneIceStateRelayConnection);
break;
case ICT_CandidateInvalid:
case ICT_CandidateTypeMax:
@ -686,7 +686,7 @@ void IceAgent::updateIceStateInCallStatsForStream (LinphoneCallStats *stats, Ice
break;
}
} else
stats->ice_state = LinphoneIceStateFailed;
_linphone_call_stats_set_ice_state(stats, LinphoneIceStateFailed);
}
LINPHONE_END_NAMESPACE