mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 02:58:07 +00:00
enhanced IP network management
This commit is contained in:
parent
91bf45e205
commit
da95fb628d
4 changed files with 18 additions and 17 deletions
|
|
@ -371,7 +371,7 @@
|
|||
otherButtonTitles:nil];
|
||||
[error show];
|
||||
//[self performSelector:@selector(dismissAlertDialog:) withObject:error afterDelay:2];
|
||||
//[self performSelector:@selector(dismissIncallView) withObject:nil afterDelay:2];
|
||||
[self performSelector:@selector(dismissIncallView) withObject:nil afterDelay:2];
|
||||
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@
|
|||
/**
|
||||
* return true if register is activated
|
||||
*/
|
||||
bool networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void * info);
|
||||
void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void * info);
|
||||
|
||||
-(void) doRegister;
|
||||
-(void) doLinphoneConfiguration:(NSNotification *)notification;
|
||||
|
|
|
|||
|
|
@ -275,15 +275,17 @@ LinphoneCoreVTable linphonec_vtable = {
|
|||
}
|
||||
|
||||
-(void) kickOffNetworkConnection {
|
||||
ms_message("waiking up network connection");
|
||||
/*start a new thread to avoid blocking the main ui in case of peer host failure*/
|
||||
[NSThread detachNewThreadSelector:@selector(runNetworkConnection) toTarget:self withObject:nil];
|
||||
}
|
||||
-(void) runNetworkConnection {
|
||||
CFWriteStreamRef writeStream;
|
||||
CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"linphone.org", 15000, nil, &writeStream);
|
||||
CFStreamCreatePairWithSocketToHost(NULL, (CFStringRef)@"192.168.0.200"/*"linphone.org"*/, 15000, nil, &writeStream);
|
||||
CFWriteStreamOpen (writeStream);
|
||||
const char* buff="hello";
|
||||
CFWriteStreamWrite (writeStream,(const UInt8*)buff,strlen(buff));
|
||||
CFWriteStreamClose (writeStream);
|
||||
|
||||
}
|
||||
}
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
|
||||
if (myLinphoneCore == nil) {
|
||||
|
|
@ -406,6 +408,9 @@ extern void libmsilbc_init();
|
|||
}
|
||||
NSString* transport = [[NSUserDefaults standardUserDefaults] stringForKey:@"transport_preference"];
|
||||
|
||||
//initial state is network off should be done as soon as possible
|
||||
linphone_core_set_network_reachable(myLinphoneCore,false);
|
||||
|
||||
LCSipTransports transportValue;
|
||||
if (transport!=nil) {
|
||||
if (linphone_core_get_sip_transports(myLinphoneCore, &transportValue)) {
|
||||
|
|
@ -427,8 +432,7 @@ extern void libmsilbc_init();
|
|||
|
||||
|
||||
|
||||
//initial state is network off
|
||||
linphone_core_set_network_reachable(myLinphoneCore,false);
|
||||
|
||||
// Set audio assets
|
||||
NSBundle* myBundle = [NSBundle mainBundle];
|
||||
const char* lRing = [[myBundle pathForResource:@"oldphone-mono"ofType:@"wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
|
|
@ -657,22 +661,19 @@ extern void libmsilbc_init();
|
|||
|
||||
}
|
||||
|
||||
bool networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void * info) {
|
||||
void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void * info) {
|
||||
id<LinphoneTabManagerDelegate> linphoneDelegate=info;
|
||||
LinphoneCore* lc = [linphoneDelegate getLinphoneCore];
|
||||
bool result = false;
|
||||
|
||||
ms_message("Network connection flag [%x]",flags);
|
||||
if (lc != nil) {
|
||||
if ((flags == 0) | (flags & (kSCNetworkReachabilityFlagsConnectionRequired |kSCNetworkReachabilityFlagsConnectionOnTraffic))) {
|
||||
[linphoneDelegate kickOffNetworkConnection];
|
||||
}
|
||||
if (flags) {
|
||||
linphone_core_set_network_reachable(lc,true);
|
||||
result = true;
|
||||
} else {
|
||||
linphone_core_set_network_reachable(lc,false);
|
||||
result = false;
|
||||
} else {
|
||||
linphone_core_set_network_reachable(lc,true);
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ contact=sip:toto@unknown-host
|
|||
inc_timeout=15
|
||||
use_info=0
|
||||
use_ipv6=0
|
||||
register_only_when_network_is_up=0
|
||||
default_proxy=-1
|
||||
register_only_when_network_is_up=1
|
||||
auto_net_state_mon=0
|
||||
keepalive_period=3600000
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue