Merge branch 'master' of belledonne-communications.com:linphone-private

This commit is contained in:
Simon Morlat 2010-12-13 16:35:54 +01:00
commit f514eb5e80
4 changed files with 34 additions and 25 deletions

View file

@ -124,53 +124,40 @@ public class TutorialRegistration implements LinphoneCoreListener {
// create proxy config
LinphoneProxyConfig proxyCfg = lcFactory.createProxyConfig(sipAddress, domain, null, true);
proxyCfg.setExpires(2000);
lc.addProxyConfig(proxyCfg); // add it to linphone
lc.setDefaultProxyConfig(proxyCfg);
// main loop for receiving notifications and doing background linphonecore work
running = true;
while (running) {
lc.iterate(); // first iterate initiates registration
try{
Thread.sleep(50);
} catch(InterruptedException ie) {
write("Interrupted!\nAborting");
return;
}
sleep(50);
}
// Unregister then register again
// Unregister
lc.getDefaultProxyConfig().edit();
lc.getDefaultProxyConfig().enableRegister(false);
lc.getDefaultProxyConfig().done();
for (int i = 0; i < 20; i++) {
while(lc.getDefaultProxyConfig().getState() != RegistrationState.RegistrationCleared) {
lc.iterate();
try{
Thread.sleep(50);
} catch(InterruptedException ie) {
write("Interrupted!\nAborting");
return;
}
sleep(50);
}
// Then register again
lc.getDefaultProxyConfig().edit();
lc.getDefaultProxyConfig().enableRegister(true);
lc.getDefaultProxyConfig().done();
for (int i = 0; i < 20; i++) {
while(lc.getDefaultProxyConfig().getState() != RegistrationState.RegistrationOk
&& lc.getDefaultProxyConfig().getState() != RegistrationState.RegistrationFailed) {
lc.iterate();
try{
Thread.sleep(50);
} catch(InterruptedException ie) {
write("Interrupted!\nAborting");
return;
}
sleep(50);
}
// Automatic unregistration on exit
} finally {
write("Shutting down linphone...");
@ -179,6 +166,14 @@ public class TutorialRegistration implements LinphoneCoreListener {
}
}
private void sleep(int ms) {
try {
Thread.sleep(ms);
} catch(InterruptedException ie) {
write("Interrupted!\nAborting");
return;
}
}
public void stopMainLoop() {
running=false;

View file

@ -993,6 +993,7 @@ extern "C" void Java_org_linphone_core_LinphoneChatRoomImpl_sendMessage(JNIEnv*
}
<<<<<<< HEAD
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setVideoWindowId(JNIEnv* env
,jobject thiz
,jlong lc
@ -1083,5 +1084,11 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setDownloadBandwidth(JNI
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setUploadBandwidth(JNIEnv *env, jobject thiz, jlong lc, jint bw){
linphone_core_set_upload_bandwidth((LinphoneCore *)lc, (int) bw);
extern "C" int Java_org_linphone_core_LinphoneProxyConfigImpl_getState(JNIEnv* env,jobject thiz,jlong ptr) {
return (int) linphone_proxy_config_get_state((const LinphoneProxyConfig *) ptr);
}
extern "C" void Java_org_linphone_core_LinphoneProxyConfigImpl_setExpires(JNIEnv* env,jobject thiz,jlong ptr,jint delay) {
linphone_proxy_config_expires((LinphoneProxyConfig *) ptr, (int) delay);
}

View file

@ -126,4 +126,11 @@ public interface LinphoneProxyConfig {
public boolean publishEnabled();
LinphoneCore.RegistrationState getState();
/**
* Sets the registration expiration time.
* @param delay expiration time in seconds
*/
void setExpires(int delay);
}

@ -1 +1 @@
Subproject commit 28a6e7f22fbdd93a01676fc9cc47a2605c846d75
Subproject commit dbde0ad6f4b7a21f99d1e0e5a5ddd9bf6cfe4692