Commit eaa1d6bb authored by Ghislain MARY's avatar Ghislain MARY

Add reference count handling to the LinphoneCallParams object.

parent 1ce425fc
...@@ -67,6 +67,7 @@ LOCAL_SRC_FILES := \ ...@@ -67,6 +67,7 @@ LOCAL_SRC_FILES := \
remote_provisioning.c \ remote_provisioning.c \
quality_reporting.c \ quality_reporting.c \
call_log.c \ call_log.c \
call_params.c \
player.c player.c
ifndef LINPHONE_VERSION ifndef LINPHONE_VERSION
......
...@@ -108,6 +108,7 @@ ...@@ -108,6 +108,7 @@
<ClCompile Include="..\..\coreapi\bellesip_sal\sal_op_registration.c" /> <ClCompile Include="..\..\coreapi\bellesip_sal\sal_op_registration.c" />
<ClCompile Include="..\..\coreapi\bellesip_sal\sal_sdp.c" /> <ClCompile Include="..\..\coreapi\bellesip_sal\sal_sdp.c" />
<ClCompile Include="..\..\coreapi\call_log.c" /> <ClCompile Include="..\..\coreapi\call_log.c" />
<ClCompile Include="..\..\coreapi\call_params.c" />
<ClCompile Include="..\..\coreapi\callbacks.c" /> <ClCompile Include="..\..\coreapi\callbacks.c" />
<ClCompile Include="..\..\coreapi\chat.c" /> <ClCompile Include="..\..\coreapi\chat.c" />
<ClCompile Include="..\..\coreapi\conference.c" /> <ClCompile Include="..\..\coreapi\conference.c" />
......
...@@ -43,6 +43,7 @@ set(SOURCE_FILES ...@@ -43,6 +43,7 @@ set(SOURCE_FILES
bellesip_sal/sal_sdp.c bellesip_sal/sal_sdp.c
callbacks.c callbacks.c
call_log.c call_log.c
call_params.c
chat.c chat.c
conference.c conference.c
ec-calibrator.c ec-calibrator.c
...@@ -143,6 +144,7 @@ install(TARGETS linphone ...@@ -143,6 +144,7 @@ install(TARGETS linphone
set(HEADER_FILES set(HEADER_FILES
call_log.h call_log.h
call_params.h
event.h event.h
linphonecore.h linphonecore.h
linphonecore_utils.h linphonecore_utils.h
......
...@@ -24,7 +24,7 @@ CLEANFILES=$(GITVERSION_FILE) ...@@ -24,7 +24,7 @@ CLEANFILES=$(GITVERSION_FILE)
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
linphone_includedir=$(includedir)/linphone 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 lib_LTLIBRARIES=liblinphone.la
...@@ -60,6 +60,7 @@ liblinphone_la_SOURCES=\ ...@@ -60,6 +60,7 @@ liblinphone_la_SOURCES=\
remote_provisioning.c \ remote_provisioning.c \
quality_reporting.c quality_reporting.h\ quality_reporting.c quality_reporting.h\
call_log.c \ call_log.c \
call_params.c \
player.c \ player.c \
$(GITVERSION_FILE) $(GITVERSION_FILE)
......
/*
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
);
This diff is collapsed.
...@@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void register_failure(SalOp *op); static void register_failure(SalOp *op);
static int media_parameters_changed(LinphoneCall *call, SalMediaDescription *oldmd, SalMediaDescription *newmd) { 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->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); if (call->localdesc_changed) ms_message("Local description has changed: %i", call->localdesc_changed);
return call->localdesc_changed | sal_media_description_equals(oldmd, newmd); return call->localdesc_changed | sal_media_description_equals(oldmd, newmd);
...@@ -171,10 +171,10 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia ...@@ -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){ if (call->state==LinphoneCallIncomingEarlyMedia && linphone_core_get_remote_ringback_tone (lc)!=NULL){
send_ringbacktone=TRUE; 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; 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); prepare_early_media_forking(call);
} }
linphone_call_start_media_streams(call,all_muted,send_ringbacktone); linphone_call_start_media_streams(call,all_muted,send_ringbacktone);
...@@ -349,7 +349,7 @@ static void call_ringing(SalOp *h){ ...@@ -349,7 +349,7 @@ static void call_ringing(SalOp *h){
if (call==NULL) return; if (call==NULL) return;
/*set privacy*/ /*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) if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Remote ringing.")); lc->vtable.display_status(lc,_("Remote ringing."));
...@@ -402,7 +402,7 @@ static void call_accepted(SalOp *op){ ...@@ -402,7 +402,7 @@ static void call_accepted(SalOp *op){
return ; return ;
} }
/*set privacy*/ /*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. */ /* Handle remote ICE attributes if any. */
if (call->ice_session != NULL) { if (call->ice_session != NULL) {
...@@ -416,7 +416,7 @@ static void call_accepted(SalOp *op){ ...@@ -416,7 +416,7 @@ static void call_accepted(SalOp *op){
md=sal_call_get_final_media_description(op); md=sal_call_get_final_media_description(op);
if (md) /*make sure re-invite will not propose video again*/ 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 || if (call->state==LinphoneCallOutgoingProgress ||
call->state==LinphoneCallOutgoingRinging || call->state==LinphoneCallOutgoingRinging ||
...@@ -470,7 +470,7 @@ static void call_accepted(SalOp *op){ ...@@ -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 /*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*/ * further in the call, for example during pause,resume, conferencing reINVITEs*/
linphone_call_fix_call_parameters(call); linphone_call_fix_call_parameters(call);
if (!call->current_params.in_conference) if (!call->current_params->in_conference)
lc->current_call=call; lc->current_call=call;
if (call->prevstate != LinphoneCallIncomingEarlyMedia) /*don't change state in aswer to a SIP UPDATE in early media*/ 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"); linphone_call_set_state(call, LinphoneCallStreamsRunning, "Streams running");
...@@ -743,22 +743,22 @@ static void call_failure(SalOp *op){ ...@@ -743,22 +743,22 @@ static void call_failure(SalOp *op){
int i; int i;
for (i = 0; i < call->localdesc->nb_streams; i++) { for (i = 0; i < call->localdesc->nb_streams; i++) {
if (!sal_stream_description_active(&call->localdesc->streams[i])) continue; if (!sal_stream_description_active(&call->localdesc->streams[i])) continue;
if (call->params.media_encryption == LinphoneMediaEncryptionSRTP) { if (call->params->media_encryption == LinphoneMediaEncryptionSRTP) {
if (call->params.avpf_enabled == TRUE) { if (call->params->avpf_enabled == TRUE) {
if (i == 0) ms_message("Retrying call [%p] with SAVP", call); 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); linphone_core_restart_invite(lc, call);
return; return;
} else if (!linphone_core_is_media_encryption_mandatory(lc)) { } else if (!linphone_core_is_media_encryption_mandatory(lc)) {
if (i == 0) ms_message("Retrying call [%p] with AVP", call); 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)); memset(call->localdesc->streams[i].crypto, 0, sizeof(call->localdesc->streams[i].crypto));
linphone_core_restart_invite(lc, call); linphone_core_restart_invite(lc, call);
return; 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); 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); linphone_core_restart_invite(lc, call);
return; return;
} }
......
...@@ -99,7 +99,7 @@ void linphone_call_add_to_conf(LinphoneCall *call, bool_t muted){ ...@@ -99,7 +99,7 @@ void linphone_call_add_to_conf(LinphoneCall *call, bool_t muted){
LinphoneCore *lc=call->core; LinphoneCore *lc=call->core;
LinphoneConference *conf=&lc->conf_ctx; LinphoneConference *conf=&lc->conf_ctx;
MSAudioEndpoint *ep; MSAudioEndpoint *ep;
call->params.has_video = FALSE; call->params->has_video = FALSE;
call->camera_enabled = FALSE; call->camera_enabled = FALSE;
ep=ms_audio_endpoint_get_from_stream(call->audiostream,TRUE); ep=ms_audio_endpoint_get_from_stream(call->audiostream,TRUE);
ms_audio_conference_add_member(conf->conf,ep); ms_audio_conference_add_member(conf->conf,ep);
...@@ -185,15 +185,15 @@ float linphone_core_get_conference_local_input_volume(LinphoneCore *lc){ ...@@ -185,15 +185,15 @@ float linphone_core_get_conference_local_input_volume(LinphoneCore *lc){
int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){ int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){
LinphoneConference *conf=&lc->conf_ctx; LinphoneConference *conf=&lc->conf_ctx;
if (call->current_params.in_conference){ if (call->current_params->in_conference){
ms_error("Already in conference"); ms_error("Already in conference");
return -1; return -1;
} }
conference_check_init(&lc->conf_ctx, lp_config_get_int(lc->config, "sound","conference_rate",16000)); conference_check_init(&lc->conf_ctx, lp_config_get_int(lc->config, "sound","conference_rate",16000));
if (call->state==LinphoneCallPaused){ if (call->state==LinphoneCallPaused){
call->params.in_conference=TRUE; call->params->in_conference=TRUE;
call->params.has_video=FALSE; call->params->has_video=FALSE;
linphone_core_resume_call(lc,call); linphone_core_resume_call(lc,call);
}else if (call->state==LinphoneCallStreamsRunning){ }else if (call->state==LinphoneCallStreamsRunning){
LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call)); 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 ...@@ -223,8 +223,8 @@ static int remove_from_conference(LinphoneCore *lc, LinphoneCall *call, bool_t a
int err=0; int err=0;
char *str; char *str;
if (!call->current_params.in_conference){ if (!call->current_params->in_conference){
if (call->params.in_conference){ if (call->params->in_conference){
ms_warning("Not (yet) in conference, be patient"); ms_warning("Not (yet) in conference, be patient");
return -1; return -1;
}else{ }else{
...@@ -232,7 +232,7 @@ static int remove_from_conference(LinphoneCore *lc, LinphoneCall *call, bool_t a ...@@ -232,7 +232,7 @@ static int remove_from_conference(LinphoneCore *lc, LinphoneCall *call, bool_t a
return -1; return -1;
} }
} }
call->params.in_conference=FALSE; call->params->in_conference=FALSE;
str=linphone_call_get_remote_address_as_string(call); str=linphone_call_get_remote_address_as_string(call);
ms_message("%s will be removed from conference", str); ms_message("%s will be removed from conference", str);
...@@ -267,7 +267,7 @@ static int convert_conference_to_call(LinphoneCore *lc){ ...@@ -267,7 +267,7 @@ static int convert_conference_to_call(LinphoneCore *lc){
while (calls) { while (calls) {
LinphoneCall *rc=(LinphoneCall*)calls->data; LinphoneCall *rc=(LinphoneCall*)calls->data;
calls=calls->next; 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); bool_t active_after_removed=linphone_core_is_in_conference(lc);
err=remove_from_conference(lc, rc, active_after_removed); err=remove_from_conference(lc, rc, active_after_removed);
break; break;
...@@ -370,7 +370,7 @@ int linphone_core_add_all_to_conference(LinphoneCore *lc) { ...@@ -370,7 +370,7 @@ int linphone_core_add_all_to_conference(LinphoneCore *lc) {
while (calls) { while (calls) {
LinphoneCall *call=(LinphoneCall*)calls->data; LinphoneCall *call=(LinphoneCall*)calls->data;
calls=calls->next; calls=calls->next;
if (!call->current_params.in_conference) { if (!call->current_params->in_conference) {
linphone_core_add_to_conference(lc, call); linphone_core_add_to_conference(lc, call);
} }
} }
...@@ -394,7 +394,7 @@ int linphone_core_terminate_conference(LinphoneCore *lc) { ...@@ -394,7 +394,7 @@ int linphone_core_terminate_conference(LinphoneCore *lc) {
while (calls) { while (calls) {
LinphoneCall *call=(LinphoneCall*)calls->data; LinphoneCall *call=(LinphoneCall*)calls->data;
calls=calls->next; calls=calls->next;
if (call->current_params.in_conference) { if (call->current_params->in_conference) {
linphone_core_terminate_call(lc, call); linphone_core_terminate_call(lc, call);
} }
} }
......
This diff is collapsed.
...@@ -2238,7 +2238,7 @@ LinphoneCall * linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall * ...@@ -2238,7 +2238,7 @@ LinphoneCall * linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *
} }
if (!params){ 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; cp->referer=call;
ms_message("Starting new call to refered address %s",call->refer_to); 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* ...@@ -2820,7 +2820,7 @@ int linphone_core_accept_early_media_with_params(LinphoneCore* lc, LinphoneCall*
// if parameters are passed, update the media description // if parameters are passed, update the media description
if ( params ) { if ( params ) {
_linphone_call_params_copy ( &call->params,params ); call->params = linphone_call_params_copy(params);
linphone_call_make_local_media_description ( lc,call ); linphone_call_make_local_media_description ( lc,call );
sal_call_set_local_media_description ( call->op,call->localdesc ); sal_call_set_local_media_description ( call->op,call->localdesc );
sal_op_set_sent_custom_header ( call->op,params->custom_headers ); 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){ ...@@ -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); linphone_core_update_local_media_description_from_upnp(call->localdesc, call->upnp_session);
} }
#endif //BUILD_UPNP #endif //BUILD_UPNP
if (call->params.in_conference){ if (call->params->in_conference){
subject="Conference"; subject="Conference";
}else{ }else{
subject="Media change"; subject="Media change";
...@@ -2924,7 +2924,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho ...@@ -2924,7 +2924,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho
} }
#endif /* defined(VIDEO_ENABLED) && defined(BUILD_UPNP) */ #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); err=linphone_call_prepare_ice(call,FALSE);
if (err==1) { if (err==1) {
ms_message("Defer call update to gather ICE candidates"); ms_message("Defer call update to gather ICE candidates");
...@@ -3053,19 +3053,19 @@ int _linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, cons ...@@ -3053,19 +3053,19 @@ int _linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, cons
return 0; return 0;
} }
if (params==NULL){ 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 }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."); 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"); 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*/ linphone_call_init_media_streams(call); /*so that video stream is initialized if necessary*/
if (call->ice_session != NULL) { if (call->ice_session != NULL) {
if (linphone_call_prepare_ice(call,TRUE)==1) if (linphone_call_prepare_ice(call,TRUE)==1)
...@@ -3170,7 +3170,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, ...@@ -3170,7 +3170,7 @@ int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call,
linphone_call_set_contact_op(call); linphone_call_set_contact_op(call);
if (params){ if (params){
const SalMediaDescription *md = sal_call_get_remote_media_description(call->op); 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 // There might not be a md if the INVITE was lacking an SDP
// In this case we use the parameters as is. // In this case we use the parameters as is.
if (md) { if (md) {
...@@ -3475,7 +3475,7 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call){ ...@@ -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"); ms_warning("we cannot resume a call that has not been established and paused before");
return -1; return -1;
} }
if (call->params.in_conference==FALSE){ if (call->params->in_conference==FALSE){
if (linphone_core_sound_resources_locked(lc)){ if (linphone_core_sound_resources_locked(lc)){
ms_warning("Cannot resume call %p because another call is locking the sound resources.",call); ms_warning("Cannot resume call %p because another call is locking the sound resources.",call);
return -1; return -1;
...@@ -3498,12 +3498,12 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call){ ...@@ -3498,12 +3498,12 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *call){
#endif //BUILD_UPNP #endif //BUILD_UPNP
sal_call_set_local_media_description(call->op,call->localdesc); sal_call_set_local_media_description(call->op,call->localdesc);
sal_media_description_set_dir(call->localdesc,SalStreamSendRecv); 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){ if(sal_call_update(call->op,subject) != 0){
return -1; return -1;
} }
linphone_call_set_state(call,LinphoneCallResuming,"Resuming"); linphone_call_set_state(call,LinphoneCallResuming,"Resuming");
if (call->params.in_conference==FALSE) if (call->params->in_conference==FALSE)
lc->current_call=call; lc->current_call=call;
snprintf(temp,sizeof(temp)-1,"Resuming the call with %s",linphone_call_get_remote_address_as_string(call)); snprintf(temp,sizeof(temp)-1,"Resuming the call with %s",linphone_call_get_remote_address_as_string(call));
if (lc->vtable.display_status) if (lc->vtable.display_status)
...@@ -5976,7 +5976,7 @@ LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc){ ...@@ -5976,7 +5976,7 @@ LinphoneGlobalState linphone_core_get_global_state(const LinphoneCore *lc){
} }
LinphoneCallParams *linphone_core_create_default_call_parameters(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); linphone_core_init_default_params(lc, p);
return p; return p;
} }
...@@ -5991,7 +5991,7 @@ LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *l ...@@ -5991,7 +5991,7 @@ LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *l
*/ */
LinphoneCallParams *linphone_core_create_call_params(LinphoneCore *lc, LinphoneCall *call){ LinphoneCallParams *linphone_core_create_call_params(LinphoneCore *lc, LinphoneCall *call){
if (!call) return linphone_core_create_default_call_parameters(lc); 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){ const char *linphone_reason_to_string(LinphoneReason err){
......
...@@ -285,18 +285,41 @@ LINPHONE_PUBLIC char * linphone_payload_type_get_mime_type(const LinphonePayload ...@@ -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); 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);