Merge branch 'master' of git://git.linphone.org/linphone-iphone into buschjaeger_new_ui

Conflicts:
	Classes/ChatRoomViewController.m
	Classes/HistoryDetailsViewController.m
	Classes/IncomingCallViewController.m
	Classes/LinphoneCoreSettingsStore.m
	Classes/LinphoneUI/UICallCell.m
	Classes/LinphoneUI/UIChatCell.xib
	Classes/LinphoneUI/UIChatRoomCell.m
	Classes/LinphoneUI/UICompositeViewController.m
	Classes/PhoneMainView.h
	Classes/PhoneMainView.m
	Classes/SettingsViewController.m
	Resources/linphonerc-factory~ipad
	Settings.bundle/Advanced.plist
	Settings/InAppSettings.bundle/en.lproj/Network.strings
	Settings/InAppSettings.bundle/fr.lproj/Network.strings
	buschjaeger-Info.plist
	linphone.ldb/Contents.plist
	linphone.ldb/Resources/InAppSettings.bundle/Network/1/Network.strings
	linphone.xcodeproj/project.pbxproj
This commit is contained in:
Yann Diorcet 2012-12-04 11:59:31 +01:00
commit 6d631eb308
6 changed files with 72 additions and 24 deletions

View file

@ -55,10 +55,19 @@ extern NSString *const kLinphoneNetworkUpdate;
/**/
extern NSString *const kContactSipField;
typedef enum _NetworkType {
network_none = 0,
network_2g,
network_3g,
network_4g,
network_lte,
network_wifi
} NetworkType;
typedef enum _Connectivity {
wifi,
wwan
,none
wwan,
none
} Connectivity;
/* Application specific call context */
@ -141,6 +150,7 @@ typedef struct _LinphoneManagerSounds {
+ (NSString*)bundleFile:(NSString*)file;
+ (NSString*)documentFile:(NSString*)file;
- (void)acceptCall:(LinphoneCall *)call;
- (void)call:(NSString *)address displayName:(NSString*)displayName transfer:(BOOL)transfer;
- (void)lpConfigSetString:(NSString*)value forKey:(NSString*)key;
@ -165,6 +175,7 @@ typedef struct _LinphoneManagerSounds {
@property (readonly) FastAddressBook* fastAddressBook;
*/
@property Connectivity connectivity;
@property (readonly) NetworkType network;
@property (readonly) const char* frontCamId;
@property (readonly) const char* backCamId;
@property (readonly) sqlite3* database;

View file

@ -104,6 +104,7 @@ extern void libmsbcg729_init();
@implementation LinphoneManager
@synthesize connectivity;
@synthesize network;
@synthesize frontCamId;
@synthesize backCamId;
/* MODIFICATION: Add buschjaeger configuration */
@ -154,7 +155,7 @@ struct codec_name_pref_table codec_pref_table[]={
+ (NSSet *)unsupportedCodecs {
NSMutableSet *set = [NSMutableSet set];
for(int i=0;codec_pref_table[i].name!=NULL;++i) {
if(linphone_core_find_payload_type([LinphoneManager getLc],codec_pref_table[i].name
if(linphone_core_find_payload_type(theLinphoneCore,codec_pref_table[i].name
, codec_pref_table[i].rate,LINPHONE_FIND_PAYLOAD_IGNORE_CHANNELS) == NULL) {
[set addObject:codec_pref_table[i].prefname];
}
@ -423,7 +424,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char
/*should we reject this call ?*/
if ([lCTCallCenter currentCalls]!=nil) {
[LinphoneLogger logc:LinphoneLoggerLog format:"Mobile call ongoing... rejecting call from [%s]",linphone_address_get_username(linphone_call_get_call_log(call)->from)];
linphone_core_decline_call([LinphoneManager getLc], call,LinphoneReasonBusy);
linphone_core_decline_call(theLinphoneCore, call,LinphoneReasonBusy);
[lCTCallCenter release];
return;
}
@ -500,7 +501,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char
// Disable speaker when no more call
if ((state == LinphoneCallEnd || state == LinphoneCallError)) {
if(linphone_core_get_calls_nb([LinphoneManager getLc]) == 0) {
if(linphone_core_get_calls_nb(theLinphoneCore) == 0) {
[self setSpeakerEnabled:FALSE];
[self removeCTCallCenterCb];
}
@ -673,18 +674,18 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
LinphoneManager* lLinphoneMgr = [LinphoneManager instance];
SCNetworkReachabilityFlags networkDownFlags=kSCNetworkReachabilityFlagsConnectionRequired |kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand;
if ([LinphoneManager getLc] != nil) {
if (theLinphoneCore != nil) {
LinphoneProxyConfig* proxy;
linphone_core_get_default_proxy([LinphoneManager getLc], &proxy);
linphone_core_get_default_proxy(theLinphoneCore, &proxy);
struct NetworkReachabilityContext* ctx = nilCtx ? ((struct NetworkReachabilityContext*)nilCtx) : 0;
if ((flags == 0) || (flags & networkDownFlags)) {
linphone_core_set_network_reachable([LinphoneManager getLc],false);
linphone_core_set_network_reachable(theLinphoneCore, false);
lLinphoneMgr.connectivity = none;
[LinphoneManager kickOffNetworkConnection];
} else {
Connectivity newConnectivity;
BOOL isWifiOnly = lp_config_get_int(linphone_core_get_config([LinphoneManager getLc]), LINPHONERC_APPLICATION_KEY, "wifi_only_preference",FALSE);
BOOL isWifiOnly = lp_config_get_int(linphone_core_get_config(theLinphoneCore), LINPHONERC_APPLICATION_KEY, "wifi_only_preference",FALSE);
if (!ctx || ctx->testWWan)
newConnectivity = flags & kSCNetworkReachabilityFlagsIsWWAN ? wwan:wifi;
else
@ -704,11 +705,11 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
if (lLinphoneMgr.connectivity != newConnectivity) {
// connectivity has changed
linphone_core_set_network_reachable([LinphoneManager getLc],false);
linphone_core_set_network_reachable(theLinphoneCore,false);
if (newConnectivity == wwan && proxy && isWifiOnly) {
linphone_proxy_config_expires(proxy, 0);
}
linphone_core_set_network_reachable([LinphoneManager getLc],true);
linphone_core_set_network_reachable(theLinphoneCore,true);
[LinphoneLogger logc:LinphoneLoggerLog format:"Network connectivity changed to type [%s]",(newConnectivity==wifi?"wifi":"wwan")];
[lLinphoneMgr waitForRegisterToArrive];
}
@ -755,6 +756,21 @@ void networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReach
}
}
- (NetworkType)network {
UIApplication *app = [UIApplication sharedApplication];
NSArray *subviews = [[[app valueForKey:@"statusBar"] valueForKey:@"foregroundView"] subviews];
NSNumber *dataNetworkItemView = nil;
for (id subview in subviews) {
if([subview isKindOfClass:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]]) {
dataNetworkItemView = subview;
break;
}
}
NSNumber *number = (NSNumber*)[dataNetworkItemView valueForKey:@"dataNetworkType"];
return [number intValue];
}
#pragma mark -
@ -952,10 +968,10 @@ static int comp_call_id(const LinphoneCall* call , const char *callid) {
- (void)acceptCallForCallId:(NSString*)callid {
//first, make sure this callid is not already involved in a call
if ([LinphoneManager isLcReady]) {
MSList* calls = (MSList*)linphone_core_get_calls([LinphoneManager getLc]);
MSList* calls = (MSList*)linphone_core_get_calls(theLinphoneCore);
MSList* call = ms_list_find_custom(calls, (MSCompareFunc)comp_call_id, [callid UTF8String]);
if (call != NULL) {
linphone_core_accept_call(theLinphoneCore, (LinphoneCall*)call->data);
[self acceptCall:(LinphoneCall*)call->data];
return;
};
}
@ -964,7 +980,7 @@ static int comp_call_id(const LinphoneCall* call , const char *callid) {
- (void)enableAutoAnswerForCallId:(NSString*) callid {
//first, make sure this callid is not already involved in a call
if ([LinphoneManager isLcReady]) {
MSList* calls = (MSList*)linphone_core_get_calls([LinphoneManager getLc]);
MSList* calls = (MSList*)linphone_core_get_calls(theLinphoneCore);
if (ms_list_find_custom(calls, (MSCompareFunc)comp_call_id, [callid UTF8String])) {
[LinphoneLogger log:LinphoneLoggerWarning format:@"Call id [%@] already handled",callid];
return;
@ -1167,6 +1183,18 @@ static void audioRouteChangeListenerCallback (
#pragma mark - Call Functions
- (void)acceptCall:(LinphoneCall *)call {
LinphoneCallParams* lcallParams = linphone_core_create_default_call_parameters(theLinphoneCore);
if([self lpConfigBoolForKey:@"edge_opt_preference"]) {
bool low_bandwidth = self.network == network_2g;
if(low_bandwidth) {
[LinphoneLogger log:LinphoneLoggerDebug format:@"Low bandwidth mode"];
}
linphone_call_params_enable_low_bandwidth(lcallParams, low_bandwidth);
}
linphone_core_accept_call_with_params(theLinphoneCore,call, lcallParams);
}
- (void)call:(NSString *)address displayName:(NSString*)displayName transfer:(BOOL)transfer {
if (!linphone_core_is_network_reachable(theLinphoneCore)) {
UIAlertView* error = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Network Error",nil)
@ -1196,8 +1224,15 @@ static void audioRouteChangeListenerCallback (
LinphoneProxyConfig* proxyCfg;
//get default proxy
linphone_core_get_default_proxy([LinphoneManager getLc],&proxyCfg);
LinphoneCallParams* lcallParams = linphone_core_create_default_call_parameters([LinphoneManager getLc]);
linphone_core_get_default_proxy(theLinphoneCore,&proxyCfg);
LinphoneCallParams* lcallParams = linphone_core_create_default_call_parameters(theLinphoneCore);
if([self lpConfigBoolForKey:@"edge_opt_preference"]) {
bool low_bandwidth = self.network == network_2g;
if(low_bandwidth) {
[LinphoneLogger log:LinphoneLoggerDebug format:@"Low bandwidth mode"];
}
linphone_call_params_enable_low_bandwidth(lcallParams, low_bandwidth);
}
LinphoneCall* call=NULL;
if ([address length] == 0) return; //just return
@ -1207,9 +1242,9 @@ static void audioRouteChangeListenerCallback (
linphone_address_set_display_name(linphoneAddress,[displayName cStringUsingEncoding:[NSString defaultCStringEncoding]]);
}
if(transfer) {
linphone_core_transfer_call([LinphoneManager getLc], linphone_core_get_current_call([LinphoneManager getLc]), [address cStringUsingEncoding:[NSString defaultCStringEncoding]]);
linphone_core_transfer_call(theLinphoneCore, linphone_core_get_current_call(theLinphoneCore), [address cStringUsingEncoding:[NSString defaultCStringEncoding]]);
} else {
call=linphone_core_invite_address_with_params([LinphoneManager getLc], linphoneAddress, lcallParams);
call=linphone_core_invite_address_with_params(theLinphoneCore, linphoneAddress, lcallParams);
}
linphone_address_destroy(linphoneAddress);
} else if (proxyCfg==nil){
@ -1222,16 +1257,16 @@ static void audioRouteChangeListenerCallback (
[error release];
} else {
char normalizedUserName[256];
LinphoneAddress* linphoneAddress = linphone_address_new(linphone_core_get_identity([LinphoneManager getLc]));
LinphoneAddress* linphoneAddress = linphone_address_new(linphone_core_get_identity(theLinphoneCore));
linphone_proxy_config_normalize_number(proxyCfg,[address cStringUsingEncoding:[NSString defaultCStringEncoding]],normalizedUserName,sizeof(normalizedUserName));
linphone_address_set_username(linphoneAddress, normalizedUserName);
if(displayName!=nil) {
linphone_address_set_display_name(linphoneAddress, [displayName cStringUsingEncoding:[NSString defaultCStringEncoding]]);
}
if(transfer) {
linphone_core_transfer_call([LinphoneManager getLc], linphone_core_get_current_call([LinphoneManager getLc]), normalizedUserName);
linphone_core_transfer_call(theLinphoneCore, linphone_core_get_current_call(theLinphoneCore), normalizedUserName);
} else {
call=linphone_core_invite_address_with_params([LinphoneManager getLc], linphoneAddress, lcallParams);
call=linphone_core_invite_address_with_params(theLinphoneCore, linphoneAddress, lcallParams);
}
linphone_address_destroy(linphoneAddress);
}

View file

@ -27,6 +27,7 @@ firewall_policy=0
[app]
rotation_preference=auto
animations_preference=1
edge_opt_preference=0
[default_values]
reg_expires=600

View file

@ -6,8 +6,8 @@ home_upload_bw=380
out_download_bw=200
out_upload_bw=200
mtu=1300
activate_edge_workarounds=1
edge_ping_time=200
activate_edge_workarounds=0
edge_ping_time=10
edge_bw=10
[sip]

View file

@ -26,6 +26,7 @@ firewall_policy=0
[app]
rotation_preference=auto
animations_preference=1
edge_opt_preference=0
[default_values]
reg_expires=600

@ -1 +1 @@
Subproject commit 362d77908ae82c67eb61f5038ff048f9125984b5
Subproject commit 3c4bd90ba3ebbfd600a3180d45a4514e8f641e5d