Commit d795a305 authored by Ghislain MARY's avatar Ghislain MARY

Convert LinphoneCallParams to use MediaSessionParams C++ class.

parent 6d54b3c4
This diff is collapsed.
......@@ -40,7 +40,8 @@ static int media_parameters_changed(LinphoneCall *call, SalMediaDescription *old
int otherdesc_changed;
char *tmp1=NULL;
char *tmp2=NULL;
if (call->params->in_conference != call->current_params->in_conference) return SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION;
if (linphone_call_params_get_in_conference(call->params) != linphone_call_params_get_in_conference(call->current_params))
return SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION;
if (call->up_bw != linphone_core_get_upload_bandwidth(call->core)) return SAL_MEDIA_DESCRIPTION_FORCE_STREAM_RECONSTRUCTION;
if (call->localdesc_changed) ms_message("Local description has changed: %s", tmp1 = sal_media_description_print_differences(call->localdesc_changed));
otherdesc_changed = sal_media_description_equals(oldmd, newmd);
......@@ -199,7 +200,7 @@ void linphone_call_update_streams(LinphoneCall *call, SalMediaDescription *new_m
linphone_call_init_media_streams(call);
}
if (call->params->real_early_media && (call->state == LinphoneCallOutgoingEarlyMedia)) {
if (linphone_call_params_real_early_media_enabled(call->params) && (call->state == LinphoneCallOutgoingEarlyMedia)) {
prepare_early_media_forking(call);
}
linphone_call_start_media_streams(call, target_state);
......@@ -464,7 +465,7 @@ static void call_ringing(SalOp *h){
if (call==NULL) return;
/*set privacy*/
call->current_params->privacy=(LinphonePrivacyMask)sal_op_get_privacy(call->op);
linphone_call_params_set_privacy(call->current_params, (LinphonePrivacyMask)sal_op_get_privacy(call->op));
linphone_core_notify_display_status(lc,_("Remote ringing."));
......@@ -543,10 +544,10 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o
linphone_task_list_init(&tl);
rmd=sal_call_get_remote_media_description(op);
/*set privacy*/
call->current_params->privacy=(LinphonePrivacyMask)sal_op_get_privacy(call->op);
linphone_call_params_set_privacy(call->current_params, (LinphonePrivacyMask)sal_op_get_privacy(call->op));
/*reset the internal call update flag, so it doesn't risk to be copied and used in further re-INVITEs*/
if (call->params->internal_call_update)
call->params->internal_call_update = FALSE;
if (linphone_call_params_get_internal_call_update(call->params))
linphone_call_params_set_internal_call_update(call->params, FALSE);
#ifdef BUILD_UPNP
......@@ -585,7 +586,7 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o
next_state = LinphoneCallPausedByRemote;
next_state_str = "Call paused by remote";
}else{
if (!call->params->in_conference)
if (!linphone_call_params_get_in_conference(call->params))
lc->current_call=call;
next_state = LinphoneCallStreamsRunning;
next_state_str = "Streams running";
......@@ -993,22 +994,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 (linphone_call_params_get_media_encryption(call->params) == LinphoneMediaEncryptionSRTP) {
if (linphone_call_params_avpf_enabled(call->params) == TRUE) {
if (i == 0) ms_message("Retrying call [%p] with SAVP", call);
call->params->avpf_enabled = FALSE;
linphone_call_params_enable_avpf(call->params, FALSE);
linphone_call_restart_invite(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;
linphone_call_params_set_media_encryption(call->params, LinphoneMediaEncryptionNone);
memset(call->localdesc->streams[i].crypto, 0, sizeof(call->localdesc->streams[i].crypto));
linphone_call_restart_invite(call);
return;
}
} else if (call->params->avpf_enabled == TRUE) {
} else if (linphone_call_params_avpf_enabled(call->params) == TRUE) {
if (i == 0) ms_message("Retrying call [%p] with AVP", call);
call->params->avpf_enabled = FALSE;
linphone_call_params_enable_avpf(call->params, FALSE);
linphone_call_restart_invite(call);
return;
}
......
......@@ -415,7 +415,7 @@ int LocalConference::inviteAddresses(const std::list<const LinphoneAddress*> &ad
LinphoneCallParams * new_params = params ? linphone_call_params_copy(params) : linphone_core_create_call_params(m_core, NULL);
LinphoneCall *call;
/*toggle this flag so the call is immediately added to the conference upon acceptance*/
new_params->in_conference = TRUE;
linphone_call_params_set_in_conference(new_params, TRUE);
linphone_call_params_enable_video(new_params, FALSE); /*turn off video as it is not supported for conferencing at this time*/
call = linphone_core_invite_address_with_params(m_core, addr, new_params);
if (!call){
......@@ -424,7 +424,7 @@ int LocalConference::inviteAddresses(const std::list<const LinphoneAddress*> &ad
linphone_call_params_unref(new_params);
}else{
/*there is already a call to this address, so simply join it to the local conference if not already done*/
if (!call->current_params->in_conference)
if (!linphone_call_params_get_in_conference(call->current_params))
addParticipant(call);
}
/*if the local participant is not yet created, created it and it to the conference */
......@@ -434,19 +434,19 @@ int LocalConference::inviteAddresses(const std::list<const LinphoneAddress*> &ad
}
int LocalConference::addParticipant(LinphoneCall *call) {
if (call->current_params->in_conference){
if (linphone_call_params_get_in_conference(call->current_params)){
ms_error("Already in conference");
return -1;
}
if (call->state==LinphoneCallPaused){
call->params->in_conference=TRUE;
call->params->has_video=FALSE;
linphone_call_params_set_in_conference(call->params, TRUE);
linphone_call_params_enable_video(call->params, FALSE);
linphone_call_resume(call);
}else if (call->state==LinphoneCallStreamsRunning){
LinphoneCallParams *params = linphone_core_create_call_params(m_core, call);
params->in_conference=TRUE;
params->has_video=FALSE;
linphone_call_params_set_in_conference(params, TRUE);
linphone_call_params_enable_video(params, FALSE);
if (call->audiostream || call->videostream){
linphone_call_stop_media_streams(call); /*free the audio & video local resources*/
......@@ -471,8 +471,8 @@ int LocalConference::removeFromConference(LinphoneCall *call, bool_t active){
int err=0;
char *str;
if (!call->current_params->in_conference){
if (call->params->in_conference){
if (!linphone_call_params_get_in_conference(call->current_params)){
if (linphone_call_params_get_in_conference(call->params)){
ms_warning("Not (yet) in conference, be patient");
return -1;
}else{
......@@ -480,14 +480,14 @@ int LocalConference::removeFromConference(LinphoneCall *call, bool_t active){
return -1;
}
}
call->params->in_conference=FALSE;
linphone_call_params_set_in_conference(call->params, FALSE);
str=linphone_call_get_remote_address_as_string(call);
ms_message("%s will be removed from conference", str);
ms_free(str);
if (active){
LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call));
params->in_conference=FALSE;
linphone_call_params_set_in_conference(params, FALSE);
// reconnect local audio with this call
if (isIn()){
ms_message("Leaving conference for reconnecting with unique call.");
......@@ -522,7 +522,7 @@ int LocalConference::convertConferenceToCall(){
while (calls) {
LinphoneCall *rc=(LinphoneCall*)calls->data;
calls=calls->next;
if (rc->params->in_conference) { // not using current_param
if (linphone_call_params_get_in_conference(rc->params)) { // not using current_param
bool_t active_after_removed=isIn();
err=removeFromConference(rc, active_after_removed);
break;
......@@ -566,7 +566,7 @@ int LocalConference::terminate() {
while (calls) {
LinphoneCall *call=(LinphoneCall*)calls->data;
calls=calls->next;
if (call->current_params->in_conference) {
if (linphone_call_params_get_in_conference(call->current_params)) {
linphone_call_terminate(call);
}
}
......@@ -639,7 +639,7 @@ int LocalConference::stopRecording() {
}
void LocalConference::onCallStreamStarting(LinphoneCall *call, bool isPausedByRemote) {
call->params->has_video = FALSE;
linphone_call_params_enable_video(call->params, FALSE);
call->camera_enabled = FALSE;
ms_message("LocalConference::onCallStreamStarting(): joining AudioStream [%p] of call [%p] into conference.", call->audiostream, call);
MSAudioEndpoint *ep=ms_audio_endpoint_get_from_stream(call->audiostream,TRUE);
......
This diff is collapsed.
......@@ -3340,10 +3340,10 @@ LinphoneCall * linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *
}
if (!params){
cp->has_audio = call->current_params->has_audio;
cp->has_video = call->current_params->has_video; /*start the call to refer-target with video enabled if original call had video*/
linphone_call_params_enable_audio(cp, linphone_call_params_audio_enabled(call->current_params));
linphone_call_params_enable_video(cp, linphone_call_params_video_enabled(call->current_params)); /*start the call to refer-target with video enabled if original call had video*/
}
cp->referer=call;
linphone_call_params_set_referer(cp, call);
ms_message("Starting new call to refered address %s",call->refer_to);
call->refer_pending=FALSE;
newcall=linphone_core_invite_with_params(lc,call->refer_to,cp);
......@@ -3456,7 +3456,7 @@ const char *linphone_core_find_best_identity(LinphoneCore *lc, const LinphoneAdd
LinphoneCall * linphone_core_invite(LinphoneCore *lc, const char *url){
LinphoneCall *call;
LinphoneCallParams *p=linphone_core_create_call_params(lc, NULL);
p->has_video &= !!lc->video_policy.automatically_initiate;
linphone_call_params_enable_video(p, linphone_call_params_video_enabled(p) & !!lc->video_policy.automatically_initiate);
call=linphone_core_invite_with_params(lc,url,p);
linphone_call_params_unref(p);
return call;
......@@ -3476,7 +3476,7 @@ LinphoneCall * linphone_core_invite_with_params(LinphoneCore *lc, const char *ur
LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddress *addr){
LinphoneCall *call;
LinphoneCallParams *p=linphone_core_create_call_params(lc, NULL);
p->has_video &= !!lc->video_policy.automatically_initiate;
linphone_call_params_enable_video(p, linphone_call_params_video_enabled(p) & !!lc->video_policy.automatically_initiate);
call=linphone_core_invite_address_with_params (lc,addr,p);
linphone_call_params_unref(p);
return call;
......@@ -3554,11 +3554,11 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
if (proxy!=NULL) {
from=linphone_proxy_config_get_identity(proxy);
cp->avpf_enabled = linphone_proxy_config_avpf_enabled(proxy);
cp->avpf_rr_interval = linphone_proxy_config_get_avpf_rr_interval(proxy) * 1000;
linphone_call_params_enable_avpf(cp, linphone_proxy_config_avpf_enabled(proxy));
linphone_call_params_set_avpf_rr_interval(cp, linphone_proxy_config_get_avpf_rr_interval(proxy) * 1000);
}else{
cp->avpf_enabled=linphone_core_get_avpf_mode(lc)==LinphoneAVPFEnabled;
if (cp->avpf_enabled) cp->avpf_rr_interval=linphone_core_get_avpf_rr_interval(lc) * 1000;
linphone_call_params_enable_avpf(cp, linphone_core_get_avpf_mode(lc)==LinphoneAVPFEnabled);
if (linphone_call_params_avpf_enabled(cp)) linphone_call_params_set_avpf_rr_interval(cp, linphone_core_get_avpf_rr_interval(lc) * 1000);
}
/* if no proxy or no identity defined for this proxy, default to primary contact*/
......@@ -6808,26 +6808,26 @@ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) {
}
void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params) {
params->has_audio = TRUE;
params->has_video=linphone_core_video_enabled(lc) && lc->video_policy.automatically_initiate;
linphone_call_params_enable_audio(params, TRUE);
linphone_call_params_enable_video(params, linphone_core_video_enabled(lc) && lc->video_policy.automatically_initiate);
if (!linphone_core_video_enabled(lc) && lc->video_policy.automatically_initiate){
ms_error("LinphoneCore has video disabled for both capture and display, but video policy is to start the call with video. "
"This is a possible mis-use of the API. In this case, video is disabled in default LinphoneCallParams");
}
params->media_encryption=linphone_core_get_media_encryption(lc);
params->in_conference=FALSE;
params->realtimetext_enabled = linphone_core_realtime_text_enabled(lc);
params->privacy=LinphonePrivacyDefault;
params->avpf_enabled=linphone_core_get_avpf_mode(lc);
params->implicit_rtcp_fb = lp_config_get_int(lc->config,"rtp","rtcp_fb_implicit_rtcp_fb",TRUE);
params->avpf_rr_interval = linphone_core_get_avpf_rr_interval(lc);
params->audio_dir=LinphoneMediaDirectionSendRecv;
params->video_dir=LinphoneMediaDirectionSendRecv;
params->real_early_media=lp_config_get_int(lc->config,"misc","real_early_media",FALSE);
params->audio_multicast_enabled=linphone_core_audio_multicast_enabled(lc);
params->video_multicast_enabled=linphone_core_video_multicast_enabled(lc);
params->update_call_when_ice_completed = lp_config_get_int(lc->config, "sip", "update_call_when_ice_completed", TRUE);
params->encryption_mandatory = linphone_core_is_media_encryption_mandatory(lc);
linphone_call_params_set_media_encryption(params, linphone_core_get_media_encryption(lc));
linphone_call_params_set_in_conference(params, FALSE);
linphone_call_params_enable_realtime_text(params, linphone_core_realtime_text_enabled(lc));
linphone_call_params_set_privacy(params, LinphonePrivacyDefault);
linphone_call_params_enable_avpf(params, linphone_core_get_avpf_mode(lc));
linphone_call_params_enable_implicit_rtcp_fb(params, lp_config_get_int(lc->config,"rtp","rtcp_fb_implicit_rtcp_fb",TRUE));
linphone_call_params_set_avpf_rr_interval(params, linphone_core_get_avpf_rr_interval(lc));
linphone_call_params_set_audio_direction(params, LinphoneMediaDirectionSendRecv);
linphone_call_params_set_video_direction(params, LinphoneMediaDirectionSendRecv);
linphone_call_params_enable_early_media_sending(params, lp_config_get_int(lc->config,"misc","real_early_media",FALSE));
linphone_call_params_enable_audio_multicast(params, linphone_core_audio_multicast_enabled(lc));
linphone_call_params_enable_video_multicast(params, linphone_core_video_multicast_enabled(lc));
linphone_call_params_set_update_call_when_ice_completed(params, lp_config_get_int(lc->config, "sip", "update_call_when_ice_completed", TRUE));
linphone_call_params_enable_mandatory_media_encryption(params, linphone_core_is_media_encryption_mandatory(lc));
}
void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id) {
......
......@@ -464,13 +464,15 @@ void linphone_core_adapt_to_network(LinphoneCore *lc, int ping_time_ms, Linphone
if (ping_time_ms>threshold){
/* we might be in a 2G network*/
params->low_bandwidth=TRUE;
linphone_call_params_enable_low_bandwidth(params, TRUE);
}/*else use default settings */
}
if (params->low_bandwidth){
params->up_bw=params->down_bw=linphone_core_get_edge_bw(lc);
params->up_ptime=params->down_ptime=linphone_core_get_edge_ptime(lc);
params->has_video=FALSE;
if (linphone_call_params_low_bandwidth_enabled(params)){
linphone_call_params_set_up_bandwidth(params, linphone_core_get_edge_bw(lc));
linphone_call_params_set_down_bandwidth(params, linphone_core_get_edge_bw(lc));
linphone_call_params_set_up_ptime(params, linphone_core_get_edge_ptime(lc));
linphone_call_params_set_down_ptime(params, linphone_core_get_edge_ptime(lc));
linphone_call_params_enable_video(params, FALSE);
}
}
......@@ -555,7 +557,7 @@ static void linphone_core_add_local_ice_candidates(LinphoneCall *call, int famil
ice_add_local_candidate(video_cl, "host", family, addr, call->media_ports[call->main_video_stream_index].rtcp_port, 2, NULL);
call->video_stats->ice_state = LinphoneIceStateInProgress;
}
if (call->params->realtimetext_enabled && (text_cl != NULL)
if (linphone_call_params_realtime_text_enabled(call->params) && (text_cl != NULL)
&& (ice_check_list_state(text_cl) != ICL_Completed) && (ice_check_list_candidates_gathered(text_cl) == FALSE)) {
ice_add_local_candidate(text_cl, "host", family, addr, call->media_ports[call->main_text_stream_index].rtp_port, 1, NULL);
ice_add_local_candidate(text_cl, "host", family, addr, call->media_ports[call->main_text_stream_index].rtcp_port, 2, NULL);
......@@ -706,7 +708,7 @@ void linphone_call_update_ice_state_in_call_stats(LinphoneCall *call) {
session_state = ice_session_state(call->ice_session);
if ((session_state == IS_Completed) || ((session_state == IS_Failed) && (ice_session_has_completed_check_list(call->ice_session) == TRUE))) {
if (call->params->has_audio && (audio_check_list != NULL)) {
if (linphone_call_params_audio_enabled(call->params) && (audio_check_list != NULL)) {
if (ice_check_list_state(audio_check_list) == ICL_Completed) {
switch (ice_check_list_selected_valid_candidate_type(audio_check_list)) {
case ICT_HostCandidate:
......@@ -729,7 +731,7 @@ void linphone_call_update_ice_state_in_call_stats(LinphoneCall *call) {
}
}else call->audio_stats->ice_state = LinphoneIceStateNotActivated;
if (call->params->has_video && (video_check_list != NULL)) {
if (linphone_call_params_video_enabled(call->params) && (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:
......@@ -752,7 +754,7 @@ void linphone_call_update_ice_state_in_call_stats(LinphoneCall *call) {
}
}else call->video_stats->ice_state = LinphoneIceStateNotActivated;
if (call->params->realtimetext_enabled && (text_check_list != NULL)) {
if (linphone_call_params_realtime_text_enabled(call->params) && (text_check_list != NULL)) {
if (ice_check_list_state(text_check_list) == ICL_Completed) {
switch (ice_check_list_selected_valid_candidate_type(text_check_list)) {
case ICT_HostCandidate:
......@@ -776,18 +778,18 @@ void linphone_call_update_ice_state_in_call_stats(LinphoneCall *call) {
}else call->text_stats->ice_state = LinphoneIceStateNotActivated;
} else if (session_state == IS_Running) {
call->audio_stats->ice_state = LinphoneIceStateInProgress;
if (call->params->has_video && (video_check_list != NULL)) {
if (linphone_call_params_video_enabled(call->params) && (video_check_list != NULL)) {
call->video_stats->ice_state = LinphoneIceStateInProgress;
}
if (call->params->realtimetext_enabled && (text_check_list != NULL)) {
if (linphone_call_params_realtime_text_enabled(call->params) && (text_check_list != NULL)) {
call->text_stats->ice_state = LinphoneIceStateInProgress;
}
} else {
call->audio_stats->ice_state = LinphoneIceStateFailed;
if (call->params->has_video && (video_check_list != NULL)) {
if (linphone_call_params_video_enabled(call->params) && (video_check_list != NULL)) {
call->video_stats->ice_state = LinphoneIceStateFailed;
}
if (call->params->realtimetext_enabled && (text_check_list != NULL)) {
if (linphone_call_params_realtime_text_enabled(call->params) && (text_check_list != NULL)) {
call->text_stats->ice_state = LinphoneIceStateFailed;
}
}
......
......@@ -131,54 +131,6 @@ extern "C" {
#define STRING_SET(field, value) do{ if (field){bctbx_free(field);field=NULL;}; field=bctbx_strdup(value); }while(0)
#define STRING_TRANSFER(field, newvalue) do{ if (field){bctbx_free(field);field=NULL;}; field=newvalue; }while(0)
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;
PayloadType *audio_codec; /*audio codec currently in use */
PayloadType *video_codec; /*video codec currently in use */
PayloadType *text_codec; /*text codec currently in use */
MSVideoSize sent_vsize; /* DEPRECATED: Size of the video currently being sent */
MSVideoSize recv_vsize; /* DEPRECATED: Size of the video currently being received */
LinphoneVideoDefinition *sent_vdef; /* Definition of the video currently being sent */
LinphoneVideoDefinition *recv_vdef; /* Definition of the video currrently being received */
float received_fps,sent_fps;
int down_bw;
int up_bw;
int down_ptime;
int up_ptime;
char *record_file;
char *session_name;
SalCustomHeader *custom_headers;
SalCustomSdpAttribute *custom_sdp_attributes;
SalCustomSdpAttribute *custom_sdp_media_attributes[LinphoneStreamTypeUnknown];
LinphonePrivacyMask privacy;
LinphoneMediaDirection audio_dir;
LinphoneMediaDirection video_dir;
bool_t has_audio;
bool_t has_video;
bool_t avpf_enabled; /* RTCP feedback messages are enabled */
bool_t implicit_rtcp_fb;
bool_t real_early_media; /*send real media even during early media (for outgoing calls)*/
bool_t in_conference; /*in conference mode */
bool_t low_bandwidth;
bool_t no_user_consent;/*when set to TRUE an UPDATE request will be used instead of reINVITE*/
uint16_t avpf_rr_interval; /*in milliseconds*/
bool_t internal_call_update; /*use mark that call update was requested internally (might be by ice) - unused for the moment*/
bool_t video_multicast_enabled;
bool_t audio_multicast_enabled;
bool_t realtimetext_enabled;
bool_t update_call_when_ice_completed;
bool_t encryption_mandatory;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneCallParams);
typedef enum _ImdnType {
ImdnTypeDelivery,
......@@ -445,6 +397,38 @@ SalStreamDir get_video_dir_from_call_params(const LinphoneCallParams *params);
void linphone_call_params_set_custom_headers(LinphoneCallParams *params, const SalCustomHeader *ch);
void linphone_call_params_set_custom_sdp_attributes(LinphoneCallParams *params, const SalCustomSdpAttribute *csa);
void linphone_call_params_set_custom_sdp_media_attributes(LinphoneCallParams *params, LinphoneStreamType type, const SalCustomSdpAttribute *csa);
bool_t linphone_call_params_get_in_conference(const LinphoneCallParams *params);
void linphone_call_params_set_in_conference(LinphoneCallParams *params, bool_t value);
bool_t linphone_call_params_get_internal_call_update(const LinphoneCallParams *params);
void linphone_call_params_set_internal_call_update(LinphoneCallParams *params, bool_t value);
bool_t linphone_call_params_implicit_rtcp_fb_enabled(const LinphoneCallParams *params);
void linphone_call_params_enable_implicit_rtcp_fb(LinphoneCallParams *params, bool_t value);
int linphone_call_params_get_down_bandwidth(const LinphoneCallParams *params);
void linphone_call_params_set_down_bandwidth(LinphoneCallParams *params, int value);
int linphone_call_params_get_up_bandwidth(const LinphoneCallParams *params);
void linphone_call_params_set_up_bandwidth(LinphoneCallParams *params, int value);
int linphone_call_params_get_down_ptime(const LinphoneCallParams *params);
void linphone_call_params_set_down_ptime(LinphoneCallParams *params, int value);
int linphone_call_params_get_up_ptime(const LinphoneCallParams *params);
void linphone_call_params_set_up_ptime(LinphoneCallParams *params, int value);
SalCustomHeader * linphone_call_params_get_custom_headers(const LinphoneCallParams *params);
SalCustomSdpAttribute * linphone_call_params_get_custom_sdp_attributes(const LinphoneCallParams *params);
SalCustomSdpAttribute * linphone_call_params_get_custom_sdp_media_attributes(const LinphoneCallParams *params, LinphoneStreamType type);
LinphoneCall * linphone_call_params_get_referer(const LinphoneCallParams *params);
void linphone_call_params_set_referer(LinphoneCallParams *params, LinphoneCall *referer);
bool_t linphone_call_params_get_update_call_when_ice_completed(const LinphoneCallParams *params);
void linphone_call_params_set_update_call_when_ice_completed(LinphoneCallParams *params, bool_t value);
void linphone_call_params_set_sent_vsize(LinphoneCallParams *params, MSVideoSize vsize);
void linphone_call_params_set_recv_vsize(LinphoneCallParams *params, MSVideoSize vsize);
void linphone_call_params_set_sent_video_definition(LinphoneCallParams *params, LinphoneVideoDefinition *vdef);
void linphone_call_params_set_received_video_definition(LinphoneCallParams *params, LinphoneVideoDefinition *vdef);
void linphone_call_params_set_sent_fps(LinphoneCallParams *params, float value);
void linphone_call_params_set_received_fps(LinphoneCallParams *params, float value);
void linphone_call_params_set_used_audio_codec(LinphoneCallParams *params, OrtpPayloadType *codec);
void linphone_call_params_set_used_video_codec(LinphoneCallParams *params, OrtpPayloadType *codec);
void linphone_call_params_set_used_text_codec(LinphoneCallParams *params, OrtpPayloadType *codec);
bool_t linphone_call_params_get_no_user_consent(const LinphoneCallParams *params);
void linphone_call_params_set_no_user_consent(LinphoneCallParams *params, bool_t value);
void linphone_auth_info_write_config(LinphoneConfig *config, LinphoneAuthInfo *obj, int pos);
LinphoneAuthInfo * linphone_auth_info_new_from_config_file(LpConfig *config, int pos);
......
......@@ -545,15 +545,15 @@ void linphone_reporting_update_media_info(LinphoneCall * call, int stats_type) {
/*yet we use the same payload config for local and remote, since this is the largest use case*/
if (stats_type == LINPHONE_CALL_STATS_AUDIO && call->audiostream != NULL) {
stream = &call->audiostream->ms;
local_payload = current_params->audio_codec;
local_payload = linphone_call_params_get_used_audio_codec(current_params);
remote_payload = local_payload;
} else if (stats_type == LINPHONE_CALL_STATS_VIDEO && call->videostream != NULL) {
stream = &call->videostream->ms;
local_payload = current_params->video_codec;
local_payload = linphone_call_params_get_used_video_codec(current_params);
remote_payload = local_payload;
} else if (stats_type == LINPHONE_CALL_STATS_TEXT && call->textstream != NULL) {
stream = &call->textstream->ms;
local_payload = current_params->text_codec;
local_payload = linphone_call_params_get_used_text_codec(current_params);
remote_payload = local_payload;
}
......
......@@ -338,6 +338,16 @@ LINPHONE_PUBLIC void linphone_call_params_set_audio_direction(LinphoneCallParams
LINPHONE_PUBLIC void linphone_call_params_set_video_direction(LinphoneCallParams *cp, LinphoneMediaDirection dir);
int linphone_call_params_get_audio_bandwidth_limit(const LinphoneCallParams *params);
bool_t linphone_call_params_real_early_media_enabled(const LinphoneCallParams *params);
bool_t linphone_call_params_avpf_enabled(const LinphoneCallParams *params);
void linphone_call_params_enable_avpf(LinphoneCallParams *params, bool_t enable);
bool_t linphone_call_params_mandatory_media_encryption_enabled(const LinphoneCallParams *params);
void linphone_call_params_enable_mandatory_media_encryption(LinphoneCallParams *params, bool_t value);
uint16_t linphone_call_params_get_avpf_rr_interval(const LinphoneCallParams *params);
void linphone_call_params_set_avpf_rr_interval(LinphoneCallParams *params, uint16_t value);
/*******************************************************************************
* Reference and user data handling functions *
******************************************************************************/
......
......@@ -34,6 +34,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
conference/params/call-session-params.h
conference/params/call-session-params-p.h
conference/params/media-session-params.h
conference/params/media-session-params-p.h
conference/participant.h
conference/remote-conference.h
conference/session/call-session.h
......
......@@ -16,28 +16,58 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CONFERENCE_CALL_SESSION_PARAMS_P_H_
#define _CONFERENCE_CALL_SESSION_PARAMS_P_H_
#ifndef _CALL_SESSION_PARAMS_P_H_
#define _CALL_SESSION_PARAMS_P_H_
#include "object/object-p.h"
#include "object/clonable-object-p.h"
#include "call-session-params.h"
#include "linphone/types.h"
// =============================================================================
namespace LinphonePrivate {
namespace Conference {
class CallSessionParamsPrivate : public ObjectPrivate {
public:
virtual ~CallSessionParamsPrivate () = default;
LINPHONE_BEGIN_NAMESPACE
class CallSessionParamsPrivate : public ClonableObjectPrivate {
public:
CallSessionParamsPrivate () = default;
CallSessionParamsPrivate (const CallSessionParamsPrivate &src);
virtual ~CallSessionParamsPrivate ();
bool getInConference () const { return inConference; }
void setInConference (bool value) { inConference = value; }
bool getInternalCallUpdate () const { return internalCallUpdate; }
void setInternalCallUpdate (bool value) { internalCallUpdate = value; }
bool getNoUserConsent () const { return noUserConsent; }
void setNoUserConsent (bool value) { noUserConsent = value; }
SalCustomHeader * getCustomHeaders () const;
void setCustomHeaders (const SalCustomHeader *ch);
SalCustomSdpAttribute * getCustomSdpAttributes () const;
void setCustomSdpAttributes (const SalCustomSdpAttribute *csa);
SalCustomSdpAttribute * getCustomSdpMediaAttributes (LinphoneStreamType lst) const;
void setCustomSdpMediaAttributes (LinphoneStreamType lst, const SalCustomSdpAttribute *csa);
LinphoneCall *getReferer () const { return referer; }
void setReferer (LinphoneCall *call) { referer = call; }
public:
std::string sessionName;
LinphonePrivacyMask privacy = LinphonePrivacyNone;
private:
bool inConference = false;
bool internalCallUpdate = false;
bool noUserConsent = false; /* When set to true an UPDATE request will be used instead of reINVITE */
SalCustomHeader *customHeaders = nullptr;
SalCustomSdpAttribute *customSdpAttributes = nullptr;
SalCustomSdpAttribute *customSdpMediaAttributes[LinphoneStreamTypeUnknown];
LinphoneCall *referer = nullptr; /* In case call creation is consecutive to an incoming transfer, this points to the original call */
LinphonePrivacyMask privacy = LinphonePrivacyNone;
public:
L_DECLARE_PUBLIC(CallSessionParams);
};
L_DECLARE_PUBLIC(CallSessionParams);
};
}
}
LINPHONE_END_NAMESPACE
#endif // ifndef _CONFERENCE_CALL_SESSION_PARAMS_P_H_
#endif // ifndef _CALL_SESSION_PARAMS_P_H_
......@@ -20,8 +20,171 @@
#include "call-session-params.h"
using namespace LinphonePrivate;
using namespace std;
LINPHONE_BEGIN_NAMESPACE
// =============================================================================
CallSessionParamsPrivate::CallSessionParamsPrivate (const CallSessionParamsPrivate &src) {
sessionName = src.sessionName;
privacy = src.privacy;
inConference = src.inConference;
internalCallUpdate = src.internalCallUpdate;
noUserConsent = src.noUserConsent;
/* The management of the custom headers is not optimal. We copy everything while ref counting would be more efficient. */
if (src.customHeaders)
customHeaders = sal_custom_header_clone(src.customHeaders);
if (src.customSdpAttributes)
customSdpAttributes = sal_custom_sdp_attribute_clone(src.customSdpAttributes);
for (unsigned int i = 0; i < (unsigned int)LinphoneStreamTypeUnknown; i++) {
if (src.customSdpMediaAttributes[i])
customSdpMediaAttributes[i] = sal_custom_sdp_attribute_clone(src.customSdpMediaAttributes[i]);
}
referer = src.referer;
}
CallSessionParamsPrivate::~CallSessionParamsPrivate () {
if (customHeaders)
sal_custom_header_free(customHeaders);
if (customSdpAttributes)
sal_custom_sdp_attribute_free(customSdpAttributes);
for (unsigned int i = 0; i < (unsigned int)LinphoneStreamTypeUnknown; i++) {
if (customSdpMediaAttributes[i])
sal_custom_sdp_attribute_free(customSdpMediaAttributes[i]);
}
}
// -----------------------------------------------------------------------------
SalCustomHeader * CallSessionParamsPrivate::getCustomHeaders () const {
return customHeaders;
}
void CallSessionParamsPrivate::setCustomHeaders (const SalCustomHeader *ch) {
if (customHeaders) {
sal_custom_header_free(customHeaders);
customHeaders = nullptr;
}
if (ch)
customHeaders = sal_custom_header_clone(ch);
}
// -----------------------------------------------------------------------------
SalCustomSdpAttribute * CallSessionParamsPrivate::getCustomSdpAttributes () const {
return customSdpAttributes;
}
void CallSessionParamsPrivate::setCustomSdpAttributes (const SalCustomSdpAttribute *csa) {
if (customSdpAttributes) {
sal_custom_sdp_attribute_free(customSdpAttributes);
customSdpAttributes = nullptr;
}
if (csa)
customSdpAttributes = sal_custom_sdp_attribute_clone(csa);
}
// -----------------------------------------------------------------------------
SalCustomSdpAttribute * CallSessionParamsPrivate::getCustomSdpMediaAttributes (LinphoneStreamType lst) const {
return customSdpMediaAttributes[lst];
}
void CallSessionParamsPrivate::setCustomSdpMediaAttributes (LinphoneStreamType lst, const SalCustomSdpAttribute *csa) {
if (customSdpMediaAttributes[lst]) {
sal_custom_sdp_attribute_free(customSdpMediaAttributes[lst]);
customSdpMediaAttributes[lst] = nullptr;
}
if (csa)
customSdpMediaAttributes[lst] = sal_custom_sdp_attribute_clone(csa);
}
// =============================================================================
Conference::CallSessionParams::CallSessionParams (CallSessionParamsPrivate &p) : Object(p) {}
CallSessionParams::CallSessionParams () : ClonableObject(*new CallSessionParamsPrivate) {}
CallSessionParams::CallSessionParams (CallSessionParamsPrivate &p) : ClonableObject(p) {
L_D(CallSessionParams);
memset(d->customSdpMediaAttributes, 0, sizeof(d->customSdpMediaAttributes));
}
CallSessionParams::CallSessionParams (const CallSessionParams &src)
: ClonableObject(*new CallSessionParamsPrivate(*src.getPrivate())) {}
// -----------------------------------------------------------------------------
const string& CallSessionParams::getSessionName () const {
L_D(const CallSessionParams);
return d->sessionName;
}
void CallSessionParams::setSessionName (const string &sessionName) {
L_D(CallSessionParams);
d->sessionName = sessionName;
}
// -----------------------------------------------------------------------------
LinphonePrivacyMask CallSessionParams::getPrivacy () const {
L_D(const CallSessionParams);
return d->privacy;
}
void CallSessionParams::setPrivacy (LinphonePrivacyMask privacy) {
L_D(CallSessionParams);
d->privacy = privacy;
}
// -----------------------------------------------------------------------------