lc->sip_conf.ping_with_options=lp_config_get_int(lc->config,"sip","ping_with_options",1);
lc->sip_conf.auto_net_state_mon=lp_config_get_int(lc->config,"sip","auto_net_state_mon",1);
lc->sip_conf.keepalive_period=lp_config_get_int(lc->config,"sip","keepalive_period",10000);
- sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period);
+ lc->sip_conf.tcp_tls_keepalive=lp_config_get_int(lc->config,"sip","tcp_tls_keepalive",0);
+ linphone_core_enable_keep_alive(lc, (lc->sip_conf.keepalive_period > 0));
sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0));
sal_use_double_registrations(lc->sal,lp_config_get_int(lc->config,"sip","use_double_registrations",1));
sal_use_dates(lc->sal,lp_config_get_int(lc->config,"sip","put_date",0));
*/
void linphone_core_enable_keep_alive(LinphoneCore* lc,bool_t enable) {
if (enable > 0) {
+ sal_use_tcp_tls_keepalive(lc->sal,lc->sip_conf.tcp_tls_keepalive);
sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period);
} else {
sal_set_keepalive_period(lc->sal,0);
bool_t register_only_when_network_is_up;
bool_t ping_with_options;
bool_t auto_net_state_mon;
+ bool_t tcp_tls_keepalive;
} sip_config_t;
typedef struct rtp_config
void sal_set_user_agent(Sal *ctx, const char *user_agent);
/*keepalive period in ms*/
void sal_set_keepalive_period(Sal *ctx,unsigned int value);
+void sal_use_tcp_tls_keepalive(Sal *ctx, bool_t enabled);
/**
* returns keepalive period in ms
* 0 desactiaved
bool_t ipv6;
int proto=IPPROTO_UDP;
int keepalive = ctx->keepalive_period;
-
+
+ ctx->transport = tr;
switch (tr) {
case SalTransportUDP:
proto=IPPROTO_UDP;
case SalTransportTCP:
case SalTransportTLS:
proto= IPPROTO_TCP;
- keepalive=-1;
+ if (!ctx->tcp_tls_keepalive) keepalive=-1;
eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE,&keepalive);
set_tls_options(ctx);
break;
osip_from_free((osip_from_t*)u);
}
+void sal_use_tcp_tls_keepalive(Sal *ctx, bool_t enabled) {
+ ctx->tcp_tls_keepalive = enabled;
+}
+
void sal_set_keepalive_period(Sal *ctx,unsigned int value) {
- ctx->keepalive_period=value;
- eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &value);
+ switch (ctx->transport) {
+ case SalTransportUDP:
+ ctx->keepalive_period = value;
+ break;
+ case SalTransportTCP:
+ case SalTransportTLS:
+ if (ctx->tcp_tls_keepalive) ctx->keepalive_period = value;
+ else ctx->keepalive_period = -1;
+ break;
+ default:
+ break;
+ }
+ eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &ctx->keepalive_period);
}
unsigned int sal_get_keepalive_period(Sal *ctx) {
return ctx->keepalive_period;
struct Sal{
SalCallbacks callbacks;
+ SalTransport transport;
MSList *calls; /*MSList of SalOp */
MSList *registers;/*MSList of SalOp */
MSList *out_subscribes;/*MSList of SalOp */
bool_t verify_server_cn;
bool_t expire_old_contact;
bool_t add_dates;
+ bool_t tcp_tls_keepalive;
};
struct SalOp{