diff --git a/Classes/PhoneViewController.m b/Classes/PhoneViewController.m index 9cd9ae6d0..7a6277b77 100644 --- a/Classes/PhoneViewController.m +++ b/Classes/PhoneViewController.m @@ -72,6 +72,15 @@ -(IBAction) doAction:(id)sender { if (sender == call) { + if (!linphone_core_is_network_reachabled(mCore)) { + UIAlertView* error = [[UIAlertView alloc] initWithTitle:@"Network Error" + message:@"There is no network connection available, enable WIFI or WWAN prior to place a call" + delegate:nil + cancelButtonTitle:@"Continue" + otherButtonTitles:nil]; + [error show]; + return; + } if (!linphone_core_in_call(mCore)) { LinphoneProxyConfig* proxyCfg; //get default proxy @@ -83,9 +92,9 @@ } else if ( proxyCfg==nil){ UIAlertView* error = [[UIAlertView alloc] initWithTitle:@"Invalid sip address" message:@"Either configure a SIP proxy server from settings prior to place a call or use a valid sip address (I.E sip:john@example.net)" - delegate:nil - cancelButtonTitle:@"Continue" - otherButtonTitles:nil]; + delegate:nil + cancelButtonTitle:@"Continue" + otherButtonTitles:nil]; [error show]; } else { diff --git a/Classes/linphoneAppDelegate.m b/Classes/linphoneAppDelegate.m index e980f477b..51fff82dd 100644 --- a/Classes/linphoneAppDelegate.m +++ b/Classes/linphoneAppDelegate.m @@ -23,7 +23,6 @@ #import "AddressBook/ABPerson.h" #import #import -#import "osip2/osip.h" #import "ConsoleViewController.h" #import "MoreViewController.h" @@ -239,6 +238,9 @@ extern void libmsilbc_init(); , [factoryConfig cStringUsingEncoding:[NSString defaultCStringEncoding]] ,self); + //initial state is network off + linphone_core_set_network_reachable(myLinphoneCore,false); + // Set audio assets const char* lRing = [[myBundle pathForResource:@"oldphone-mono"ofType:@"wav"] cStringUsingEncoding:[NSString defaultCStringEncoding]]; linphone_core_set_ring(myLinphoneCore, lRing ); @@ -283,18 +285,18 @@ extern void libmsilbc_init(); proxyCfg = linphone_proxy_config_new(); // add username password - osip_from_t *from; + LinphoneAddress *from = linphone_address_new(identity); LinphoneAuthInfo *info; - osip_from_init(&from); - if (osip_from_parse(from,identity)==0){ - info=linphone_auth_info_new(from->url->username,NULL,password,NULL,NULL); + if (from !=0){ + info=linphone_auth_info_new(linphone_address_get_username(from),NULL,password,NULL,NULL); linphone_core_add_auth_info(myLinphoneCore,info); } - osip_from_free(from); + linphone_address_destroy(from); // configure proxy entries linphone_proxy_config_set_identity(proxyCfg,identity); linphone_proxy_config_set_server_addr(proxyCfg,proxy); + linphone_proxy_config_enable_register(proxyCfg,true); if (isOutboundProxy) linphone_proxy_config_set_route(proxyCfg,proxy); @@ -311,8 +313,7 @@ extern void libmsilbc_init(); LinphoneAddress* addr=linphone_address_new(linphone_proxy_config_get_addr(proxyCfg)); proxyReachability=SCNetworkReachabilityCreateWithName(nil, linphone_address_get_domain(addr)); proxyReachabilityContext.info=self; - bool result=SCNetworkReachabilitySetCallback(proxyReachability, (SCNetworkReachabilityCallBack)networkReachabilityCallBack,&proxyReachabilityContext); - SCNetworkReachabilityScheduleWithRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + [self doRegister]; } else if (configCheckDisable == false) { UIAlertView* error = [[UIAlertView alloc] initWithTitle:@"Warning" @@ -321,7 +322,13 @@ extern void libmsilbc_init(); cancelButtonTitle:@"Continue" otherButtonTitles:@"Never remind",nil]; [error show]; + proxyReachability=SCNetworkReachabilityCreateWithName(nil, @"linphone.org"); + } + + SCNetworkReachabilitySetCallback(proxyReachability, (SCNetworkReachabilityCallBack)networkReachabilityCallBack,&proxyReachabilityContext); + SCNetworkReachabilityScheduleWithRunLoop(proxyReachability, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); + //Configure Codecs PayloadType *pt; @@ -441,26 +448,22 @@ extern void libmsilbc_init(); } bool networkReachabilityCallBack(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void * info) { - LinphoneProxyConfig* proxyCfg; id linphoneDelegate=info; - if (linphone_core_get_default_proxy([linphoneDelegate getLinphoneCore],&proxyCfg)) { - //glob, no default proxy - return false; - } - linphone_proxy_config_edit(proxyCfg); + LinphoneCore* lc = [linphoneDelegate getLinphoneCore]; bool result = false; - if ((flags == 0) | (flags & (kSCNetworkReachabilityFlagsConnectionRequired |kSCNetworkReachabilityFlagsConnectionOnTraffic))) { - [linphoneDelegate kickOffNetworkConnection]; + + 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; + } } - 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; } -(LinphoneCore*) getLinphoneCore { diff --git a/Resources/icone-linphone-512.png b/Resources/icone-linphone-512.png new file mode 100644 index 000000000..511cb49f4 Binary files /dev/null and b/Resources/icone-linphone-512.png differ diff --git a/Resources/icone-linphone-57.png b/Resources/icone-linphone-57.png new file mode 100644 index 000000000..1f7378831 Binary files /dev/null and b/Resources/icone-linphone-57.png differ diff --git a/linphone-Info.plist b/linphone-Info.plist index 32b3069cc..c8a08bd38 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -28,5 +28,10 @@ 3.1.2 NSMainNibFile PhoneMainView + UIRequiredDeviceCapabilities + + wifi + microphone + diff --git a/linphonerc b/linphonerc index 30522d6c0..a3ce7dc34 100644 --- a/linphonerc +++ b/linphonerc @@ -7,12 +7,13 @@ mtu=0 [sip] sip_port=5060 guess_hostname=1 -contact=sip:jehanmonnier@unknown-host +contact=sip:toto@unknown-host inc_timeout=15 use_info=0 use_ipv6=0 register_only_when_network_is_up=0 default_proxy=-1 +auto_net_state_mon=0 [rtp] audio_rtp_port=7076 @@ -26,43 +27,4 @@ playback_dev_id=AU: Audio Unit ringer_dev_id=AU: Audio Unit capture_dev_id=AU: Audio Unit -[audio_codec_0] -mime=speex -rate=32000 -enabled=0 - -[audio_codec_1] -mime=speex -rate=16000 -enabled=0 - -[audio_codec_2] -mime=speex -rate=8000 -enabled=0 - -[audio_codec_3] -mime=GSM -rate=22050 -enabled=0 - -[audio_codec_4] -mime=GSM -rate=11025 -enabled=0 - -[audio_codec_5] -mime=GSM -rate=8000 -enabled=0 - -[audio_codec_6] -mime=PCMU -rate=8000 -enabled=0 - -[audio_codec_7] -mime=PCMA -rate=8000 -enabled=0