Commit a08e2635 authored by Simon Morlat's avatar Simon Morlat

add setting to LinphoneCore to enable avpf even for calls out of proxies.

parent 0784298f
......@@ -738,7 +738,7 @@ void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, c
if (call->dest_proxy != NULL) {
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 = linphone_core_get_avpf_rr_interval(call->core)*1000;
}
}
if ((sal_media_description_has_srtp(md) == TRUE) && (media_stream_srtp_supported() == TRUE)) {
......
......@@ -507,6 +507,7 @@ static void rtp_config_read(LinphoneCore *lc)
adaptive_jitt_comp_enabled = lp_config_get_int(lc->config, "rtp", "video_adaptive_jitt_comp_enabled", TRUE);
linphone_core_enable_video_adaptive_jittcomp(lc, adaptive_jitt_comp_enabled);
lc->rtp_conf.disable_upnp = lp_config_get_int(lc->config, "rtp", "disable_upnp", FALSE);
linphone_core_set_avpf_mode(lc,lp_config_get_int(lc->config,"rtp","avpf",0));
}
static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int clock_rate, int channels, const char *recv_fmtp){
......@@ -2579,6 +2580,9 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
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;
}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;
}
/* if no proxy or no identity defined for this proxy, default to primary contact*/
......@@ -2599,7 +2603,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
/* this call becomes now the current one*/
lc->current_call=call;
linphone_call_set_state (call,LinphoneCallOutgoingInit,"Starting outgoing call");
call->log->start_date_time=time(NULL);
call->log->start_date_time=ms_time(NULL);
linphone_call_init_media_streams(call);
if (_linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseIce) {
......@@ -6428,6 +6432,47 @@ void linphone_core_remove_supported_tag(LinphoneCore *lc, const char *tag){
lp_config_set_string(lc->config,"sip","supported",sal_get_supported_tags(lc->sal));
}
/**
* Enable RTCP feedback (also known as RTP/AVPF profile).
* Setting LinphoneAVPFDefault is equivalent to LinphoneAVPFDisabled.
* This setting can be overriden per LinphoneProxyConfig with linphone_proxy_config_set_avpf_mode().
* The value set here is used for calls placed or received out of any proxy configured, or if the proxy config is configured with LinphoneAVPFDefault.
* @param lc the LinphoneCore
* @param mode the mode.
**/
void linphone_core_set_avpf_mode(LinphoneCore *lc, LinphoneAVPFMode mode){
if (mode==LinphoneAVPFDefault) mode=LinphoneAVPFDisabled;
lc->rtp_conf.avpf_mode=mode;
if (linphone_core_ready(lc)) lp_config_set_int(lc->config,"rtp","avpf",mode);
}
/**
* Return AVPF enablement. See linphone_core_set_avpf_mode() .
* @param lc the core
* @return the avpf enablement mode.
**/
LinphoneAVPFMode linphone_core_get_avpf_mode(const LinphoneCore *lc){
return lc->rtp_conf.avpf_mode;
}
/**
* Return the avpf report interval in seconds.
* @param lc the LinphoneCore
* @return the avpf report interval in seconds.
**/
int linphone_core_get_avpf_rr_interval(const LinphoneCore *lc){
return lp_config_get_int(lc->config,"rtp","avpf_rr_interval",5);
}
/**
* Set the avpf report interval in seconds.
* This value can be overriden by the proxy config using linphone_proxy_config_set_avpf_rr_interval().
* @param lc the core
* @param interval interval in seconds.
**/
void linphone_core_set_avpf_rr_interval(LinphoneCore *lc, int interval){
return lp_config_set_int(lc->config,"rtp","avpf_rr_interval",interval);
}
int linphone_payload_type_get_type(const LinphonePayloadType *pt) {
return pt->type;
......
......@@ -287,6 +287,20 @@ LINPHONE_PUBLIC char * linphone_payload_type_get_mime_type(const LinphonePayload
LINPHONE_PUBLIC int linphone_payload_type_get_channels(const LinphonePayloadType *pt);
/**
* Enum describing RTP AVPF activation modes.
**/
enum _LinphoneAVPFMode{
LinphoneAVPFDefault=-1, /**<Use default value defined at upper level*/
LinphoneAVPFDisabled, /**<AVPF is disabled*/
LinphoneAVPFEnabled /**<AVPF is enabled */
};
/**
* Enum describing RTP AVPF activation modes.
**/
typedef enum _LinphoneAVPFMode LinphoneAVPFMode;
/**
* Enum describing type of media encryption types.
**/
......@@ -1014,6 +1028,7 @@ LINPHONE_PUBLIC const char* linphone_proxy_config_get_file_transfer_server(const
* Indicates whether AVPF/SAVPF must be used for calls using this proxy config.
* @param[in] cfg #LinphoneProxyConfig object
* @param[in] enable True to enable AVPF/SAVF, false to disable it.
* @deprecated use linphone_proxy_config_set_avpf_mode()
*/
LINPHONE_PUBLIC void linphone_proxy_config_enable_avpf(LinphoneProxyConfig *cfg, bool_t enable);
......@@ -1021,6 +1036,7 @@ LINPHONE_PUBLIC void linphone_proxy_config_enable_avpf(LinphoneProxyConfig *cfg,
* Indicates whether AVPF/SAVPF is being used for calls using this proxy config.
* @param[in] cfg #LinphoneProxyConfig object
* @return True if AVPF/SAVPF is enabled, false otherwise.
* @deprecated use linphone_proxy_config_set_avpf_mode()
*/
LINPHONE_PUBLIC bool_t linphone_proxy_config_avpf_enabled(LinphoneProxyConfig *cfg);
......@@ -1038,6 +1054,20 @@ LINPHONE_PUBLIC void linphone_proxy_config_set_avpf_rr_interval(LinphoneProxyCon
*/
LINPHONE_PUBLIC uint8_t linphone_proxy_config_get_avpf_rr_interval(const LinphoneProxyConfig *cfg);
/**
* Get enablement status of RTCP feedback (also known as AVPF profile).
* @param[in] cfg the proxy config
* @return the enablement mode, which can be LinphoneAVPFDefault (use LinphoneCore's mode), LinphoneAVPFEnabled (avpf is enabled), or LinphoneAVPFDisabled (disabled).
**/
LINPHONE_PUBLIC LinphoneAVPFMode linphone_proxy_config_get_avpf_mode(const LinphoneProxyConfig *cfg);
/**
* Enable the use of RTCP feedback (also known as AVPF profile).
* @param[in] cfg the proxy config
* @param[in] mode the enablement mode, which can be LinphoneAVPFDefault (use LinphoneCore's mode), LinphoneAVPFEnabled (avpf is enabled), or LinphoneAVPFDisabled (disabled).
**/
LINPHONE_PUBLIC void linphone_proxy_config_set_avpf_mode(LinphoneProxyConfig *cfg, LinphoneAVPFMode mode);
/**
* @}
**/
......@@ -2895,6 +2925,12 @@ LINPHONE_PUBLIC void linphone_core_add_supported_tag(LinphoneCore *core, const c
LINPHONE_PUBLIC void linphone_core_remove_supported_tag(LinphoneCore *core, const char *tag);
LINPHONE_PUBLIC void linphone_core_set_avpf_mode(LinphoneCore *lc, LinphoneAVPFMode mode);
LINPHONE_PUBLIC LinphoneAVPFMode linphone_core_get_avpf_mode(const LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_get_avpf_rr_interval(const LinphoneCore *lc);
#ifdef __cplusplus
}
#endif
......
......@@ -103,7 +103,7 @@ struct _LinphoneCallParams{
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;
uint16_t avpf_rr_interval; /*in milliseconds*/
LinphonePrivacyMask privacy;
};
......@@ -461,16 +461,18 @@ struct _LinphoneProxyConfig
char *dial_prefix;
LinphoneRegistrationState state;
SalOp *publish_op;
LinphoneAVPFMode avpf_mode;
bool_t commit;
bool_t reg_sendregister;
bool_t publish;
bool_t dial_escape_plus;
bool_t send_publish;
bool_t quality_reporting_enabled;
bool_t avpf_enabled;
bool_t pad;
uint8_t avpf_rr_interval;
uint8_t quality_reporting_interval;
time_t deletion_date;
LinphonePrivacyMask privacy;
/*use to check if server config has changed between edit() and done()*/
......@@ -567,6 +569,7 @@ typedef struct rtp_config
int nortp_timeout;
int disable_upnp;
MSCryptoSuite *srtp_suites;
LinphoneAVPFMode avpf_mode;
bool_t rtp_no_xmit_on_audio_mute;
/* stop rtp xmit when audio muted */
bool_t audio_adaptive_jitt_comp_enabled;
......
......@@ -114,7 +114,7 @@ static void linphone_proxy_config_init(LinphoneCore* lc, LinphoneProxyConfig *ob
obj->quality_reporting_interval = lc ? lp_config_get_default_int(lc->config, "proxy", "quality_reporting_interval", 0) : 0;
obj->contact_params = contact_params ? ms_strdup(contact_params) : NULL;
obj->contact_uri_params = contact_uri_params ? ms_strdup(contact_uri_params) : NULL;
obj->avpf_enabled = lc ? lp_config_get_default_int(lc->config, "proxy", "avpf", 0) : 0;
obj->avpf_mode = lc ? lp_config_get_default_int(lc->config, "proxy", "avpf", LinphoneAVPFDefault) : LinphoneAVPFDefault;
obj->avpf_rr_interval = lc ? lp_config_get_default_int(lc->config, "proxy", "avpf_rr_interval", 5) : 5;
obj->publish_expires=-1;
}
......@@ -1286,7 +1286,7 @@ void linphone_proxy_config_write_to_config_file(LpConfig *config, LinphoneProxyC
lp_config_set_int(config,key,"reg_expires",obj->expires);
lp_config_set_int(config,key,"reg_sendregister",obj->reg_sendregister);
lp_config_set_int(config,key,"publish",obj->publish);
lp_config_set_int(config, key, "avpf", obj->avpf_enabled);
lp_config_set_int(config, key, "avpf", obj->avpf_mode);
lp_config_set_int(config, key, "avpf_rr_interval", obj->avpf_rr_interval);
lp_config_set_int(config,key,"dial_escape_plus",obj->dial_escape_plus);
lp_config_set_string(config,key,"dial_prefix",obj->dial_prefix);
......@@ -1338,7 +1338,7 @@ LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore* lc
CONFIGURE_INT_VALUE(cfg,config,key,expires,"reg_expires")
CONFIGURE_BOOL_VALUE(cfg,config,key,register,"reg_sendregister")
CONFIGURE_BOOL_VALUE(cfg,config,key,publish,"publish")
CONFIGURE_BOOL_VALUE(cfg,config,key,avpf,"avpf")
CONFIGURE_INT_VALUE(cfg,config,key,avpf_mode,"avpf")
CONFIGURE_INT_VALUE(cfg,config,key,avpf_rr_interval,"avpf_rr_interval")
CONFIGURE_INT_VALUE(cfg,config,key,dial_escape_plus,"dial_escape_plus")
CONFIGURE_STRING_VALUE(cfg,config,key,dial_prefix,"dial_prefix")
......@@ -1651,11 +1651,22 @@ int linphone_proxy_config_get_publish_expires(const LinphoneProxyConfig *obj) {
}
void linphone_proxy_config_enable_avpf(LinphoneProxyConfig *cfg, bool_t enable) {
cfg->avpf_enabled = enable;
cfg->avpf_mode=enable ? LinphoneAVPFEnabled : LinphoneAVPFDisabled;
}
bool_t linphone_proxy_config_avpf_enabled(LinphoneProxyConfig *cfg) {
return cfg->avpf_enabled;
if (cfg->avpf_mode==LinphoneAVPFDefault && cfg->lc){
return linphone_core_get_avpf_mode(cfg->lc)==LinphoneAVPFEnabled;
}
return cfg->avpf_mode == LinphoneAVPFEnabled;
}
LinphoneAVPFMode linphone_proxy_config_get_avpf_mode(const LinphoneProxyConfig *cfg){
return cfg->avpf_mode;
}
void linphone_proxy_config_set_avpf_mode(LinphoneProxyConfig *cfg, LinphoneAVPFMode mode){
cfg->avpf_mode=mode;
}
void linphone_proxy_config_set_avpf_rr_interval(LinphoneProxyConfig *cfg, uint8_t interval) {
......
mediastreamer2 @ 7d9de58a
Subproject commit ab0e9b39c5dc82fb04146fcc20843cc7fa361b6e
Subproject commit 7d9de58ac0848bcf91c58a127ad30e338314f296
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment