Add reference count handling to the LinphoneCallParams object.

This commit is contained in:
Ghislain MARY 2014-09-01 14:58:04 +02:00
parent 1ce425fc1c
commit eaa1d6bb1d
13 changed files with 680 additions and 484 deletions

View file

@ -67,6 +67,7 @@ LOCAL_SRC_FILES := \
remote_provisioning.c \
quality_reporting.c \
call_log.c \
call_params.c \
player.c
ifndef LINPHONE_VERSION

View file

@ -108,6 +108,7 @@
<ClCompile Include="..\..\coreapi\bellesip_sal\sal_op_registration.c" />
<ClCompile Include="..\..\coreapi\bellesip_sal\sal_sdp.c" />
<ClCompile Include="..\..\coreapi\call_log.c" />
<ClCompile Include="..\..\coreapi\call_params.c" />
<ClCompile Include="..\..\coreapi\callbacks.c" />
<ClCompile Include="..\..\coreapi\chat.c" />
<ClCompile Include="..\..\coreapi\conference.c" />

View file

@ -43,6 +43,7 @@ set(SOURCE_FILES
bellesip_sal/sal_sdp.c
callbacks.c
call_log.c
call_params.c
chat.c
conference.c
ec-calibrator.c
@ -143,6 +144,7 @@ install(TARGETS linphone
set(HEADER_FILES
call_log.h
call_params.h
event.h
linphonecore.h
linphonecore_utils.h

View file

@ -24,7 +24,7 @@ CLEANFILES=$(GITVERSION_FILE)
## Process this file with automake to produce Makefile.in
linphone_includedir=$(includedir)/linphone
linphone_include_HEADERS=linphonecore.h linphonefriend.h linphonepresence.h linphonecore_utils.h lpconfig.h sipsetup.h event.h xml2lpc.h lpc2xml.h linphone_tunnel.h call_log.h
linphone_include_HEADERS=linphonecore.h linphonefriend.h linphonepresence.h linphonecore_utils.h lpconfig.h sipsetup.h event.h xml2lpc.h lpc2xml.h linphone_tunnel.h call_log.h call_params.h
lib_LTLIBRARIES=liblinphone.la
@ -60,6 +60,7 @@ liblinphone_la_SOURCES=\
remote_provisioning.c \
quality_reporting.c quality_reporting.h\
call_log.c \
call_params.c \
player.c \
$(GITVERSION_FILE)

220
coreapi/call_params.c Normal file
View file

@ -0,0 +1,220 @@
/*
linphone
Copyright (C) 2010-2014 Belledonne Communications SARL
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "private.h"
/*******************************************************************************
* Internal functions *
******************************************************************************/
SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params) {
if ((params->media_encryption == LinphoneMediaEncryptionSRTP) && params->avpf_enabled) return SalProtoRtpSavpf;
if (params->media_encryption == LinphoneMediaEncryptionSRTP) return SalProtoRtpSavp;
if (params->avpf_enabled) return SalProtoRtpAvpf;
return SalProtoRtpAvp;
}
/*******************************************************************************
* Public functions *
******************************************************************************/
void linphone_call_params_add_custom_header(LinphoneCallParams *params, const char *header_name, const char *header_value){
params->custom_headers=sal_custom_header_append(params->custom_headers,header_name,header_value);
}
LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp){
LinphoneCallParams *ncp=linphone_call_params_new();
memcpy(ncp,cp,sizeof(LinphoneCallParams));
if (cp->record_file) ncp->record_file=ms_strdup(cp->record_file);
if (cp->session_name) ncp->session_name=ms_strdup(cp->session_name);
/*
* The management of the custom headers is not optimal. We copy everything while ref counting would be more efficient.
*/
if (cp->custom_headers) ncp->custom_headers=sal_custom_header_clone(cp->custom_headers);
return ncp;
}
bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *cp){
return cp->real_early_media;
}
void linphone_call_params_enable_early_media_sending(LinphoneCallParams *cp, bool_t enabled){
cp->real_early_media=enabled;
}
void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled){
cp->low_bandwidth=enabled;
}
void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled){
cp->has_video=enabled;
}
const char *linphone_call_params_get_custom_header(const LinphoneCallParams *params, const char *header_name){
return sal_custom_header_find(params->custom_headers,header_name);
}
bool_t linphone_call_params_get_local_conference_mode(const LinphoneCallParams *cp){
return cp->in_conference;
}
LinphoneMediaEncryption linphone_call_params_get_media_encryption(const LinphoneCallParams *cp) {
return cp->media_encryption;
}
float linphone_call_params_get_received_framerate(const LinphoneCallParams *cp){
return cp->received_fps;
}
MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParams *cp) {
return cp->recv_vsize;
}
const char *linphone_call_params_get_record_file(const LinphoneCallParams *cp){
return cp->record_file;
}
const char * linphone_call_params_get_rtp_profile(const LinphoneCallParams *cp) {
return sal_media_proto_to_string(get_proto_from_call_params(cp));
}
float linphone_call_params_get_sent_framerate(const LinphoneCallParams *cp){
return cp->sent_fps;
}
MSVideoSize linphone_call_params_get_sent_video_size(const LinphoneCallParams *cp) {
return cp->sent_vsize;
}
const char *linphone_call_params_get_session_name(const LinphoneCallParams *cp){
return cp->session_name;
}
const LinphonePayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp) {
return cp->audio_codec;
}
const LinphonePayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp) {
return cp->video_codec;
}
bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp) {
return cp->low_bandwidth;
}
void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bandwidth){
cp->audio_bw=bandwidth;
}
void linphone_call_params_set_media_encryption(LinphoneCallParams *cp, LinphoneMediaEncryption e) {
cp->media_encryption = e;
}
void linphone_call_params_set_record_file(LinphoneCallParams *cp, const char *path){
if (cp->record_file){
ms_free(cp->record_file);
cp->record_file=NULL;
}
if (path) cp->record_file=ms_strdup(path);
}
void linphone_call_params_set_session_name(LinphoneCallParams *cp, const char *name){
if (cp->session_name){
ms_free(cp->session_name);
cp->session_name=NULL;
}
if (name) cp->session_name=ms_strdup(name);
}
bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp){
return cp->has_video;
}
/**
* @ingroup call_control
* Set requested level of privacy for the call.
* \xmlonly <language-tags>javascript</language-tags> \endxmlonly
* @param params the call parameters to be modified
* @param privacy LinphonePrivacy to configure privacy
* */
void linphone_call_params_set_privacy(LinphoneCallParams *params, LinphonePrivacyMask privacy) {
params->privacy=privacy;
}
/**
* @ingroup call_control
* Get requested level of privacy for the call.
* @param params the call parameters
* @return Privacy mode
* */
LinphonePrivacyMask linphone_call_params_get_privacy(const LinphoneCallParams *params) {
return params->privacy;
}
/*******************************************************************************
* Reference and user data handling functions *
******************************************************************************/
void *linphone_call_params_get_user_data(const LinphoneCallParams *cp) {
return cp->user_data;
}
void linphone_call_params_set_user_data(LinphoneCallParams *cp, void *ud) {
cp->user_data = ud;
}
LinphoneCallParams * linphone_call_params_ref(LinphoneCallParams *cp) {
belle_sip_object_ref(cp);
return cp;
}
void linphone_call_params_unref(LinphoneCallParams *cp) {
belle_sip_object_unref(cp);
}
/*******************************************************************************
* Constructor and destructor functions *
******************************************************************************/
static void _linphone_call_params_destroy(LinphoneCallParams *cp){
if (cp->record_file) ms_free(cp->record_file);
if (cp->custom_headers) sal_custom_header_free(cp->custom_headers);
}
LinphoneCallParams * linphone_call_params_new(void) {
return belle_sip_object_new(LinphoneCallParams);
}
/* DEPRECATED */
void linphone_call_params_destroy(LinphoneCallParams *cp) {
linphone_call_params_unref(cp);
}
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneCallParams);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneCallParams, belle_sip_object_t,
(belle_sip_object_destroy_t)_linphone_call_params_destroy,
NULL, // clone
NULL, // marshal
FALSE
);

288
coreapi/call_params.h Normal file
View file

@ -0,0 +1,288 @@
/*
linphone
Copyright (C) 2010-2014 Belledonne Communications SARL
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __LINPHONE_CALL_PARAMS_H__
#define __LINPHONE_CALL_PARAMS_H__
/**
* @addtogroup call_control
* @{
**/
/*******************************************************************************
* Structures and enums *
******************************************************************************/
/**
* Private structure definition for LinphoneCallParams.
**/
struct _LinphoneCallParams;
/**
* The LinphoneCallParams is an object containing various call related parameters.
* It can be used to retrieve parameters from a currently running call or modify
* the call's characteristics dynamically.
**/
typedef struct _LinphoneCallParams LinphoneCallParams;
/*******************************************************************************
* Public functions *
******************************************************************************/
/**
* Add a custom SIP header in the INVITE for a call.
* @param[in] cp The #LinphoneCallParams to add a custom SIP header to.
* @param[in] header_name The name of the header to add.
* @param[in] header_value The content of the header to add.
**/
LINPHONE_PUBLIC void linphone_call_params_add_custom_header(LinphoneCallParams *cp, const char *header_name, const char *header_value);
/**
* Copy an existing LinphoneCallParams object to a new LinphoneCallParams object.
* @param[in] cp The LinphoneCallParams object to copy.
* @return A copy of the LinphoneCallParams object.
**/
LINPHONE_PUBLIC LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp);
/**
* Indicate whether sending of early media was enabled.
* @param[in] cp LinphoneCallParams object
* @return A boolean value telling whether sending of early media was enabled.
**/
LINPHONE_PUBLIC bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *cp);
/**
* Enable sending of real early media (during outgoing calls).
* @param[in] cp LinphoneCallParams object
* @param[in] enabled A boolean value telling whether to enable early media sending or not.
**/
LINPHONE_PUBLIC void linphone_call_params_enable_early_media_sending(LinphoneCallParams *cp, bool_t enabled);
/**
* Indicate low bandwith mode.
* Configuring a call to low bandwidth mode will result in the core to activate several settings for the call in order to ensure that bitrate usage
* is lowered to the minimum possible. Typically, ptime (packetization time) will be increased, audio codec's output bitrate will be targetted to 20kbit/s provided
* that it is achievable by the codec selected after SDP handshake. Video is automatically disabled.
* @param[in] cp LinphoneCallParams object
* @param[in] enabled A boolean value telling whether to activate the low bandwidth mode or not.
**/
LINPHONE_PUBLIC void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled);
/**
* Enable video stream.
* @param[in] cp LinphoneCallParams object
* @param[in] enabled A boolean value telling whether to enable video or not.
**/
LINPHONE_PUBLIC void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled);
/**
* Get a custom SIP header.
* @param[in] cp The #LinphoneCallParams to get the custom SIP header from.
* @param[in] header_name The name of the header to get.
* @return The content of the header or NULL if not found.
**/
LINPHONE_PUBLIC const char *linphone_call_params_get_custom_header(const LinphoneCallParams *cp, const char *header_name);
/**
* Tell whether the call is part of the locally managed conference.
* @param[in] cp LinphoneCallParams object
* @return A boolean value telling whether the call is part of the locally managed conference.
**/
LINPHONE_PUBLIC bool_t linphone_call_params_get_local_conference_mode(const LinphoneCallParams *cp);
/**
* Get the kind of media encryption selected for the call.
* @param[in] cp LinphoneCallParams object
* @return The kind of media encryption selected for the call.
**/
LINPHONE_PUBLIC LinphoneMediaEncryption linphone_call_params_get_media_encryption(const LinphoneCallParams *cp);
/**
* Get the framerate of the video that is received.
* @param[in] cp LinphoneCallParams object
* @return The actual received framerate in frames per seconds, 0 if not available.
*/
LINPHONE_PUBLIC float linphone_call_params_get_received_framerate(const LinphoneCallParams *cp);
/**
* Get the size of the video that is received.
* @param[in] cp LinphoneCallParams object
* @return The received video size or MS_VIDEO_SIZE_UNKNOWN if not available.
*/
LINPHONE_PUBLIC MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParams *cp);
/**
* Get the path for the audio recording of the call.
* @param[in] cp LinphoneCallParams object
* @return The path to the audio recording of the call.
**/
LINPHONE_PUBLIC const char *linphone_call_params_get_record_file(const LinphoneCallParams *cp);
/**
* Get the RTP profile being used.
* @param[in] cp #LinphoneCallParams object
* @return The RTP profile.
*/
LINPHONE_PUBLIC const char * linphone_call_params_get_rtp_profile(const LinphoneCallParams *cp);
/**
* Get the framerate of the video that is sent.
* @param[in] cp LinphoneCallParams object
* @return The actual sent framerate in frames per seconds, 0 if not available.
*/
LINPHONE_PUBLIC float linphone_call_params_get_sent_framerate(const LinphoneCallParams *cp);
/**
* Gets the size of the video that is sent.
* @param[in] cp LinphoneCalParams object
* @return The sent video size or MS_VIDEO_SIZE_UNKNOWN if not available.
*/
LINPHONE_PUBLIC MSVideoSize linphone_call_params_get_sent_video_size(const LinphoneCallParams *cp);
/**
* Get the session name of the media session (ie in SDP).
* Subject from the SIP message can be retrieved using linphone_call_params_get_custom_header() and is different.
* @param[in] cp LinphoneCallParams object
* @return The session name of the media session.
**/
LINPHONE_PUBLIC const char *linphone_call_params_get_session_name(const LinphoneCallParams *cp);
/**
* Get the audio codec used in the call, described as a LinphonePayloadType object.
* @param[in] cp LinphoneCallParams object
* @return The LinphonePayloadType object corresponding to the audio codec being used in the call.
**/
LINPHONE_PUBLIC const LinphonePayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp);
/**
* Get the video codec used in the call, described as a LinphonePayloadType structure.
* @param[in] cp LinphoneCallParams object
* @return The LinphonePayloadType object corresponding to the video codec being used in the call.
**/
LINPHONE_PUBLIC const LinphonePayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp);
/**
* Tell whether the call has been configured in low bandwidth mode or not.
* This mode can be automatically discovered thanks to a stun server when activate_edge_workarounds=1 in section [net] of configuration file.
* An application that would have reliable way to know network capacity may not use activate_edge_workarounds=1 but instead manually configure
* low bandwidth mode with linphone_call_params_enable_low_bandwidth().
* When enabled, this param may transform a call request with video in audio only mode.
* @param[in] cp LinphoneCallParams object
* @return A boolean value telling whether the low bandwidth mode has been configured/detected.
*/
LINPHONE_PUBLIC bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp);
/**
* Refine bandwidth settings for this call by setting a bandwidth limit for audio streams.
* As a consequence, codecs whose bitrates are not compatible with this limit won't be used.
* @param[in] cp LinphoneCallParams object
* @param[in] bw The audio bandwidth limit to set in kbit/s.
**/
LINPHONE_PUBLIC void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bw);
/**
* Set requested media encryption for a call.
* @param[in] cp LinphoneCallParams object
* @param[in] enc The media encryption to use for the call.
**/
LINPHONE_PUBLIC void linphone_call_params_set_media_encryption(LinphoneCallParams *cp, LinphoneMediaEncryption enc);
/**
* Enable recording of the call.
* This function must be used before the call parameters are assigned to the call.
* The call recording can be started and paused after the call is established with
* linphone_call_start_recording() and linphone_call_pause_recording().
* @param[in] cp LinphoneCallParams object
* @param[in] path A string containing the path and filename of the file where audio/video streams are to be written.
* The filename must have either .mkv or .wav extention. The video stream will be written only if a MKV file is given.
**/
LINPHONE_PUBLIC void linphone_call_params_set_record_file(LinphoneCallParams *cp, const char *path);
/**
* Set the session name of the media session (ie in SDP).
* Subject from the SIP message (which is different) can be set using linphone_call_params_set_custom_header().
* @param[in] cp LinphoneCallParams object
* @param[in] name The session name to be used.
**/
LINPHONE_PUBLIC void linphone_call_params_set_session_name(LinphoneCallParams *cp, const char *name);
/**
* Tell whether video is enabled or not.
* @param[in] cp LinphoneCallParams object
* @return A boolean value telling whether video is enabled or not.
**/
LINPHONE_PUBLIC bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp);
/*******************************************************************************
* Reference and user data handling functions *
******************************************************************************/
/**
* Get the user data associated with the call params.
* @param[in] cl LinphoneCallParams object
* @return The user data associated with the call params.
**/
LINPHONE_PUBLIC void *linphone_call_params_get_user_data(const LinphoneCallParams *cp);
/**
* Assign a user data to the call params.
* @param[in] cl LinphoneCallParams object
* @param[in] ud The user data to associate with the call params.
**/
LINPHONE_PUBLIC void linphone_call_params_set_user_data(LinphoneCallParams *cp, void *ud);
/**
* Acquire a reference to the call params.
* @param[in] cl LinphoneCallParams object
* @return The same LinphoneCallParams object
**/
LINPHONE_PUBLIC LinphoneCallParams * linphone_call_params_ref(LinphoneCallParams *cp);
/**
* Release a reference to the call params.
* @param[in] cl LinphoneCallParams object
**/
LINPHONE_PUBLIC void linphone_call_params_unref(LinphoneCallParams *cp);
/*******************************************************************************
* DEPRECATED *
******************************************************************************/
/** @deprecated Use linphone_call_params_get_local_conference_mode() instead. */
#define linphone_call_params_local_conference_mode linphone_call_params_get_local_conference_mode
/**
* Destroy a LinphoneCallParams object.
* @param[in] cp LinphoneCallParams object
* @deprecated Use linphone_call_params_unref() instead.
**/
LINPHONE_PUBLIC void linphone_call_params_destroy(LinphoneCallParams *cp);
/**
* @}
**/
#endif /* __LINPHONE_CALL_PARAMS_H__ */

View file

@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void register_failure(SalOp *op);
static int media_parameters_changed(LinphoneCall *call, SalMediaDescription *oldmd, SalMediaDescription *newmd) {
if (call->params.in_conference != call->current_params.in_conference) return SAL_MEDIA_DESCRIPTION_CHANGED;
if (call->params->in_conference != call->current_params->in_conference) return SAL_MEDIA_DESCRIPTION_CHANGED;
if (call->up_bw != linphone_core_get_upload_bandwidth(call->core)) return SAL_MEDIA_DESCRIPTION_CHANGED;
if (call->localdesc_changed) ms_message("Local description has changed: %i", call->localdesc_changed);
return call->localdesc_changed | sal_media_description_equals(oldmd, newmd);
@ -171,10 +171,10 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
if (call->state==LinphoneCallIncomingEarlyMedia && linphone_core_get_remote_ringback_tone (lc)!=NULL){
send_ringbacktone=TRUE;
}
if ((call->state==LinphoneCallIncomingEarlyMedia || call->state==LinphoneCallOutgoingEarlyMedia) && !call->params.real_early_media){
if ((call->state==LinphoneCallIncomingEarlyMedia || call->state==LinphoneCallOutgoingEarlyMedia) && !call->params->real_early_media){
all_muted=TRUE;
}
if (call->params.real_early_media && call->state==LinphoneCallOutgoingEarlyMedia){
if (call->params->real_early_media && call->state==LinphoneCallOutgoingEarlyMedia){
prepare_early_media_forking(call);
}
linphone_call_start_media_streams(call,all_muted,send_ringbacktone);
@ -349,7 +349,7 @@ static void call_ringing(SalOp *h){
if (call==NULL) return;
/*set privacy*/
call->current_params.privacy=(LinphonePrivacyMask)sal_op_get_privacy(call->op);
call->current_params->privacy=(LinphonePrivacyMask)sal_op_get_privacy(call->op);
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Remote ringing."));
@ -402,7 +402,7 @@ static void call_accepted(SalOp *op){
return ;
}
/*set privacy*/
call->current_params.privacy=(LinphonePrivacyMask)sal_op_get_privacy(call->op);
call->current_params->privacy=(LinphonePrivacyMask)sal_op_get_privacy(call->op);
/* Handle remote ICE attributes if any. */
if (call->ice_session != NULL) {
@ -416,7 +416,7 @@ static void call_accepted(SalOp *op){
md=sal_call_get_final_media_description(op);
if (md) /*make sure re-invite will not propose video again*/
call->params.has_video &= linphone_core_media_description_contains_video_stream(md);
call->params->has_video &= linphone_core_media_description_contains_video_stream(md);
if (call->state==LinphoneCallOutgoingProgress ||
call->state==LinphoneCallOutgoingRinging ||
@ -470,7 +470,7 @@ static void call_accepted(SalOp *op){
/*also reflect the change if the "wished" params, in order to avoid to propose SAVP or video again
* further in the call, for example during pause,resume, conferencing reINVITEs*/
linphone_call_fix_call_parameters(call);
if (!call->current_params.in_conference)
if (!call->current_params->in_conference)
lc->current_call=call;
if (call->prevstate != LinphoneCallIncomingEarlyMedia) /*don't change state in aswer to a SIP UPDATE in early media*/
linphone_call_set_state(call, LinphoneCallStreamsRunning, "Streams running");
@ -743,22 +743,22 @@ static void call_failure(SalOp *op){
int i;
for (i = 0; i < call->localdesc->nb_streams; i++) {
if (!sal_stream_description_active(&call->localdesc->streams[i])) continue;
if (call->params.media_encryption == LinphoneMediaEncryptionSRTP) {
if (call->params.avpf_enabled == TRUE) {
if (call->params->media_encryption == LinphoneMediaEncryptionSRTP) {
if (call->params->avpf_enabled == TRUE) {
if (i == 0) ms_message("Retrying call [%p] with SAVP", call);
call->params.avpf_enabled = FALSE;
call->params->avpf_enabled = FALSE;
linphone_core_restart_invite(lc, call);
return;
} else if (!linphone_core_is_media_encryption_mandatory(lc)) {
if (i == 0) ms_message("Retrying call [%p] with AVP", call);
call->params.media_encryption = LinphoneMediaEncryptionNone;
call->params->media_encryption = LinphoneMediaEncryptionNone;
memset(call->localdesc->streams[i].crypto, 0, sizeof(call->localdesc->streams[i].crypto));
linphone_core_restart_invite(lc, call);
return;
}
} else if (call->params.avpf_enabled == TRUE) {
} else if (call->params->avpf_enabled == TRUE) {
if (i == 0) ms_message("Retrying call [%p] with AVP", call);
call->params.avpf_enabled = FALSE;
call->params->avpf_enabled = FALSE;
linphone_core_restart_invite(lc, call);
return;
}

View file

@ -99,7 +99,7 @@ void linphone_call_add_to_conf(LinphoneCall *call, bool_t muted){
LinphoneCore *lc=call->core;
LinphoneConference *conf=&lc->conf_ctx;
MSAudioEndpoint *ep;
call->params.has_video = FALSE;
call->params->has_video = FALSE;
call->camera_enabled = FALSE;
ep=ms_audio_endpoint_get_from_stream(call->audiostream,TRUE);
ms_audio_conference_add_member(conf->conf,ep);
@ -185,15 +185,15 @@ float linphone_core_get_conference_local_input_volume(LinphoneCore *lc){
int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){
LinphoneConference *conf=&lc->conf_ctx;
if (call->current_params.in_conference){
if (call->current_params->in_conference){
ms_error("Already in conference");
return -1;
}
conference_check_init(&lc->conf_ctx, lp_config_get_int(lc->config, "sound","conference_rate",16000));
if (call->state==LinphoneCallPaused){
call->params.in_conference=TRUE;
call->params.has_video=FALSE;
call->params->in_conference=TRUE;
call->params->has_video=FALSE;
linphone_core_resume_call(lc,call);
}else if (call->state==LinphoneCallStreamsRunning){
LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call));
@ -223,8 +223,8 @@ static int remove_from_conference(LinphoneCore *lc, LinphoneCall *call, bool_t a
int err=0;
char *str;
if (!call->current_params.in_conference){
if (call->params.in_conference){
if (!call->current_params->in_conference){
if (call->params->in_conference){
ms_warning("Not (yet) in conference, be patient");
return -1;
}else{
@ -232,7 +232,7 @@ static int remove_from_conference(LinphoneCore *lc, LinphoneCall *call, bool_t a
return -1;
}
}
call->params.in_conference=FALSE;
call->params->in_conference=FALSE;
str=linphone_call_get_remote_address_as_string(call);
ms_message("%s will be removed from conference", str);
@ -267,7 +267,7 @@ static int convert_conference_to_call(LinphoneCore *lc){
while (calls) {
LinphoneCall *rc=(LinphoneCall*)calls->data;
calls=calls->next;
if (rc->params.in_conference) { // not using current_param
if (rc->params->in_conference) { // not using current_param
bool_t active_after_removed=linphone_core_is_in_conference(lc);
err=remove_from_conference(lc, rc, active_after_removed);
break;
@ -370,7 +370,7 @@ int linphone_core_add_all_to_conference(LinphoneCore *lc) {
while (calls) {
LinphoneCall *call=(LinphoneCall*)calls->data;
calls=calls->next;
if (!call->current_params.in_conference) {
if (!call->current_params->in_conference) {
linphone_core_add_to_conference(lc, call);
}
}
@ -394,7 +394,7 @@ int linphone_core_terminate_conference(LinphoneCore *lc) {
while (calls) {
LinphoneCall *call=(LinphoneCall*)calls->data;
calls=calls->next;
if (call->current_params.in_conference) {
if (call->current_params->in_conference) {
linphone_core_terminate_call(lc, call);
}
}

View file

@ -154,12 +154,12 @@ static void propagate_encryption_changed(LinphoneCall *call){
LinphoneCore *lc=call->core;
if (!linphone_call_all_streams_encrypted(call)) {
ms_message("Some streams are not encrypted");
call->current_params.media_encryption=LinphoneMediaEncryptionNone;
call->current_params->media_encryption=LinphoneMediaEncryptionNone;
if (lc->vtable.call_encryption_changed)
lc->vtable.call_encryption_changed(call->core, call, FALSE, call->auth_token);
} else {
ms_message("All streams are encrypted");
call->current_params.media_encryption=LinphoneMediaEncryptionZRTP;
call->current_params->media_encryption=LinphoneMediaEncryptionZRTP;
if (lc->vtable.call_encryption_changed)
lc->vtable.call_encryption_changed(call->core, call, TRUE, call->auth_token);
}
@ -339,10 +339,10 @@ static void setup_rtcp_fb(LinphoneCall *call, SalMediaDescription *md) {
if (!sal_stream_description_active(&md->streams[i])) continue;
for (pt_it = md->streams[i].payloads; pt_it != NULL; pt_it = pt_it->next) {
pt = (PayloadType *)pt_it->data;
if (call->params.avpf_enabled == TRUE) {
if (call->params->avpf_enabled == TRUE) {
payload_type_set_flag(pt, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED);
avpf_params = payload_type_get_avpf_params(pt);
avpf_params.trr_interval = call->params.avpf_rr_interval;
avpf_params.trr_interval = call->params->avpf_rr_interval;
} else {
payload_type_unset_flag(pt, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED);
memset(&avpf_params, 0, sizeof(avpf_params));
@ -382,13 +382,6 @@ void linphone_call_increment_local_media_description(LinphoneCall *call){
md->session_ver++;
}
static SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params) {
if ((params->media_encryption == LinphoneMediaEncryptionSRTP) && params->avpf_enabled) return SalProtoRtpSavpf;
if (params->media_encryption == LinphoneMediaEncryptionSRTP) return SalProtoRtpSavp;
if (params->avpf_enabled) return SalProtoRtpAvpf;
return SalProtoRtpAvp;
}
void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *call){
MSList *l;
PayloadType *pt;
@ -399,9 +392,9 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *
SalMediaDescription *md=sal_media_description_new();
LinphoneAddress *addr;
char* local_ip=call->localip;
const char *subject=linphone_call_params_get_session_name(&call->params);
const char *subject=linphone_call_params_get_session_name(call->params);
linphone_core_adapt_to_network(lc,call->ping_time,&call->params);
linphone_core_adapt_to_network(lc,call->ping_time,call->params);
if (call->dest_proxy)
me=linphone_proxy_config_get_identity(call->dest_proxy);
@ -417,8 +410,8 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *
strncpy(md->username,linphone_address_get_username(addr),sizeof(md->username));
if (subject) strncpy(md->name,subject,sizeof(md->name));
if (call->params.down_bw)
md->bandwidth=call->params.down_bw;
if (call->params->down_bw)
md->bandwidth=call->params->down_bw;
else md->bandwidth=linphone_core_get_download_bandwidth(lc);
/*set audio capabilities */
@ -427,19 +420,19 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *
strncpy(md->streams[0].name,"Audio",sizeof(md->streams[0].name)-1);
md->streams[0].rtp_port=call->media_ports[0].rtp_port;
md->streams[0].rtcp_port=call->media_ports[0].rtcp_port;
md->streams[0].proto=get_proto_from_call_params(&call->params);
md->streams[0].proto=get_proto_from_call_params(call->params);
md->streams[0].type=SalAudio;
if (call->params.down_ptime)
md->streams[0].ptime=call->params.down_ptime;
if (call->params->down_ptime)
md->streams[0].ptime=call->params->down_ptime;
else
md->streams[0].ptime=linphone_core_get_download_ptime(lc);
l=make_codec_list(lc,lc->codecs_conf.audio_codecs,call->params.audio_bw,&md->streams[0].max_rate,-1);
l=make_codec_list(lc,lc->codecs_conf.audio_codecs,call->params->audio_bw,&md->streams[0].max_rate,-1);
pt=payload_type_clone(rtp_profile_get_payload_from_mime(lc->default_profile,"telephone-event"));
l=ms_list_append(l,pt);
md->streams[0].payloads=l;
nb_active_streams++;
if (call->params.has_video){
if (call->params->has_video){
strncpy(md->streams[1].rtp_addr,local_ip,sizeof(md->streams[1].rtp_addr));
strncpy(md->streams[1].rtcp_addr,local_ip,sizeof(md->streams[1].rtcp_addr));
strncpy(md->streams[1].name,"Video",sizeof(md->streams[1].name)-1);
@ -575,7 +568,8 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from,
call->media_start_time=0;
call->log=linphone_call_log_new(call->dir, from, to);
call->camera_enabled=TRUE;
call->current_params.media_encryption=LinphoneMediaEncryptionNone;
call->current_params = linphone_call_params_new();
call->current_params->media_encryption=LinphoneMediaEncryptionNone;
linphone_core_get_audio_port_range(call->core, &min_port, &max_port);
port_config_set(call,0,min_port,max_port);
@ -617,11 +611,11 @@ void linphone_call_create_op(LinphoneCall *call){
if (call->op) sal_op_release(call->op);
call->op=sal_op_new(call->core->sal);
sal_op_set_user_pointer(call->op,call);
if (call->params.referer)
sal_call_set_referer(call->op,call->params.referer->op);
linphone_configure_op(call->core,call->op,call->log->to,call->params.custom_headers,FALSE);
if (call->params.privacy != LinphonePrivacyDefault)
sal_op_set_privacy(call->op,(SalPrivacyMask)call->params.privacy);
if (call->params->referer)
sal_call_set_referer(call->op,call->params->referer->op);
linphone_configure_op(call->core,call->op,call->log->to,call->params->custom_headers,FALSE);
if (call->params->privacy != LinphonePrivacyDefault)
sal_op_set_privacy(call->op,(SalPrivacyMask)call->params->privacy);
/*else privacy might be set by proxy */
}
@ -700,7 +694,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr
linphone_call_outgoing_select_ip_version(call,to,cfg);
linphone_call_get_local_ip(call, to);
linphone_call_init_common(call,from,to);
_linphone_call_params_copy(&call->params,params);
call->params = linphone_call_params_copy(params);
if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) {
call->ice_session = ice_session_new();
@ -736,19 +730,19 @@ static void linphone_call_incoming_select_ip_version(LinphoneCall *call){
* Fix call parameters on incoming call to eg. enable AVPF if the incoming call propose it and it is not enabled locally.
*/
void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, const SalMediaDescription *md) {
call->params.has_video &= linphone_core_media_description_contains_video_stream(md);
call->params->has_video &= linphone_core_media_description_contains_video_stream(md);
/* Handle AVPF and SRTP. */
call->params.avpf_enabled = sal_media_description_has_avpf(md);
if (call->params.avpf_enabled == TRUE) {
call->params->avpf_enabled = sal_media_description_has_avpf(md);
if (call->params->avpf_enabled == TRUE) {
if (call->dest_proxy != NULL) {
call->params.avpf_rr_interval = linphone_proxy_config_get_avpf_rr_interval(call->dest_proxy) * 1000;
call->params->avpf_rr_interval = linphone_proxy_config_get_avpf_rr_interval(call->dest_proxy) * 1000;
} else {
call->params.avpf_rr_interval = 5000;
call->params->avpf_rr_interval = 5000;
}
}
if ((sal_media_description_has_srtp(md) == TRUE) && (media_stream_srtp_supported() == TRUE)) {
call->params.media_encryption = LinphoneMediaEncryptionSRTP;
call->params->media_encryption = LinphoneMediaEncryptionSRTP;
}
}
@ -786,19 +780,20 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
linphone_address_clean(from);
linphone_call_get_local_ip(call, from);
linphone_call_init_common(call, from, to);
call->params = linphone_call_params_new();
call->log->call_id=ms_strdup(sal_op_get_call_id(op)); /*must be known at that time*/
call->dest_proxy = linphone_core_lookup_known_proxy(call->core, to);
linphone_core_init_default_params(lc, &call->params);
linphone_core_init_default_params(lc, call->params);
/*
* Initialize call parameters according to incoming call parameters. This is to avoid to ask later (during reINVITEs) for features that the remote
* end apparently does not support. This features are: privacy, video
*/
/*set privacy*/
call->current_params.privacy=(LinphonePrivacyMask)sal_op_get_privacy(call->op);
call->current_params->privacy=(LinphonePrivacyMask)sal_op_get_privacy(call->op);
/*set video support */
md=sal_call_get_remote_media_description(op);
call->params.has_video = lc->video_policy.automatically_accept;
call->params->has_video = lc->video_policy.automatically_accept;
if (md) {
// It is licit to receive an INVITE without SDP
// In this case WE chose the media parameters according to policy.
@ -883,10 +878,10 @@ static void linphone_call_set_terminated(LinphoneCall *call){
}
void linphone_call_fix_call_parameters(LinphoneCall *call){
call->params.has_video=call->current_params.has_video;
call->params->has_video=call->current_params->has_video;
if (call->params.media_encryption != LinphoneMediaEncryptionZRTP) /*in case of ZRTP call parameter are handle after zrtp negociation*/
call->params.media_encryption=call->current_params.media_encryption;
if (call->params->media_encryption != LinphoneMediaEncryptionZRTP) /*in case of ZRTP call parameter are handle after zrtp negociation*/
call->params->media_encryption=call->current_params->media_encryption;
}
const char *linphone_call_state_to_string(LinphoneCallState cs){
@ -1044,8 +1039,11 @@ static void linphone_call_destroy(LinphoneCall *obj)
if (obj->auth_token) {
ms_free(obj->auth_token);
}
linphone_call_params_uninit(&obj->params);
linphone_call_params_uninit(&obj->current_params);
linphone_call_params_unref(obj->params);
linphone_call_params_unref(obj->current_params);
if (obj->remote_params != NULL) {
linphone_call_params_unref(obj->remote_params);
}
sal_error_info_reset(&obj->non_op_error);
}
@ -1070,35 +1068,35 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
#ifdef VIDEO_ENABLED
VideoStream *vstream;
#endif
MS_VIDEO_SIZE_ASSIGN(call->current_params.sent_vsize, UNKNOWN);
MS_VIDEO_SIZE_ASSIGN(call->current_params.recv_vsize, UNKNOWN);
MS_VIDEO_SIZE_ASSIGN(call->current_params->sent_vsize, UNKNOWN);
MS_VIDEO_SIZE_ASSIGN(call->current_params->recv_vsize, UNKNOWN);
#ifdef VIDEO_ENABLED
vstream = call->videostream;
if (vstream != NULL) {
call->current_params.sent_vsize = video_stream_get_sent_video_size(vstream);
call->current_params.recv_vsize = video_stream_get_received_video_size(vstream);
call->current_params.sent_fps = video_stream_get_sent_framerate(vstream);
call->current_params.received_fps = video_stream_get_received_framerate(vstream);
call->current_params->sent_vsize = video_stream_get_sent_video_size(vstream);
call->current_params->recv_vsize = video_stream_get_received_video_size(vstream);
call->current_params->sent_fps = video_stream_get_sent_framerate(vstream);
call->current_params->received_fps = video_stream_get_received_framerate(vstream);
}
#endif
if (linphone_call_all_streams_encrypted(call)) {
if (linphone_call_get_authentication_token(call)) {
call->current_params.media_encryption=LinphoneMediaEncryptionZRTP;
call->current_params->media_encryption=LinphoneMediaEncryptionZRTP;
} else {
call->current_params.media_encryption=LinphoneMediaEncryptionSRTP;
call->current_params->media_encryption=LinphoneMediaEncryptionSRTP;
}
} else {
call->current_params.media_encryption=LinphoneMediaEncryptionNone;
call->current_params->media_encryption=LinphoneMediaEncryptionNone;
}
call->current_params.avpf_enabled = linphone_call_all_streams_avpf_enabled(call);
if (call->current_params.avpf_enabled == TRUE) {
call->current_params.avpf_rr_interval = linphone_call_get_avpf_rr_interval(call);
call->current_params->avpf_enabled = linphone_call_all_streams_avpf_enabled(call);
if (call->current_params->avpf_enabled == TRUE) {
call->current_params->avpf_rr_interval = linphone_call_get_avpf_rr_interval(call);
} else {
call->current_params.avpf_rr_interval = 0;
call->current_params->avpf_rr_interval = 0;
}
return &call->current_params;
return call->current_params;
}
/**
@ -1108,9 +1106,10 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
* supports video, encryption or whatever.
**/
const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call){
LinphoneCallParams *cp=&call->remote_params;
memset(cp,0,sizeof(*cp));
if (call->op){
LinphoneCallParams *cp;
if (call->remote_params != NULL) linphone_call_params_unref(call->remote_params);
cp = call->remote_params = linphone_call_params_new();
SalMediaDescription *md=sal_call_get_remote_media_description(call->op);
if (md) {
SalStreamDescription *sd;
@ -1373,194 +1372,6 @@ bool_t linphone_call_camera_enabled (const LinphoneCall *call){
return call->camera_enabled;
}
/**
* Enable video stream.
**/
void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled){
cp->has_video=enabled;
}
/**
* Returns the audio codec used in the call, described as a LinphonePayloadType structure.
**/
const LinphonePayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp) {
return cp->audio_codec;
}
/**
* Returns the video codec used in the call, described as a LinphonePayloadType structure.
**/
const LinphonePayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp) {
return cp->video_codec;
}
MSVideoSize linphone_call_params_get_sent_video_size(const LinphoneCallParams *cp) {
return cp->sent_vsize;
}
MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParams *cp) {
return cp->recv_vsize;
}
/**
* Gets the framerate of the video that is sent.
* @param[in] cp The call parameters.
* @return the actual sent framerate in frames per seconds, 0 if not available.
*/
float linphone_call_params_get_sent_framerate(const LinphoneCallParams *cp){
return cp->sent_fps;
}
/**
* Gets the framerate of the video that is received.
* @param[in] cp The call paramaters for which to get the received framerate.
* @return the actual received framerate in frames per seconds, 0 if not available.
*/
float linphone_call_params_get_received_framerate(const LinphoneCallParams *cp){
return cp->received_fps;
}
const char * linphone_call_params_get_rtp_profile(const LinphoneCallParams *cp) {
return sal_media_proto_to_string(get_proto_from_call_params(cp));
}
/**
* @ingroup call_control
* Use to know if this call has been configured in low bandwidth mode.
* This mode can be automatically discovered thanks to a stun server when activate_edge_workarounds=1 in section [net] of configuration file.
* An application that would have reliable way to know network capacity may not use activate_edge_workarounds=1 but instead manually configure
* low bandwidth mode with linphone_call_params_enable_low_bandwidth().
* <br> When enabled, this param may transform a call request with video in audio only mode.
* @return TRUE if low bandwidth has been configured/detected
*/
bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp) {
return cp->low_bandwidth;
}
/**
* @ingroup call_control
* Indicate low bandwith mode.
* Configuring a call to low bandwidth mode will result in the core to activate several settings for the call in order to ensure that bitrate usage
* is lowered to the minimum possible. Typically, ptime (packetization time) will be increased, audio codec's output bitrate will be targetted to 20kbit/s provided
* that it is achievable by the codec selected after SDP handshake. Video is automatically disabled.
*
**/
void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled){
cp->low_bandwidth=enabled;
}
/**
* Returns whether video is enabled.
**/
bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp){
return cp->has_video;
}
/**
* Returns kind of media encryption selected for the call.
**/
LinphoneMediaEncryption linphone_call_params_get_media_encryption(const LinphoneCallParams *cp) {
return cp->media_encryption;
}
/**
* Set requested media encryption for a call.
**/
void linphone_call_params_set_media_encryption(LinphoneCallParams *cp, LinphoneMediaEncryption e) {
cp->media_encryption = e;
}
/**
* Enable sending of real early media (during outgoing calls).
**/
void linphone_call_params_enable_early_media_sending(LinphoneCallParams *cp, bool_t enabled){
cp->real_early_media=enabled;
}
/**
* Indicates whether sending of early media was enabled.
**/
bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *cp){
return cp->real_early_media;
}
/**
* Returns true if the call is part of the locally managed conference.
**/
bool_t linphone_call_params_get_local_conference_mode(const LinphoneCallParams *cp){
return cp->in_conference;
}
/**
* Refine bandwidth settings for this call by setting a bandwidth limit for audio streams.
* As a consequence, codecs whose bitrates are not compatible with this limit won't be used.
**/
void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bandwidth){
cp->audio_bw=bandwidth;
}
void linphone_call_params_add_custom_header(LinphoneCallParams *params, const char *header_name, const char *header_value){
params->custom_headers=sal_custom_header_append(params->custom_headers,header_name,header_value);
}
const char *linphone_call_params_get_custom_header(const LinphoneCallParams *params, const char *header_name){
return sal_custom_header_find(params->custom_headers,header_name);
}
/**
* Returns the session name of the media session (ie in SDP). Subject from the SIP message can be retrieved using linphone_call_params_get_custom_header() and is different.
* @param cp the call parameters.
**/
const char *linphone_call_params_get_session_name(const LinphoneCallParams *cp){
return cp->session_name;
}
/**
* Set the session name of the media session (ie in SDP). Subject from the SIP message (which is different) can be set using linphone_call_params_set_custom_header().
* @param cp the call parameters.
* @param name the session name
**/
void linphone_call_params_set_session_name(LinphoneCallParams *cp, const char *name){
if (cp->session_name){
ms_free(cp->session_name);
cp->session_name=NULL;
}
if (name) cp->session_name=ms_strdup(name);
}
void _linphone_call_params_copy(LinphoneCallParams *ncp, const LinphoneCallParams *cp){
if (ncp==cp) return;
memcpy(ncp,cp,sizeof(LinphoneCallParams));
if (cp->record_file) ncp->record_file=ms_strdup(cp->record_file);
if (cp->session_name) ncp->session_name=ms_strdup(cp->session_name);
/*
* The management of the custom headers is not optimal. We copy everything while ref counting would be more efficient.
*/
if (cp->custom_headers) ncp->custom_headers=sal_custom_header_clone(cp->custom_headers);
}
/**
* @ingroup call_control
* Set requested level of privacy for the call.
* \xmlonly <language-tags>javascript</language-tags> \endxmlonly
* @param params the call parameters to be modified
* @param privacy LinphonePrivacy to configure privacy
* */
void linphone_call_params_set_privacy(LinphoneCallParams *params, LinphonePrivacyMask privacy) {
params->privacy=privacy;
}
/**
* @ingroup call_control
* Get requested level of privacy for the call.
* @param params the call parameters
* @return Privacy mode
* */
LinphonePrivacyMask linphone_call_params_get_privacy(const LinphoneCallParams *params) {
return params->privacy;
}
/**
* @ingroup call_control
@ -1578,27 +1389,6 @@ const char* linphone_privacy_to_string(LinphonePrivacy privacy) {
default: return "Unknown privacy mode";
}
}
/**
* Copy existing LinphoneCallParams to a new LinphoneCallParams object.
**/
LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp){
LinphoneCallParams *ncp=ms_new0(LinphoneCallParams,1);
_linphone_call_params_copy(ncp,cp);
return ncp;
}
void linphone_call_params_uninit(LinphoneCallParams *p){
if (p->record_file) ms_free(p->record_file);
if (p->custom_headers) sal_custom_header_free(p->custom_headers);
}
/**
* Destroy LinphoneCallParams.
**/
void linphone_call_params_destroy(LinphoneCallParams *p){
linphone_call_params_uninit(p);
ms_free(p);
}
/**
@ -1687,8 +1477,8 @@ int linphone_call_prepare_ice(LinphoneCall *call, bool_t incoming_offer){
if ((linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) && (call->ice_session != NULL)){
if (incoming_offer){
remote=sal_call_get_remote_media_description(call->op);
has_video=call->params.has_video && linphone_core_media_description_contains_video_stream(remote);
}else has_video=call->params.has_video;
has_video=call->params->has_video && linphone_core_media_description_contains_video_stream(remote);
}else has_video=call->params->has_video;
_linphone_call_prepare_ice_for_stream(call,0,TRUE);
if (has_video) _linphone_call_prepare_ice_for_stream(call,1,TRUE);
@ -1936,7 +1726,7 @@ static int get_ideal_audio_bw(LinphoneCall *call, const SalMediaDescription *md,
int remote_bw=0;
int upload_bw;
int total_upload_bw=linphone_core_get_upload_bandwidth(call->core);
const LinphoneCallParams *params=&call->params;
const LinphoneCallParams *params=call->params;
bool_t will_use_video=linphone_core_media_description_contains_video_stream(md);
bool_t forced=FALSE;
@ -1983,7 +1773,7 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m
bool_t first=TRUE;
LinphoneCore *lc=call->core;
int up_ptime=0;
const LinphoneCallParams *params=&call->params;
const LinphoneCallParams *params=call->params;
*used_pt=-1;
@ -2115,7 +1905,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna
call->audio_profile=make_profile(call,call->resultdesc,stream,&used_pt);
if (used_pt!=-1){
call->current_params.audio_codec = rtp_profile_get_payload(call->audio_profile, used_pt);
call->current_params->audio_codec = rtp_profile_get_payload(call->audio_profile, used_pt);
if (playcard==NULL) {
ms_warning("No card defined for playback !");
}
@ -2143,7 +1933,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna
captcard=NULL;
playcard=NULL;
}
if (call->params.in_conference){
if (call->params->in_conference){
/* first create the graph without soundcard resources*/
captcard=playcard=NULL;
}
@ -2156,9 +1946,9 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna
if (captcard && stream->max_rate>0) ms_snd_card_set_preferred_sample_rate(captcard, stream->max_rate);
audio_stream_enable_adaptive_bitrate_control(call->audiostream,use_arc);
audio_stream_enable_adaptive_jittcomp(call->audiostream, linphone_core_audio_adaptive_jittcomp_enabled(lc));
if (!call->params.in_conference && call->params.record_file){
audio_stream_mixed_record_open(call->audiostream,call->params.record_file);
call->current_params.record_file=ms_strdup(call->params.record_file);
if (!call->params->in_conference && call->params->record_file){
audio_stream_mixed_record_open(call->audiostream,call->params->record_file);
call->current_params->record_file=ms_strdup(call->params->record_file);
}
/* valid local tags are > 0 */
if (sal_stream_description_has_srtp(stream) == TRUE) {
@ -2201,13 +1991,13 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna
setup_ring_player(lc,call);
}
if (call->params.in_conference){
if (call->params->in_conference){
/*transform the graph to connect it to the conference filter */
mute=stream->dir==SalStreamRecvOnly;
linphone_call_add_to_conf(call, mute);
}
call->current_params.in_conference=call->params.in_conference;
call->current_params.low_bandwidth=call->params.low_bandwidth;
call->current_params->in_conference=call->params->in_conference;
call->current_params->low_bandwidth=call->params->low_bandwidth;
}else ms_warning("No audio stream accepted ?");
}
}
@ -2240,8 +2030,8 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna
MSWebCam *cam=lc->video_conf.device;
bool_t is_inactive=FALSE;
call->current_params.video_codec = rtp_profile_get_payload(call->video_profile, used_pt);
call->current_params.has_video=TRUE;
call->current_params->video_codec = rtp_profile_get_payload(call->video_profile, used_pt);
call->current_params->has_video=TRUE;
video_stream_enable_adaptive_bitrate_control(call->videostream,
linphone_core_adaptive_rate_control_enabled(lc));
@ -2318,8 +2108,8 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
const SalStreamDescription *vstream=sal_media_description_find_best_stream(call->resultdesc,SalVideo);
#endif
call->current_params.audio_codec = NULL;
call->current_params.video_codec = NULL;
call->current_params->audio_codec = NULL;
call->current_params->video_codec = NULL;
if ((call->audiostream == NULL) && (call->videostream == NULL)) {
ms_fatal("start_media_stream() called without prior init !");
@ -2339,7 +2129,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
if (call->audiostream!=NULL) {
linphone_call_start_audio_stream(call,cname,all_inputs_muted,send_ringbacktone,use_arc);
}
call->current_params.has_video=FALSE;
call->current_params->has_video=FALSE;
if (call->videostream!=NULL) {
if (call->audiostream) audio_stream_link_video(call->audiostream,call->videostream);
linphone_call_start_video_stream(call,cname,all_inputs_muted);
@ -2349,7 +2139,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
call->playing_ringbacktone=send_ringbacktone;
call->up_bw=linphone_core_get_upload_bandwidth(lc);
if (call->params.media_encryption==LinphoneMediaEncryptionZRTP) {
if (call->params->media_encryption==LinphoneMediaEncryptionZRTP) {
OrtpZrtpParams params;
memset(&params,0,sizeof(OrtpZrtpParams));
/*call->current_params.media_encryption will be set later when zrtp is activated*/
@ -2363,7 +2153,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
}
#endif
}else{
call->current_params.media_encryption=linphone_call_all_streams_encrypted(call) ?
call->current_params->media_encryption=linphone_call_all_streams_encrypted(call) ?
LinphoneMediaEncryptionSRTP : LinphoneMediaEncryptionNone;
}
@ -2486,7 +2276,7 @@ static void linphone_call_stop_audio_stream(LinphoneCall *call) {
}
audio_stream_stop(call->audiostream);
call->audiostream=NULL;
call->current_params.audio_codec = NULL;
call->current_params->audio_codec = NULL;
}
}
@ -2502,7 +2292,7 @@ static void linphone_call_stop_video_stream(LinphoneCall *call) {
linphone_call_log_fill_stats(call->log,(MediaStream*)call->videostream);
video_stream_stop(call->videostream);
call->videostream=NULL;
call->current_params.video_codec = NULL;
call->current_params->video_codec = NULL;
}
#endif
}
@ -2848,41 +2638,16 @@ LinphoneUpnpState linphone_call_stats_get_upnp_state(const LinphoneCallStats *st
return stats->upnp_state;
}
/**
* Enable recording of the call (voice-only).
* This function must be used before the call parameters are assigned to the call.
* The call recording can be started and paused after the call is established with
* linphone_call_start_recording() and linphone_call_pause_recording().
* @param cp the call parameters
* @param path path and filename of the file where audio/video streams are written.
* The filename must have either .mkv or .wav extention. The video stream will be written
* only if a MKV file is given.
**/
void linphone_call_params_set_record_file(LinphoneCallParams *cp, const char *path){
if (cp->record_file){
ms_free(cp->record_file);
cp->record_file=NULL;
}
if (path) cp->record_file=ms_strdup(path);
}
/**
* Retrieves the path for the audio recoding of the call.
**/
const char *linphone_call_params_get_record_file(const LinphoneCallParams *cp){
return cp->record_file;
}
/**
* Start call recording.
* The output file where audio is recorded must be previously specified with linphone_call_params_set_record_file().
**/
void linphone_call_start_recording(LinphoneCall *call){
if (!call->params.record_file){
if (!call->params->record_file){
ms_error("linphone_call_start_recording(): no output file specified. Use linphone_call_params_set_record_file().");
return;
}
if (call->audiostream && !call->params.in_conference){
if (call->audiostream && !call->params->in_conference){
audio_stream_mixed_record_start(call->audiostream);
}
call->record_active=TRUE;
@ -2892,7 +2657,7 @@ void linphone_call_start_recording(LinphoneCall *call){
* Stop call recording.
**/
void linphone_call_stop_recording(LinphoneCall *call){
if (call->audiostream && !call->params.in_conference){
if (call->audiostream && !call->params->in_conference){
audio_stream_mixed_record_stop(call->audiostream);
}
call->record_active=FALSE;
@ -2937,17 +2702,16 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
int ping_time;
if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) {
LinphoneCallParams params;
_linphone_call_params_copy(&params,&call->current_params);
if (call->params.media_encryption == LinphoneMediaEncryptionZRTP) {
LinphoneCallParams *params = linphone_call_params_copy(call->current_params);
if (call->params->media_encryption == LinphoneMediaEncryptionZRTP) {
/* preserve media encryption param because at that time ZRTP negociation may still be ongoing*/
params.media_encryption=call->params.media_encryption;
params->media_encryption=call->params->media_encryption;
}
switch (ice_session_state(call->ice_session)) {
case IS_Completed:
ice_session_select_candidates(call->ice_session);
if (ice_session_role(call->ice_session) == IR_Controlling) {
linphone_core_update_call(call->core, call, &params);
linphone_core_update_call(call->core, call, params);
}
break;
case IS_Failed:
@ -2955,7 +2719,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
ice_session_select_candidates(call->ice_session);
if (ice_session_role(call->ice_session) == IR_Controlling) {
/* At least one ICE session has succeeded, so perform a call update. */
linphone_core_update_call(call->core, call, &params);
linphone_core_update_call(call->core, call, params);
}
}
break;
@ -2963,6 +2727,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
break;
}
linphone_core_update_ice_state_in_call_stats(call);
linphone_call_params_unref(params);
} else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) {
if (evd->info.ice_processing_successful==TRUE) {
@ -3003,7 +2768,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
} else if (evt == ORTP_EVENT_ICE_RESTART_NEEDED) {
ice_session_restart(call->ice_session);
ice_session_set_role(call->ice_session, IR_Controlling);
linphone_core_update_call(call->core, call, &call->current_params);
linphone_core_update_call(call->core, call, call->current_params);
}
}
@ -3186,7 +2951,7 @@ void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState stat
}
bool_t linphone_call_is_in_conference(const LinphoneCall *call) {
return call->params.in_conference;
return call->params->in_conference;
}
/**

View file

@ -2238,7 +2238,7 @@ LinphoneCall * linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *
}
if (!params){
cp->has_video = call->current_params.has_video; /*start the call to refer-target with video enabled if original call had video*/
cp->has_video = call->current_params->has_video; /*start the call to refer-target with video enabled if original call had video*/
}
cp->referer=call;
ms_message("Starting new call to refered address %s",call->refer_to);
@ -2820,7 +2820,7 @@ int linphone_core_accept_early_media_with_params(LinphoneCore* lc, LinphoneCall*
// if parameters are passed, update the media description
if ( params ) {
_linphone_call_params_copy ( &call->params,params );
call->params = linphone_call_params_copy(params);
linphone_call_make_local_media_description ( lc,call );
sal_call_set_local_media_description ( call->op,call->localdesc );
sal_op_set_sent_custom_header ( call->op,params->custom_headers );
@ -2861,7 +2861,7 @@ int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call){
linphone_core_update_local_media_description_from_upnp(call->localdesc, call->upnp_session);
}
#endif //BUILD_UPNP
if (call->params.in_conference){
if (call->params->in_conference){
subject="Conference";
}else{
subject="Media change";
@ -2924,7 +2924,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho
}
#endif /* defined(VIDEO_ENABLED) && defined(BUILD_UPNP) */
_linphone_call_params_copy(&call->params,params);
call->params = linphone_call_params_copy(params);
err=linphone_call_prepare_ice(call,FALSE);
if (err==1) {
ms_message("Defer call update to gather ICE candidates");
@ -3053,19 +3053,19 @@ int _linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, cons
return 0;
}
if (params==NULL){
call->params.has_video=lc->video_policy.automatically_accept || call->current_params.has_video;
call->params->has_video=lc->video_policy.automatically_accept || call->current_params->has_video;
}else
_linphone_call_params_copy(&call->params,params);
call->params = linphone_call_params_copy(params);
if (call->params.has_video && !linphone_core_video_enabled(lc)){
if (call->params->has_video && !linphone_core_video_enabled(lc)){
ms_warning("linphone_core_accept_call_update(): requested video but video support is globally disabled. Refusing video.");
call->params.has_video=FALSE;
call->params->has_video=FALSE;
}
if (call->current_params.in_conference) {
if (call->current_params->in_conference) {
ms_warning("Video isn't supported in conference");
call->params.has_video = FALSE;
call->params->has_video = FALSE;
}
call->params.has_video &= linphone_core_media_description_contains_video_stream(remote_desc);
call->params->has_video &= linphone_core_media_description_contains_video_stream(remote_desc);
linphone_call_init_media_streams(call); /*so that video stream is initialized if necessary*/
if (call->ice_session != NULL) {
if (linphone_call_prepare_ice(call,TRUE)==1)
@ -3170,7 +3170,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
linphone_call_set_contact_op(call);
if (params){
const SalMediaDescription *md = sal_call_get_remote_media_description(call->op);
_linphone_call_params_copy(&call->params,params);
call->params = linphone_call_params_copy(params);
// There might not be a md if the INVITE was lacking an SDP
// In this case we use the parameters as is.
if (md) {
@ -3475,7 +3475,7 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call){
ms_warning("we cannot resume a call that has not been established and paused before");
return -1;
}
if (call->params.in_conference==FALSE){
if (call->params->in_conference==FALSE){
if (linphone_core_sound_resources_locked(lc)){
ms_warning("Cannot resume call %p because another call is locking the sound resources.",call);
return -1;
@ -3498,12 +3498,12 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call){
#endif //BUILD_UPNP
sal_call_set_local_media_description(call->op,call->localdesc);
sal_media_description_set_dir(call->localdesc,SalStreamSendRecv);
if (call->params.in_conference && !call->current_params.in_conference) subject="Conference";
if (call->params->in_conference && !call->current_params->in_conference) subject="Conference";
if(sal_call_update(call->op,subject) != 0){
return -1;
}
linphone_call_set_state(call,LinphoneCallResuming,"Resuming");
if (call->params.in_conference==FALSE)
if (call->params->in_conference==FALSE)
lc->current_call=call;
snprintf(temp,sizeof(temp)-1,"Resuming the call with %s",linphone_call_get_remote_address_as_string(call));
if (lc->vtable.display_status)
@ -5976,7 +5976,7 @@ LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc){
}
LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc){
LinphoneCallParams *p=ms_new0(LinphoneCallParams,1);
LinphoneCallParams *p=linphone_call_params_new();
linphone_core_init_default_params(lc, p);
return p;
}
@ -5991,7 +5991,7 @@ LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *l
*/
LinphoneCallParams *linphone_core_create_call_params(LinphoneCore *lc, LinphoneCall *call){
if (!call) return linphone_core_create_default_call_parameters(lc);
return linphone_call_params_copy(&call->params);
return linphone_call_params_copy(call->params);
}
const char *linphone_reason_to_string(LinphoneReason err){

View file

@ -285,18 +285,41 @@ LINPHONE_PUBLIC char * linphone_payload_type_get_mime_type(const LinphonePayload
*/
LINPHONE_PUBLIC int linphone_payload_type_get_channels(const LinphonePayloadType *pt);
/**
* Enum describing type of media encryption types.
**/
enum _LinphoneMediaEncryption {
LinphoneMediaEncryptionNone, /**< No media encryption is used */
LinphoneMediaEncryptionSRTP, /**< Use SRTP media encryption */
LinphoneMediaEncryptionZRTP /**< Use ZRTP media encryption */
};
/**
* Enum describing type of media encryption types.
**/
typedef enum _LinphoneMediaEncryption LinphoneMediaEncryption;
/**
* Convert enum member to string.
**/
LINPHONE_PUBLIC const char *linphone_media_encryption_to_string(LinphoneMediaEncryption menc);
/**
* @}
**/
#ifdef IN_LINPHONE
#include "linphonefriend.h"
#include "event.h"
#include "call_log.h"
#include "call_params.h"
#else
#include "linphone/linphonefriend.h"
#include "linphone/event.h"
#include "linphone/call_log.h"
#include "linphone/call_params.h"
#endif
LINPHONE_PUBLIC LinphoneAddress * linphone_address_new(const char *addr);
@ -334,118 +357,6 @@ LINPHONE_PUBLIC LinphoneAddress * linphone_core_create_address(LinphoneCore *lc,
struct _SipSetupContext;
/**
* Enum describing type of media encryption types.
* @ingroup media_parameters
**/
enum _LinphoneMediaEncryption {
LinphoneMediaEncryptionNone, /**< No media encryption is used */
LinphoneMediaEncryptionSRTP, /**< Use SRTP media encryption */
LinphoneMediaEncryptionZRTP /**< Use ZRTP media encryption */
};
/**
* Enum describing type of media encryption types.
* @ingroup media_parameters
**/
typedef enum _LinphoneMediaEncryption LinphoneMediaEncryption;
/**
* Convert enum member to string.
* @ingroup media_parameters
**/
LINPHONE_PUBLIC const char *linphone_media_encryption_to_string(LinphoneMediaEncryption menc);
/**
* Private structure definition for LinphoneCallParams.
* @ingroup call_control
**/
struct _LinphoneCallParams;
/**
* The LinphoneCallParams is an object containing various call related parameters.
* It can be used to retrieve parameters from a currently running call or modify the call's characteristics
* dynamically.
* @ingroup call_control
**/
typedef struct _LinphoneCallParams LinphoneCallParams;
LINPHONE_PUBLIC const LinphonePayloadType* linphone_call_params_get_used_audio_codec(const LinphoneCallParams *cp);
LINPHONE_PUBLIC const LinphonePayloadType* linphone_call_params_get_used_video_codec(const LinphoneCallParams *cp);
LINPHONE_PUBLIC LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp);
LINPHONE_PUBLIC void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled);
LINPHONE_PUBLIC bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp);
LINPHONE_PUBLIC LinphoneMediaEncryption linphone_call_params_get_media_encryption(const LinphoneCallParams *cp);
LINPHONE_PUBLIC void linphone_call_params_set_media_encryption(LinphoneCallParams *cp, LinphoneMediaEncryption e);
LINPHONE_PUBLIC void linphone_call_params_enable_early_media_sending(LinphoneCallParams *cp, bool_t enabled);
LINPHONE_PUBLIC bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *cp);
#define linphone_call_params_local_conference_mode linphone_call_params_get_local_conference_mode /* Deprecated */
LINPHONE_PUBLIC bool_t linphone_call_params_get_local_conference_mode(const LinphoneCallParams *cp);
LINPHONE_PUBLIC void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bw);
LINPHONE_PUBLIC void linphone_call_params_destroy(LinphoneCallParams *cp);
LINPHONE_PUBLIC bool_t linphone_call_params_low_bandwidth_enabled(const LinphoneCallParams *cp);
LINPHONE_PUBLIC void linphone_call_params_enable_low_bandwidth(LinphoneCallParams *cp, bool_t enabled);
LINPHONE_PUBLIC void linphone_call_params_set_record_file(LinphoneCallParams *cp, const char *path);
LINPHONE_PUBLIC const char *linphone_call_params_get_record_file(const LinphoneCallParams *cp);
LINPHONE_PUBLIC const char *linphone_call_params_get_session_name(const LinphoneCallParams *cp);
LINPHONE_PUBLIC void linphone_call_params_set_session_name(LinphoneCallParams *cp, const char *subject);
/**
* Add a custom SIP header in the INVITE for a call.
* @param[in] params The #LinphoneCallParams to add a custom SIP header to.
* @param[in] header_name The name of the header to add.
* @param[in] header_value The content of the header to add.
* @ingroup call_control
**/
LINPHONE_PUBLIC void linphone_call_params_add_custom_header(LinphoneCallParams *params, const char *header_name, const char *header_value);
/**
* Get a custom SIP header.
* @param[in] params The #LinphoneCallParams to get the custom SIP header from.
* @param[in] header_name The name of the header to get.
* @returns The content of the header or NULL if not found.
* @ingroup call_control
**/
LINPHONE_PUBLIC const char *linphone_call_params_get_custom_header(const LinphoneCallParams *params, const char *header_name);
/**
* Gets the size of the video that is sent.
* @param[in] cp The call parameters for which to get the sent video size.
* @return The sent video size or MS_VIDEO_SIZE_UNKNOWN if not available.
*/
LINPHONE_PUBLIC MSVideoSize linphone_call_params_get_sent_video_size(const LinphoneCallParams *cp);
/**
* Gets the size of the video that is received.
* @param[in] cp The call paramaters for which to get the received video size.
* @return The received video size or MS_VIDEO_SIZE_UNKNOWN if not available.
*/
LINPHONE_PUBLIC MSVideoSize linphone_call_params_get_received_video_size(const LinphoneCallParams *cp);
/**
* Gets the framerate of the video that is sent.
* @param[in] cp The call parameters.
* @return the actual sent framerate in frames per seconds, 0 if not available.
*/
LINPHONE_PUBLIC float linphone_call_params_get_sent_framerate(const LinphoneCallParams *cp);
/**
* Gets the framerate of the video that is received.
* @param[in] cp The call paramaters for which to get the received framerate.
* @return the actual received framerate in frames per seconds, 0 if not available.
*/
LINPHONE_PUBLIC float linphone_call_params_get_received_framerate(const LinphoneCallParams *cp);
/**
* Gets the RTP profile being used.
* @param[in] cp #LinphoneCallParams object
* @returns The RTP profile.
*/
LINPHONE_PUBLIC const char * linphone_call_params_get_rtp_profile(const LinphoneCallParams *cp);
/*
* Note for developers: this enum must be kept synchronized with the SalPrivacy enum declared in sal.h
*/

View file

@ -658,7 +658,7 @@ void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call)
} else {
call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateFailed;
}
if (call->params.has_video && (video_check_list != NULL)) {
if (call->params->has_video && (video_check_list != NULL)) {
if (ice_check_list_state(video_check_list) == ICL_Completed) {
switch (ice_check_list_selected_valid_candidate_type(video_check_list)) {
case ICT_HostCandidate:
@ -678,12 +678,12 @@ void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call)
}
} else if (session_state == IS_Running) {
call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress;
if (call->params.has_video && (video_check_list != NULL)) {
if (call->params->has_video && (video_check_list != NULL)) {
call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateInProgress;
}
} else {
call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateFailed;
if (call->params.has_video && (video_check_list != NULL)) {
if (call->params->has_video && (video_check_list != NULL)) {
call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateFailed;
}
}

View file

@ -80,6 +80,8 @@ extern "C" {
#endif
struct _LinphoneCallParams{
belle_sip_object_t base;
void *user_data;
LinphoneCall *referer; /*in case this call creation is consecutive to an incoming transfer, this points to the original call */
int audio_bw; /* bandwidth limit for audio stream */
LinphoneMediaEncryption media_encryption;
@ -104,6 +106,9 @@ struct _LinphoneCallParams{
uint16_t avpf_rr_interval;
};
BELLE_SIP_DECLARE_VPTR(LinphoneCallParams);
struct _LinphoneQualityReporting{
reporting_session_report_t * reports[2]; /**Store information on audio and video media streams (RFC 6035) */
bool_t was_video_running; /*Keep video state since last check in order to detect its (de)activation*/
@ -210,9 +215,9 @@ struct _LinphoneCall
MSAudioEndpoint *endpoint; /*used for conferencing*/
char *refer_to;
LinphoneCallParams params;
LinphoneCallParams current_params;
LinphoneCallParams remote_params;
LinphoneCallParams *params;
LinphoneCallParams *current_params;
LinphoneCallParams *remote_params;
int up_bw; /*upload bandwidth setting at the time the call is started. Used to detect if it changes during a call */
int audio_bw; /*upload bandwidth used by audio */
OrtpEvQueue *audiostream_app_evq;
@ -265,6 +270,9 @@ void linphone_call_log_destroy(LinphoneCallLog *cl);
void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState state);
LinphonePlayer *linphone_call_build_player(LinphoneCall*call);
LinphoneCallParams * linphone_call_params_new(void);
SalMediaProto get_proto_from_call_params(const LinphoneCallParams *params);
void linphone_auth_info_write_config(struct _LpConfig *config, LinphoneAuthInfo *obj, int pos);
void linphone_core_update_proxy_register(LinphoneCore *lc);
@ -833,8 +841,6 @@ void call_logs_write_to_config_file(LinphoneCore *lc);
int linphone_core_get_edge_bw(LinphoneCore *lc);
int linphone_core_get_edge_ptime(LinphoneCore *lc);
void _linphone_call_params_copy(LinphoneCallParams *params, const LinphoneCallParams *refparams);
void linphone_call_params_uninit(LinphoneCallParams *params);
int linphone_upnp_init(LinphoneCore *lc);
void linphone_upnp_destroy(LinphoneCore *lc);
@ -947,6 +953,7 @@ BELLE_SIP_TYPE_ID(LinphoneContactProvider),
BELLE_SIP_TYPE_ID(LinphoneContactSearch),
BELLE_SIP_TYPE_ID(LinphoneCall),
BELLE_SIP_TYPE_ID(LinphoneCallLog),
BELLE_SIP_TYPE_ID(LinphoneCallParams),
BELLE_SIP_TYPE_ID(LinphoneChatMessage),
BELLE_SIP_TYPE_ID(LinphoneChatRoom),
BELLE_SIP_TYPE_ID(LinphoneLDAPContactProvider),