Commit e0c3a7ca authored by jehan's avatar jehan

enhanced network connection

parent 2e8e74bd
......@@ -226,6 +226,12 @@
return self;
}
*/
- (void)viewDidAppear:(BOOL)animated {
[[UIApplication sharedApplication] setIdleTimerDisabled:true];
}
- (void)viewDidDisappear:(BOOL)animated {
[[UIApplication sharedApplication] setIdleTimerDisabled:false];
}
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
......@@ -331,7 +337,8 @@
case GSTATE_CALL_IN_CONNECTED:
case GSTATE_CALL_OUT_CONNECTED: {
[self muteAction:false];
[self speakerAction:false];
// test if speaker must be unactivated after ring tone
if (!isSpeaker) [self speakerAction:false];
const LinphoneAddress* callAddress = linphone_core_get_remote_uri(mCore);
const char* callDisplayName = linphone_address_get_display_name(callAddress)?linphone_address_get_display_name(callAddress):"";
......@@ -344,10 +351,10 @@
}
// start scheduler
durationRefreasher = [NSTimer scheduledTimerWithTimeInterval:1
target:self
selector:@selector(updateCallDuration)
userInfo:nil
repeats:YES];
target:self
selector:@selector(updateCallDuration)
userInfo:nil
repeats:YES];
[address setHidden:true];
[incallView setHidden:false];
[call setEnabled:false];
......
......@@ -20,6 +20,7 @@
#import <UIKit/UIKit.h>
#import <AddressBookUI/ABPeoplePickerNavigationController.h>
#import <SystemConfiguration/SCNetworkReachability.h>
#include"linphonecore.h"
......@@ -45,7 +46,9 @@
bool isDebug;
LinphoneCore* myLinphoneCore;
SCNetworkReachabilityContext proxyReachabilityContext;
SCNetworkReachabilityRef proxyReachability;
}
/**********************************
......@@ -63,6 +66,10 @@
-(PayloadType*) findPayload:(NSString*)type withRate:(int)rate from:(const MSList*)list;
/**
* return true if register is activated
*/
bool networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void * info);
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController* myTabBarController;
......
......@@ -151,6 +151,8 @@ LinphoneCoreVTable linphonec_vtable = {
[myPhoneViewController setLinphoneCore: myLinphoneCore];
[ [UIDevice currentDevice] setProximityMonitoringEnabled:true];
}
-(void)selectDialerTab {
......@@ -262,10 +264,18 @@ LinphoneCoreVTable linphonec_vtable = {
}
linphone_proxy_config_set_dial_escape_plus(proxyCfg,TRUE);
linphone_proxy_config_enable_register(proxyCfg, TRUE);
linphone_core_add_proxy_config(myLinphoneCore,proxyCfg);
//set to default proxy
linphone_core_set_default_proxy(myLinphoneCore,proxyCfg);
LinphoneAddress* addr=linphone_address_new(linphone_proxy_config_get_addr(proxyCfg));
proxyReachability=SCNetworkReachabilityCreateWithName(nil, linphone_address_get_domain(addr));
proxyReachabilityContext.info=myLinphoneCore;
bool result=SCNetworkReachabilitySetCallback(proxyReachability, networkReachabilityCallBack,&proxyReachabilityContext);
SCNetworkReachabilityFlags reachabilityFlags;
result=SCNetworkReachabilityGetFlags (proxyReachability,&reachabilityFlags);
SCNetworkReachabilityScheduleWithRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
}
//Configure Codecs
......@@ -316,6 +326,7 @@ LinphoneCoreVTable linphonec_vtable = {
}
// start scheduler
[NSTimer scheduledTimerWithTimeInterval:0.1
target:self
......@@ -366,5 +377,21 @@ LinphoneCoreVTable linphonec_vtable = {
}
bool networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void * info) {
LinphoneProxyConfig* proxyCfg;
linphone_core_get_default_proxy((LinphoneCore*)info,&proxyCfg);
linphone_proxy_config_edit(proxyCfg);
bool result = false;
if (flags) {
// register whatever connection type
linphone_proxy_config_enable_register(proxyCfg,TRUE);
result = true;
} else {
linphone_proxy_config_enable_register(proxyCfg,false);
result = false;
}
linphone_proxy_config_done(proxyCfg);
return result;
}
@end
......@@ -4,6 +4,8 @@
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>UIRequiresPersistentWiFi</key>
<true/>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
......@@ -24,8 +26,6 @@
<string>1.0</string>
<key>CFBundleShortVersionString</key>
<string>3.1.2</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>
<string>PhoneMainView</string>
</dict>
......
......@@ -31,6 +31,7 @@
2245667A10768B9000F10948 /* linphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 2245667910768B9000F10948 /* linphone.png */; };
2245671D107699F700F10948 /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 2245671C107699F700F10948 /* Settings.bundle */; };
224567C2107B968500F10948 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 224567C1107B968500F10948 /* AVFoundation.framework */; };
2264B6D211200342002C2C53 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2264B6D111200342002C2C53 /* SystemConfiguration.framework */; };
2273785E10A3703300526073 /* libmsiounit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2273785D10A3703300526073 /* libmsiounit.a */; };
2273798810A48EF000526073 /* oldphone.wav in Resources */ = {isa = PBXBuildFile; fileRef = 2273798710A48EF000526073 /* oldphone.wav */; };
2274401A106F31BD006EC466 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22744019106F31BD006EC466 /* CoreAudio.framework */; };
......@@ -200,6 +201,7 @@
2245667910768B9000F10948 /* linphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = linphone.png; path = ../linphone/pixmaps/linphone.png; sourceTree = SOURCE_ROOT; };
2245671C107699F700F10948 /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; };
224567C1107B968500F10948 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
2264B6D111200342002C2C53 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
2273785D10A3703300526073 /* libmsiounit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmsiounit.a; path = "../liblinphone-sdk/armv6-apple-darwin/lib/mediastreamer/plugins/libmsiounit.a"; sourceTree = SOURCE_ROOT; };
2273798710A48EF000526073 /* oldphone.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = oldphone.wav; path = rings/oldphone.wav; sourceTree = "<group>"; };
22744019106F31BD006EC466 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
......@@ -258,6 +260,7 @@
2273785E10A3703300526073 /* libmsiounit.a in Frameworks */,
22B5EFA310CE50BD00777D97 /* AddressBookUI.framework in Frameworks */,
22B5F03510CE6B2F00777D97 /* AddressBook.framework in Frameworks */,
2264B6D211200342002C2C53 /* SystemConfiguration.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -532,6 +535,7 @@
22F51EF5107FA66500F98953 /* untitled.plist */,
22B5EFA210CE50BD00777D97 /* AddressBookUI.framework */,
22B5F03410CE6B2F00777D97 /* AddressBook.framework */,
2264B6D111200342002C2C53 /* SystemConfiguration.framework */,
);
name = CustomTemplate;
sourceTree = "<group>";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment