diff --git a/coreapi/conference.c b/coreapi/conference.c index 53abfab81..3714ded9a 100644 --- a/coreapi/conference.c +++ b/coreapi/conference.c @@ -109,6 +109,7 @@ int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call){ conference_check_init(&lc->conf_ctx); call->params.in_conference=TRUE; call->params.has_video=FALSE; + call->params.media_encryption=LinphoneMediaEncryptionNone; params=call->params; if (call->state==LinphoneCallPaused) linphone_core_resume_call(lc,call); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 9998c02d3..4bda4d750 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -353,8 +353,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro linphone_address_clean(from); linphone_core_get_local_ip(lc,linphone_address_get_domain(from),call->localip); linphone_call_init_common(call, from, to); - call->params.has_video=linphone_core_video_enabled(lc); - call->params.media_encryption=linphone_core_get_media_encryption(lc); + linphone_core_init_default_params(lc, &call->params); call->localdesc=create_local_media_description (lc,call); call->camera_active=call->params.has_video; if (linphone_core_get_firewall_policy(call->core)==LinphonePolicyUseStun) @@ -713,6 +712,15 @@ bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp){ return cp->has_video; } +enum LinphoneMediaEncryption linphone_call_get_media_encryption(LinphoneCallParams *cp) { + return cp->media_encryption; +} + +void linphone_call_params_set_media_encryption(LinphoneCallParams *cp, enum LinphoneMediaEncryption e) { + cp->media_encryption = e; +} + + /** * Enable sending of real early media (during outgoing calls). **/ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e55235eff..715d0f2c7 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4235,8 +4235,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); - p->has_video=linphone_core_video_enabled(lc); - p->media_encryption=linphone_core_get_media_encryption(lc); + linphone_core_init_default_params(lc, p); return p; } @@ -4386,3 +4385,9 @@ bool_t linphone_core_is_media_encryption_mandatory(LinphoneCore *lc) { void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m) { lp_config_set_int(lc->config, "sip", "media_encryption_mandatory", (int)m); } + +void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params) { + params->has_video=linphone_core_video_enabled(lc); + params->media_encryption=linphone_core_get_media_encryption(lc); + params->in_conference=FALSE; +} diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index d849933cb..412138e71 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -183,6 +183,8 @@ typedef struct _LinphoneCallParams LinphoneCallParams; LinphoneCallParams * linphone_call_params_copy(const LinphoneCallParams *cp); void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled); bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp); +enum LinphoneMediaEncryption linphone_call_get_media_encryption(LinphoneCallParams *cp); +void linphone_call_params_set_media_encryption(LinphoneCallParams *cp, enum LinphoneMediaEncryption e); void linphone_call_params_enable_early_media_sending(LinphoneCallParams *cp, bool_t enabled); bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *cp); bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp); @@ -1031,12 +1033,24 @@ int linphone_core_leave_conference(LinphoneCore *lc); int linphone_core_terminate_conference(LinphoneCore *lc); int linphone_core_get_conference_size(LinphoneCore *lc); +/** + * Choose media encryption policy to be used for RTP packets + */ void linphone_core_set_media_encryption(LinphoneCore *lc, enum LinphoneMediaEncryption menc); enum LinphoneMediaEncryption linphone_core_get_media_encryption(LinphoneCore *lc); bool_t linphone_core_is_media_encryption_mandatory(LinphoneCore *lc); +/** + * Defines Linphone behaviour when encryption parameters negociation fails on outoing call. + * If set to TRUE call will fail; if set to FALSE will resend an INVITE with encryption disabled + */ void linphone_core_set_media_encryption_mandatory(LinphoneCore *lc, bool_t m); +/** + * Init call params using LinphoneCore's current configuration + */ +void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params); + #ifdef __cplusplus } #endif