add linphone_core_enable_keep_alive

This commit is contained in:
Jehan Monnier 2011-01-24 16:38:29 +01:00
parent 407d88929a
commit 2b80393ff4
6 changed files with 52 additions and 2 deletions

View file

@ -4037,4 +4037,19 @@ const char *linphone_error_to_string(LinphoneReason err){
}
return "unknown error";
}
/**
* enable signaling keep alive
*/
void linphone_core_enable_keep_alive(LinphoneCore* lc,bool_t enable) {
if (enable > 0) {
sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period);
} else {
sal_set_keepalive_period(lc->sal,0);
}
}
/**
* Is signaling keep alive
*/
bool_t linphone_core_keep_alive_enabled(LinphoneCore* lc) {
return sal_get_keepalive_period(lc->sal) > 0;
}

View file

@ -919,6 +919,14 @@ void linphone_core_set_network_reachable(LinphoneCore* lc,bool_t value);
*/
bool_t linphone_core_is_network_reachabled(LinphoneCore* lc);
/**
* enable signaling keep alive. small udp packet sent periodically to keep udp NAT association
*/
void linphone_core_enable_keep_alive(LinphoneCore* lc,bool_t enable);
/**
* Is signaling keep alive
*/
bool_t linphone_core_keep_alive_enabled(LinphoneCore* lc);
void *linphone_core_get_user_data(LinphoneCore *lc);

View file

@ -614,8 +614,19 @@ extern "C" jstring Java_org_linphone_core_LinphoneCoreImpl_getRing(JNIEnv* env
return NULL;
}
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_enableKeepAlive(JNIEnv* env
,jobject thiz
,jlong lc
,jboolean enable) {
linphone_core_enable_keep_alive((LinphoneCore*)lc,enable);
}
extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isKeepAliveEnabled(JNIEnv* env
,jobject thiz
,jlong lc) {
return linphone_core_keep_alive_enabled((LinphoneCore*)lc);
}
//ProxyConfig
extern "C" jlong Java_org_linphone_core_LinphoneProxyConfigImpl_newLinphoneProxyConfig(JNIEnv* env,jobject thiz) {

View file

@ -249,6 +249,11 @@ ortp_socket_t sal_get_socket(Sal *ctx);
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);
/**
* returns keepalive period in ms
* 0 desactiaved
* */
unsigned int sal_get_keepalive_period(Sal *ctx);
void sal_use_session_timers(Sal *ctx, int expires);
void sal_use_one_matching_codec_policy(Sal *ctx, bool_t one_matching_codec);
int sal_iterate(Sal *sal);

View file

@ -1982,6 +1982,9 @@ void sal_set_keepalive_period(Sal *ctx,unsigned int value) {
ctx->keepalive_period=value;
eXosip_set_option (EXOSIP_OPT_UDP_KEEP_ALIVE, &value);
}
unsigned int sal_get_keepalive_period(Sal *ctx) {
return ctx->keepalive_period;
}
const char * sal_address_get_port(const SalAddress *addr) {
const osip_from_t *u=(const osip_from_t*)addr;

View file

@ -488,5 +488,13 @@ public interface LinphoneCore {
public VideoSize getPreferredVideoSize();
public PayloadType[] listVideoCodecs();
/**
* enable signaling keep alive. small udp packet sent periodically to keep udp NAT association
*/
void enableKeepAlive(boolean enable);
/**
* get keep elive mode
* @return true if enable
*/
boolean isKeepAliveEnabled();
}