forked from mirrors/linphone-iphone
Progress commit: switching to multitransport
This commit is contained in:
parent
a23db83456
commit
d1cb692efa
11 changed files with 733 additions and 674 deletions
|
|
@ -76,7 +76,6 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
LinphoneCore *lc=[LinphoneManager getLc];
|
||||
LinphoneProxyConfig *cfg=NULL;
|
||||
linphone_core_get_default_proxy(lc,&cfg);
|
||||
LinphoneTransportType transport = LinphoneTransportUdp;
|
||||
if (cfg){
|
||||
const char *identity=linphone_proxy_config_get_identity(cfg);
|
||||
LinphoneAddress *addr=linphone_address_new(identity);
|
||||
|
|
@ -84,57 +83,46 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
const char *proxy=linphone_proxy_config_get_addr(cfg);
|
||||
LinphoneAddress *proxy_addr=linphone_address_new(proxy);
|
||||
int port=linphone_address_get_port(proxy_addr);
|
||||
transport = linphone_address_get_transport(proxy_addr);
|
||||
|
||||
[self setString: linphone_address_get_username(addr) forKey:@"username_preference"];
|
||||
[self setString: linphone_address_get_domain(addr) forKey:@"domain_preference"];
|
||||
[self setInteger: linphone_proxy_config_get_expires(cfg) forKey:@"expire_preference"];
|
||||
[self setString: linphone_proxy_config_get_dial_prefix(cfg) forKey:@"prefix_preference"];
|
||||
if (strcmp(linphone_address_get_domain(addr),linphone_address_get_domain(proxy_addr))!=0
|
||||
|| port>0){
|
||||
if (strcmp(linphone_address_get_domain(addr),linphone_address_get_domain(proxy_addr))!=0 || port>0){
|
||||
char tmp[256]={0};
|
||||
if (port>0) {
|
||||
snprintf(tmp,sizeof(tmp)-1,"%s:%i",linphone_address_get_domain(proxy_addr),port);
|
||||
}else snprintf(tmp,sizeof(tmp)-1,"%s",linphone_address_get_domain(proxy_addr));
|
||||
[self setString: tmp forKey:@"proxy_preference"];
|
||||
[self setString:tmp forKey:@"proxy_preference"];
|
||||
}
|
||||
|
||||
linphone_address_destroy(addr);
|
||||
const char* tname = "udp";
|
||||
switch (linphone_address_get_transport(proxy_addr)) {
|
||||
case LinphoneTransportTcp: tname = "tcp"; break;
|
||||
case LinphoneTransportTls: tname = "tls"; break;
|
||||
default: break;
|
||||
}
|
||||
[self setString:tname forKey:@"transport_preference"];
|
||||
|
||||
linphone_address_destroy(addr);
|
||||
linphone_address_destroy(proxy_addr);
|
||||
|
||||
|
||||
[self setBool: (linphone_proxy_config_get_route(cfg)!=NULL) forKey:@"outbound_proxy_preference"];
|
||||
[self setBool:linphone_proxy_config_get_dial_escape_plus(cfg) forKey:@"substitute_+_by_00_preference"];
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
[self setInteger: lp_config_get_int(linphone_core_get_config(lc),"default_values","reg_expires", 600) forKey:@"expire_preference"];
|
||||
[self setObject:@"" forKey:@"username_preference"];
|
||||
[self setObject:@"" forKey:@"domain_preference"];
|
||||
[self setObject:@"" forKey:@"proxy_preference"];
|
||||
[self setObject:@"" forKey:@"password_preference"];
|
||||
[self setBool:FALSE forKey:@"outbound_proxy_preference"];
|
||||
[self setObject:@"" forKey:@"username_preference"];
|
||||
[self setObject:@"" forKey:@"domain_preference"];
|
||||
[self setObject:@"" forKey:@"proxy_preference"];
|
||||
[self setObject:@"" forKey:@"password_preference"];
|
||||
[self setBool:FALSE forKey:@"outbound_proxy_preference"];
|
||||
[self setString:"udp" forKey:@"transport_preference"];
|
||||
|
||||
}
|
||||
{
|
||||
LCSipTransports tp;
|
||||
linphone_core_get_sip_transports(lc, &tp);
|
||||
const char *tname = "udp";
|
||||
int port = 5060;
|
||||
switch( transport ){
|
||||
case LinphoneTransportUdp:
|
||||
case LinphoneTransportDtls: tname = "udp"; port = tp.udp_port; break;
|
||||
case LinphoneTransportTcp: tname = "tcp"; port = tp.tcp_port;break;
|
||||
case LinphoneTransportTls: tname = "tls"; port = tp.tls_port;break;
|
||||
}
|
||||
|
||||
[self setString:tname forKey:@"transport_preference"];
|
||||
[self setInteger:port forKey:@"port_preference"];
|
||||
|
||||
[self setInteger:lp_config_get_int(linphone_core_get_config(lc),LINPHONERC_APPLICATION_KEY,"random_port_preference", 1) forKey:@"random_port_preference"];
|
||||
}
|
||||
|
||||
|
||||
BOOL push_notif = lp_config_get_int(linphone_core_get_config(lc), LINPHONERC_APPLICATION_KEY, "pushnotification_preference", 0);
|
||||
[self setBool:push_notif forKey:@"pushnotification_preference"];
|
||||
[self setBool:lp_config_get_int(linphone_core_get_config(lc), LINPHONERC_APPLICATION_KEY, "pushnotification_preference", 0) forKey:@"pushnotification_preference"];
|
||||
{
|
||||
LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed(lc);
|
||||
if(parsed != NULL) {
|
||||
|
|
@ -162,20 +150,24 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
}
|
||||
}
|
||||
{
|
||||
[self setInteger: linphone_core_get_upload_bandwidth(lc) forKey:@"upload_bandwidth_preference"];
|
||||
[self setInteger: linphone_core_get_upload_bandwidth(lc) forKey:@"upload_bandwidth_preference"];
|
||||
[self setInteger: linphone_core_get_download_bandwidth(lc) forKey:@"download_bandwidth_preference"];
|
||||
}
|
||||
{
|
||||
[self setFloat:linphone_core_get_playback_gain_db(lc) forKey:@"playback_gain_preference"];
|
||||
[self setFloat:linphone_core_get_mic_gain_db(lc) forKey:@"microphone_gain_preference"];
|
||||
[self setFloat:linphone_core_get_mic_gain_db(lc) forKey:@"microphone_gain_preference"];
|
||||
}
|
||||
|
||||
{
|
||||
int port = lp_config_get_int(linphone_core_get_config(lc), LINPHONERC_APPLICATION_KEY, "port_preference", 5060);
|
||||
[self setInteger:port forKey:@"port_preference"];
|
||||
[self setInteger:lp_config_get_int(linphone_core_get_config(lc),LINPHONERC_APPLICATION_KEY,"random_port_preference", 1) forKey:@"random_port_preference"];
|
||||
}
|
||||
{
|
||||
LinphoneAuthInfo *ai;
|
||||
const MSList *elem=linphone_core_get_auth_info_list(lc);
|
||||
if (elem && (ai=(LinphoneAuthInfo*)elem->data)){
|
||||
[self setString: linphone_auth_info_get_passwd(ai) forKey:@"password_preference"];
|
||||
[self setString: linphone_auth_info_get_ha1(ai) forKey:@"password_ha1_preference"];
|
||||
[self setString: linphone_auth_info_get_ha1(ai) forKey:@"ha1_preference"]; // hidden but useful if provisioned
|
||||
}
|
||||
}
|
||||
{
|
||||
|
|
@ -205,14 +197,9 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
LinphoneMediaEncryption menc=linphone_core_get_media_encryption(lc);
|
||||
const char *val;
|
||||
switch(menc){
|
||||
case LinphoneMediaEncryptionSRTP:
|
||||
val="SRTP";
|
||||
break;
|
||||
case LinphoneMediaEncryptionZRTP:
|
||||
val="ZRTP";
|
||||
break;
|
||||
default:
|
||||
val="None";
|
||||
case LinphoneMediaEncryptionSRTP: val="SRTP"; break;
|
||||
case LinphoneMediaEncryptionZRTP: val="ZRTP"; break;
|
||||
default: val="None"; break;
|
||||
}
|
||||
[self setString:val forKey:@"media_encryption_preference"];
|
||||
}
|
||||
|
|
@ -317,44 +304,23 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
}
|
||||
}
|
||||
|
||||
NSString* transport = [self stringForKey:@"transport_preference"];
|
||||
int port_preference = [self integerForKey:@"port_preference"];
|
||||
int port_preference = [self integerForKey:@"port_preference"];
|
||||
|
||||
BOOL random_port_preference = [self boolForKey:@"random_port_preference"];
|
||||
LCSipTransports transportValue = {0};
|
||||
LinphoneTransportType transportType = LinphoneTransportUdp;
|
||||
|
||||
// re-generate the random port if necessary
|
||||
if(random_port_preference) {
|
||||
port_preference = (0xDFFF&random())+1024;
|
||||
[self setInteger:port_preference forKey:@"port_preference"]; // Update back preference
|
||||
port_preference = -1;
|
||||
}
|
||||
|
||||
// reset ports
|
||||
lp_config_set_int(conf,"sip","sip_udp_port", 0);
|
||||
lp_config_set_int(conf,"sip","sip_tcp_port", 0);
|
||||
lp_config_set_int(conf,"sip","sip_tls_port", 0);
|
||||
|
||||
// only activate the selected transport
|
||||
if( [transport isEqualToString:@"udp"] ){
|
||||
lp_config_set_int(conf,"sip","sip_port", port_preference);
|
||||
transportValue.udp_port = port_preference;
|
||||
transportType = LinphoneTransportUdp;
|
||||
} else if( [transport isEqualToString:@"tcp"] ) {
|
||||
lp_config_set_int(conf,"sip","sip_tcp_port", port_preference);
|
||||
transportValue.tcp_port = port_preference;
|
||||
transportType = LinphoneTransportTcp;
|
||||
} else if( [transport isEqualToString:@"tls"] ) {
|
||||
lp_config_set_int(conf,"sip","sip_tls_port", port_preference);
|
||||
transportValue.tls_port = port_preference;
|
||||
transportType = LinphoneTransportTls;
|
||||
}
|
||||
|
||||
lp_config_set_int(conf,LINPHONERC_APPLICATION_KEY,"random_port_preference", random_port_preference);
|
||||
LCSipTransports transportValue={ port_preference, port_preference, -1, -1 };
|
||||
|
||||
// will also update the sip_*_port section of the config
|
||||
if (linphone_core_set_sip_transports(lc, &transportValue)) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"cannot set transport"];
|
||||
}
|
||||
|
||||
port_preference = linphone_core_get_sip_port(lc);
|
||||
[self setInteger:port_preference forKey:@"port_preference"]; // Update back preference
|
||||
|
||||
BOOL enable_ipv6 = [self boolForKey:@"use_ipv6"];
|
||||
lp_config_set_int(linphone_core_get_config(lc), "sip", "use_ipv6", enable_ipv6);
|
||||
if( linphone_core_ipv6_enabled(lc) != enable_ipv6){
|
||||
|
|
@ -362,66 +328,63 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
linphone_core_enable_ipv6(lc, enable_ipv6);
|
||||
}
|
||||
|
||||
|
||||
//configure sip account
|
||||
|
||||
//mandatory parameters
|
||||
NSString* username = [self stringForKey:@"username_preference"];
|
||||
NSString* domain = [self stringForKey:@"domain_preference"];
|
||||
NSString* username = [self stringForKey:@"username_preference"];
|
||||
NSString* domain = [self stringForKey:@"domain_preference"];
|
||||
NSString* transport = [self stringForKey:@"transport_preference"];
|
||||
NSString* accountHa1 = [self stringForKey:@"ha1_preference"];
|
||||
NSString* accountPassword = [self stringForKey:@"password_preference"];
|
||||
NSString* sha1 = [self stringForKey:@"password_ha1_preference"];
|
||||
bool isOutboundProxy= [self boolForKey:@"outbound_proxy_preference"];
|
||||
|
||||
|
||||
bool isOutboundProxy = [self boolForKey:@"outbound_proxy_preference"];
|
||||
|
||||
//clear auth info list
|
||||
linphone_core_clear_all_auth_info(lc);
|
||||
//clear existing proxy config
|
||||
linphone_core_clear_proxy_config(lc);
|
||||
|
||||
if (username && [username length] >0 && domain && [domain length]>0) {
|
||||
NSString* proxy_pref = [self stringForKey:@"proxy_preference"];
|
||||
if ((!proxy_pref || [proxy_pref length] <1 ) && domain) {
|
||||
proxy_pref = [NSString stringWithFormat:@"sip:%@",domain] ;
|
||||
NSString* proxyAddress = [self stringForKey:@"proxy_preference"];
|
||||
if ((!proxyAddress || [proxyAddress length] <1 ) && domain) {
|
||||
proxyAddress = [NSString stringWithFormat:@"sip:%@",domain] ;
|
||||
} else {
|
||||
proxy_pref = [NSString stringWithFormat:@"sip:%@",proxy_pref] ;
|
||||
proxyAddress = [NSString stringWithFormat:@"sip:%@",proxyAddress] ;
|
||||
}
|
||||
|
||||
char* proxy = ms_strdup([proxyAddress cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
LinphoneAddress* proxy_addr = linphone_address_new(proxy);
|
||||
|
||||
if( proxy_addr ){
|
||||
LinphoneTransportType type = LinphoneTransportUdp;
|
||||
if ( [transport isEqualToString:@"tcp"] ) type = LinphoneTransportTcp;
|
||||
else if ( [transport isEqualToString:@"tls"] ) type = LinphoneTransportTls;
|
||||
|
||||
linphone_address_set_transport(proxy_addr, type);
|
||||
ms_free(proxy);
|
||||
proxy = linphone_address_as_string_uri_only(proxy_addr);
|
||||
}
|
||||
|
||||
//possible valid config detected
|
||||
proxyCfg = linphone_core_create_proxy_config(lc);
|
||||
|
||||
// prepare identity
|
||||
char normalizedUserName[256];
|
||||
char normalizedUserName[256];
|
||||
LinphoneAddress* linphoneAddress = linphone_address_new("sip:user@domain.com");
|
||||
linphone_proxy_config_normalize_number(proxyCfg, [username cStringUsingEncoding:[NSString defaultCStringEncoding]],
|
||||
normalizedUserName, sizeof(normalizedUserName));
|
||||
linphone_proxy_config_normalize_number(proxyCfg, [username cStringUsingEncoding:[NSString defaultCStringEncoding]], normalizedUserName, sizeof(normalizedUserName));
|
||||
linphone_address_set_username(linphoneAddress, normalizedUserName);
|
||||
linphone_address_set_domain(linphoneAddress, [domain cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
|
||||
const char* identity = linphone_address_as_string_uri_only(linphoneAddress);
|
||||
const char* password = [accountPassword cStringUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
const char* ha1 = [accountHa1 cStringUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
|
||||
// configure proxy entries
|
||||
linphone_proxy_config_set_identity(proxyCfg, identity);
|
||||
|
||||
// proxy address
|
||||
LinphoneAddress* proxyAddress = linphone_address_new([proxy_pref cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
const char* proxy = "";
|
||||
if( proxyAddress ){
|
||||
linphone_address_set_transport(proxyAddress, transportType);
|
||||
proxy = linphone_address_as_string_uri_only(proxyAddress);
|
||||
linphone_proxy_config_set_server_addr(proxyCfg, proxy);
|
||||
}
|
||||
if (isOutboundProxy)
|
||||
linphone_proxy_config_set_route(proxyCfg, proxy);
|
||||
if(proxyAddress) linphone_address_destroy(proxyAddress);
|
||||
|
||||
|
||||
linphone_proxy_config_set_server_addr(proxyCfg, proxy);
|
||||
linphone_proxy_config_enable_register(proxyCfg, true);
|
||||
|
||||
// add username password
|
||||
LinphoneAddress *from = linphone_address_new(identity);
|
||||
const char* password = [accountPassword cStringUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
LinphoneAuthInfo *info;
|
||||
if (from != 0){
|
||||
// only use ha1 if the password is NULL. This allows for remote provisioning to send the SHA1 without disclosing the password
|
||||
const char* ha1 = password ? NULL : [sha1 cStringUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
info=linphone_auth_info_new(linphone_address_get_username(from), NULL, password, ha1, NULL, linphone_proxy_config_get_domain(proxyCfg));
|
||||
info=linphone_auth_info_new(linphone_address_get_username(from),NULL,password,ha1,NULL,linphone_proxy_config_get_domain(proxyCfg));
|
||||
linphone_core_add_auth_info(lc,info);
|
||||
linphone_address_destroy(from);
|
||||
}
|
||||
|
|
@ -437,10 +400,10 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
linphone_proxy_config_expires(proxyCfg, expire);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ([self objectForKey:@"prefix_preference"]) {
|
||||
if (isOutboundProxy)
|
||||
linphone_proxy_config_set_route(proxyCfg, proxy);
|
||||
|
||||
if ([self objectForKey:@"prefix_preference"]) {
|
||||
NSString* prefix = [self stringForKey:@"prefix_preference"];
|
||||
if ([prefix length]>0) {
|
||||
linphone_proxy_config_set_dial_prefix(proxyCfg, [prefix cStringUsingEncoding:[NSString defaultCStringEncoding]]);
|
||||
|
|
@ -461,6 +424,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
linphone_core_set_default_proxy(lc,proxyCfg);
|
||||
|
||||
linphone_address_destroy(linphoneAddress);
|
||||
ms_free(proxy);
|
||||
}
|
||||
[[[LinphoneManager instance] fastAddressBook] reload];
|
||||
}
|
||||
|
|
@ -512,7 +476,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
BOOL account_changed;
|
||||
|
||||
account_changed=[self valueChangedForKey:@"username_preference"]
|
||||
|| [self valueChangedForKey:@"password_preference"]
|
||||
|| [self valueChangedForKey:@"password_preference"]
|
||||
|| [self valueChangedForKey:@"domain_preference"]
|
||||
|| [self valueChangedForKey:@"expire_preference"]
|
||||
|| [self valueChangedForKey:@"proxy_preference"]
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
[self initPhoneMainView];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
|
|
@ -533,7 +533,7 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
- (UIViewController*)popCurrentView {
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"PhoneMainView: Pop view"];
|
||||
if([viewStack count] > 1) {
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
[hiddenKeys addObjectsFromArray:[[LinphoneManager unsupportedCodecs] allObjects]];
|
||||
|
||||
if(lp_config_get_int(linphone_core_get_config([LinphoneManager getLc]),"sip","sip_random_port",0)==1) {
|
||||
if(lp_config_get_int(linphone_core_get_config([LinphoneManager getLc]),"app","random_port_preference",0)==1) {
|
||||
[hiddenKeys addObject:@"port_preference"];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -268,11 +268,8 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"pushnotification_preference"];
|
||||
|
||||
LinphoneCore *lc = [LinphoneManager getLc];
|
||||
LCSipTransports transportValue={0};
|
||||
transportValue.udp_port=5060;
|
||||
transportValue.tls_port=0;
|
||||
transportValue.tcp_port=0;
|
||||
|
||||
LCSipTransports transportValue={5060,5060,-1,-1};
|
||||
|
||||
if (linphone_core_set_sip_transports(lc, &transportValue)) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"cannot set transport"];
|
||||
}
|
||||
|
|
@ -378,7 +375,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
placement_done = YES;
|
||||
}
|
||||
if (!show_extern && !show_logo) {
|
||||
// no option to create or specify a custom account: go to
|
||||
// no option to create or specify a custom account: go to connect view directly
|
||||
view = connectAccountView;
|
||||
}
|
||||
}
|
||||
|
|
@ -417,42 +414,25 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (void)setDefaultSettings:(LinphoneProxyConfig*)proxyCfg {
|
||||
BOOL pushnotification = [[LinphoneManager instance] lpConfigBoolForKey:@"push_notification" forSection:@"wizard"];
|
||||
[[LinphoneManager instance] lpConfigSetBool:pushnotification forKey:@"pushnotification_preference"];
|
||||
if(pushnotification) {
|
||||
[[LinphoneManager instance] addPushTokenToProxyConfig:proxyCfg];
|
||||
}
|
||||
int expires = [[LinphoneManager instance] lpConfigIntForKey:@"expires" forSection:@"wizard"];
|
||||
linphone_proxy_config_expires(proxyCfg, expires);
|
||||
|
||||
NSString* transport = [[LinphoneManager instance] lpConfigStringForKey:@"transport" forSection:@"wizard"];
|
||||
LinphoneManager* lm = [LinphoneManager instance];
|
||||
LinphoneCore *lc = [LinphoneManager getLc];
|
||||
LCSipTransports transportValue={0};
|
||||
if (transport!=nil) {
|
||||
if (linphone_core_get_sip_transports(lc, &transportValue)) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"cannot get current transport"];
|
||||
}
|
||||
// Only one port can be set at one time, the others's value is 0
|
||||
if ([transport isEqualToString:@"tcp"]) {
|
||||
transportValue.tcp_port=transportValue.tcp_port|transportValue.udp_port|transportValue.tls_port;
|
||||
transportValue.udp_port=0;
|
||||
transportValue.tls_port=0;
|
||||
} else if ([transport isEqualToString:@"udp"]){
|
||||
transportValue.udp_port=transportValue.tcp_port|transportValue.udp_port|transportValue.tls_port;
|
||||
transportValue.tcp_port=0;
|
||||
transportValue.tls_port=0;
|
||||
} else if ([transport isEqualToString:@"tls"]){
|
||||
transportValue.tls_port=transportValue.tcp_port|transportValue.udp_port|transportValue.tls_port;
|
||||
transportValue.tcp_port=0;
|
||||
transportValue.udp_port=0;
|
||||
} else {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"unexpected transport [%s]",[transport cStringUsingEncoding:[NSString defaultCStringEncoding]]];
|
||||
}
|
||||
if (linphone_core_set_sip_transports(lc, &transportValue)) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"cannot set transport"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL pushnotification = [lm lpConfigBoolForKey:@"push_notification" forSection:@"wizard"];
|
||||
[lm lpConfigSetBool:pushnotification forKey:@"pushnotification_preference"];
|
||||
if(pushnotification) {
|
||||
[lm addPushTokenToProxyConfig:proxyCfg];
|
||||
}
|
||||
|
||||
int expires = [lm lpConfigIntForKey:@"expires" forSection:@"wizard"];
|
||||
linphone_proxy_config_expires(proxyCfg, expires);
|
||||
NSString* section = [NSString stringWithUTF8String:LINPHONERC_APPLICATION_KEY];
|
||||
int port = [lm lpConfigBoolForKey:@"random_port_preference" forSection:section] ? -1 : [lm lpConfigIntForKey:@"port_preference" forSection:section];
|
||||
LCSipTransports transportValue={port,port,-1,-1};
|
||||
|
||||
if (linphone_core_set_sip_transports(lc, &transportValue)) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"cannot set transport"];
|
||||
}
|
||||
|
||||
NSString* sharing_server = [[LinphoneManager instance] lpConfigStringForKey:@"sharing_server" forSection:@"wizard"];
|
||||
[[LinphoneManager instance] lpConfigSetString:sharing_server forKey:@"sharing_server_preference"];
|
||||
|
||||
|
|
@ -589,6 +569,13 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)loadWizardConfig:(NSString*)rcFilename {
|
||||
NSString* fullPath = [LinphoneManager bundleFile:rcFilename];
|
||||
LpConfig* current_conf = linphone_core_get_config([LinphoneManager getLc]);
|
||||
if( lp_config_read_file(current_conf, [fullPath cStringUsingEncoding:[NSString defaultCStringEncoding]]) != 0 ){
|
||||
[LinphoneLogger log:LinphoneLoggerError format:@"Couldn't push wizard file %@ to the Linphone config"];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UITextFieldDelegate Functions
|
||||
|
||||
|
|
@ -630,7 +617,6 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)hideError:(NSTimer*)timer {
|
||||
UILabel* error_label =[WizardViewController findLabel:ViewElement_Username_Error view:contentView];
|
||||
if( error_label ) {
|
||||
|
|
@ -664,15 +650,18 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (IBAction)onCreateAccountClick:(id)sender {
|
||||
[self loadWizardConfig:@"wizard_linphone_create.rc"];
|
||||
[self changeView:createAccountView back:FALSE animation:TRUE];
|
||||
|
||||
}
|
||||
|
||||
- (IBAction)onConnectAccountClick:(id)sender {
|
||||
[self loadWizardConfig:@"wizard_linphone_existing.rc"];
|
||||
[self changeView:connectAccountView back:FALSE animation:TRUE];
|
||||
}
|
||||
|
||||
- (IBAction)onExternalAccountClick:(id)sender {
|
||||
[self loadWizardConfig:@"wizard_external_sip.rc"];
|
||||
[self changeView:externalAccountView back:FALSE animation:TRUE];
|
||||
}
|
||||
|
||||
|
|
@ -1010,7 +999,6 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - TPMultiLayoutViewController Functions
|
||||
|
||||
- (NSDictionary*)attributesForView:(UIView*)view {
|
||||
|
|
@ -1048,9 +1036,4 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
return YES;
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
[self setRemoteProvisioningButton:nil];
|
||||
[self setRemoteParamsLabel:nil];
|
||||
[super viewDidUnload];
|
||||
}
|
||||
@end
|
||||
|
|
|
|||
19
Resources/wizard_external_sip.rc
Normal file
19
Resources/wizard_external_sip.rc
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
[proxy_default_values]
|
||||
|
||||
reg_proxy=
|
||||
reg_route=
|
||||
reg_identity=
|
||||
reg_expires=3600
|
||||
reg_sendregister=1
|
||||
publish=0
|
||||
dial_escape_plus=0
|
||||
|
||||
[wizard]
|
||||
service_url=
|
||||
|
||||
[app]
|
||||
push_notification_preference=0
|
||||
sharing_server_preference=
|
||||
ice_preference=
|
||||
stun_preference=
|
||||
19
Resources/wizard_linphone_create.rc
Normal file
19
Resources/wizard_linphone_create.rc
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
[proxy_default_values]
|
||||
|
||||
reg_proxy=<sip:sip.linphone.org:5223;transport=tls>
|
||||
reg_route=<sip:sip.linphone.org:5223;transport=tls>
|
||||
reg_identity=sip:?@sip.linphone.org
|
||||
reg_expires=604800
|
||||
reg_sendregister=1
|
||||
publish=0
|
||||
dial_escape_plus=0
|
||||
|
||||
[wizard]
|
||||
service_url=https://www.linphone.org/wizard.php
|
||||
|
||||
[app]
|
||||
push_notification_preference=1
|
||||
sharing_server_preference=https://www.linphone.org:444/upload.php
|
||||
ice_preference=1
|
||||
stun_preference=stun.linphone.org
|
||||
19
Resources/wizard_linphone_existing.rc
Normal file
19
Resources/wizard_linphone_existing.rc
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
[proxy_default_values]
|
||||
|
||||
reg_proxy=<sip:sip.linphone.org:5223;transport=tls>
|
||||
reg_route=<sip:sip.linphone.org:5223;transport=tls>
|
||||
reg_identity=sip:?@sip.linphone.org
|
||||
reg_expires=604800
|
||||
reg_sendregister=1
|
||||
publish=0
|
||||
dial_escape_plus=0
|
||||
|
||||
[wizard]
|
||||
service_url=https://www.linphone.org/wizard.php
|
||||
|
||||
[app]
|
||||
push_notification_preference=1
|
||||
sharing_server_preference=https://www.linphone.org:444/upload.php
|
||||
ice_preference=1
|
||||
stun_preference=stun.linphone.org
|
||||
19
Resources/wizard_remote.rc
Normal file
19
Resources/wizard_remote.rc
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
[proxy_default_values]
|
||||
|
||||
reg_proxy=
|
||||
reg_route=
|
||||
reg_identity=
|
||||
reg_expires=3600
|
||||
reg_sendregister=1
|
||||
publish=0
|
||||
dial_escape_plus=0
|
||||
|
||||
[wizard]
|
||||
service_url=
|
||||
|
||||
[app]
|
||||
push_notification_preference=0
|
||||
sharing_server_preference=
|
||||
ice_preference=
|
||||
stun_preference=
|
||||
|
|
@ -5,12 +5,12 @@
|
|||
<key>PreferenceSpecifiers</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>Title</key>
|
||||
<string>Edge optimization</string>
|
||||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
<key>Key</key>
|
||||
<string>edge_opt_preference</string>
|
||||
<key>Title</key>
|
||||
<string>Edge optimization</string>
|
||||
<key>Type</key>
|
||||
<string>PSToggleSwitchSpecifier</string>
|
||||
</dict>
|
||||
|
|
@ -102,28 +102,6 @@
|
|||
<key>IASKTextAlignment</key>
|
||||
<string>IASKUITextAlignmentRight</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>DefaultValue</key>
|
||||
<string>udp</string>
|
||||
<key>Key</key>
|
||||
<string>transport_preference</string>
|
||||
<key>Title</key>
|
||||
<string>Transport</string>
|
||||
<key>Titles</key>
|
||||
<array>
|
||||
<string>UDP</string>
|
||||
<string>TCP</string>
|
||||
<string>TLS</string>
|
||||
</array>
|
||||
<key>Type</key>
|
||||
<string>PSMultiValueSpecifier</string>
|
||||
<key>Values</key>
|
||||
<array>
|
||||
<string>udp</string>
|
||||
<string>tcp</string>
|
||||
<string>tls</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>Title</key>
|
||||
<string>Use IPv6</string>
|
||||
|
|
|
|||
|
|
@ -90,6 +90,28 @@
|
|||
<key>Type</key>
|
||||
<string>PSTextFieldSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>DefaultValue</key>
|
||||
<string>udp</string>
|
||||
<key>Key</key>
|
||||
<string>transport_preference</string>
|
||||
<key>Title</key>
|
||||
<string>Transport</string>
|
||||
<key>Titles</key>
|
||||
<array>
|
||||
<string>UDP</string>
|
||||
<string>TCP</string>
|
||||
<string>TLS</string>
|
||||
</array>
|
||||
<key>Type</key>
|
||||
<string>PSMultiValueSpecifier</string>
|
||||
<key>Values</key>
|
||||
<array>
|
||||
<string>udp</string>
|
||||
<string>tcp</string>
|
||||
<string>tls</string>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue