Change proxy following the location

This commit is contained in:
Yann Diorcet 2012-12-07 11:03:36 +01:00
parent 16bacbb877
commit df5bd8a4c7
2 changed files with 13 additions and 4 deletions

View file

@ -318,6 +318,7 @@ static NSString *const CONFIGURATION_HOME_AP_KEY = @"CONFIGURATION_HOME_AP_KEY";
- (void)reset {
valid = FALSE;
[homeAP release];
homeAP = nil;
[history removeAllObjects];
[outdoorStations removeAllObjects];
[users removeAllObjects];
@ -428,7 +429,7 @@ static NSString *const CONFIGURATION_HOME_AP_KEY = @"CONFIGURATION_HOME_AP_KEY";
}
- (NSMutableSet*)getHistory {
NSMutableSet *set;
NSMutableSet *set = nil;
NSString *url = ([self getCurrentRequestType] == BuschJaegerConfigurationRequestType_Local)? network.localHistory: network.globalHistory;
url = [self addUserNameAndPasswordToUrl:url];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:5];

View file

@ -1465,8 +1465,9 @@ static void audioRouteChangeListenerCallback (
NSString* domain = [[NSUserDefaults standardUserDefaults] stringForKey:@"domain_preference"];
NSString* accountPassword = [[NSUserDefaults standardUserDefaults] stringForKey:@"password_preference"];
//bool configCheckDisable = [[NSUserDefaults standardUserDefaults] boolForKey:@"check_config_disable_preference"];
bool isOutboundProxy= [[NSUserDefaults standardUserDefaults] boolForKey:@"outbound_proxy_preference"];
/* MODIFICATION always enable outbound*/
bool isOutboundProxy=TRUE;// [[NSUserDefaults standardUserDefaults] boolForKey:@"outbound_proxy_preference"];
/**/
//clear auth info list
linphone_core_clear_all_auth_info(theLinphoneCore);
@ -1476,7 +1477,14 @@ static void audioRouteChangeListenerCallback (
const char* identity = [[NSString stringWithFormat:@"sip:%@@%@",username,domain] cStringUsingEncoding:[NSString defaultCStringEncoding]];
const char* password = [accountPassword cStringUsingEncoding:[NSString defaultCStringEncoding]];
NSString* proxyAddress = [[NSUserDefaults standardUserDefaults] stringForKey:@"proxy_preference"];
/* MODIFICATION use config address */
NSString* proxyAddress = nil;// [[NSUserDefaults standardUserDefaults] stringForKey:@"proxy_preference"];
if([[LinphoneManager getWifiData] isEqualToData:configuration.homeAP]) {
proxyAddress = configuration.network.localAddress;
} else {
proxyAddress = configuration.network.globalAddress;
}
/**/
if ((!proxyAddress || [proxyAddress length] <1 ) && domain) {
proxyAddress = [NSString stringWithFormat:@"sip:%@",domain] ;
} else {