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

This commit is contained in:
Simon Morlat 2010-12-13 14:24:54 +01:00
commit e5e5c3637b
2 changed files with 33 additions and 13 deletions

View file

@ -65,9 +65,6 @@ public class TutorialRegistration implements LinphoneCoreListener {
*/
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg,RegistrationState cstate, String smessage) {
write(cfg.getIdentity() + " : "+smessage+"\n");
if (RegistrationState.RegistrationOk.equals(cstate))
running = false;
}
public void show(LinphoneCore lc) {}
@ -132,7 +129,6 @@ public class TutorialRegistration implements LinphoneCoreListener {
// main loop for receiving notifications and doing background linphonecore work
running = true;
while (running) {
@ -145,10 +141,37 @@ public class TutorialRegistration implements LinphoneCoreListener {
}
}
// Unregister then register again
lc.getDefaultProxyConfig().edit();
lc.getDefaultProxyConfig().enableRegister(false);
lc.getDefaultProxyConfig().done();
for (int i = 0; i < 20; i++) {
lc.iterate();
try{
Thread.sleep(50);
} catch(InterruptedException ie) {
write("Interrupted!\nAborting");
return;
}
}
lc.getDefaultProxyConfig().edit();
lc.getDefaultProxyConfig().enableRegister(true);
lc.getDefaultProxyConfig().done();
for (int i = 0; i < 20; i++) {
lc.iterate();
try{
Thread.sleep(50);
} catch(InterruptedException ie) {
write("Interrupted!\nAborting");
return;
}
}
// Automatic unregistration on exit
} finally {
write("Shutting down linphone...");
// You need to destroy the LinphoneCore object when no longer used

View file

@ -3662,16 +3662,13 @@ void sip_config_uninit(LinphoneCore *lc)
linphone_proxy_config_edit(cfg); /* to unregister */
}
if (lc->sal){
int i;
for (i=0;i<20;i++){
sal_iterate(lc->sal);
for (i=0;i<20;i++){
linphone_core_iterate(lc);
#ifndef WIN32
usleep(100000);
usleep(100000);
#else
Sleep(100);
Sleep(100);
#endif
}
}
ms_list_for_each(config->proxies,(void (*)(void*)) linphone_proxy_config_destroy);