mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-02 03:09:23 +00:00
Add a way to specify transport for external sip servers
This commit is contained in:
parent
f93b735575
commit
21c69fe477
3 changed files with 30 additions and 12 deletions
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5053" systemVersion="13C64" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6250" systemVersion="14A389" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment defaultVersion="1536" identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="WizardViewController">
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
<outlet property="provisionedPassword" destination="ClH-fT-a8N" id="h61-p1-4qG"/>
|
||||
<outlet property="provisionedUsername" destination="MyR-eX-QTa" id="gmr-FI-hpH"/>
|
||||
<outlet property="remoteProvisioningButton" destination="Kbn-dL-C5h" id="PPk-DJ-nEb"/>
|
||||
<outlet property="transportChooser" destination="Nrv-SM-lMf" id="7iR-aG-eQf"/>
|
||||
<outlet property="validateAccountView" destination="101" id="112"/>
|
||||
<outlet property="welcomeView" destination="21" id="28"/>
|
||||
</connections>
|
||||
|
|
@ -366,6 +367,16 @@
|
|||
<action selector="onSignInExternalClick:" destination="-1" eventType="touchUpInside" id="115"/>
|
||||
</connections>
|
||||
</button>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="bar" selectedSegmentIndex="0" id="Nrv-SM-lMf">
|
||||
<rect key="frame" x="40" y="273" width="240" height="29"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<segments>
|
||||
<segment title="UDP"/>
|
||||
<segment title="TCP"/>
|
||||
<segment title="TLS"/>
|
||||
</segments>
|
||||
<color key="tintColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</segmentedControl>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@
|
|||
@property (retain, nonatomic) IBOutlet UITextField *provisionedDomain;
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UIImageView *choiceViewLogoImageView;
|
||||
@property (retain, nonatomic) IBOutlet UISegmentedControl *transportChooser;
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UITapGestureRecognizer *viewTapGestureRecognizer;
|
||||
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ typedef enum _ViewElement {
|
|||
[provisionedUsername release];
|
||||
[provisionedPassword release];
|
||||
[provisionedDomain release];
|
||||
[_transportChooser release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
@ -422,9 +423,10 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
}
|
||||
|
||||
- (void)addProxyConfig:(NSString*)username password:(NSString*)password domain:(NSString*)domain {
|
||||
- (void)addProxyConfig:(NSString*)username password:(NSString*)password domain:(NSString*)domain withTransport:(NSString*)transport {
|
||||
LinphoneCore* lc = [LinphoneManager getLc];
|
||||
LinphoneProxyConfig* proxyCfg = linphone_core_create_proxy_config(lc);
|
||||
NSString* server_address = domain;
|
||||
|
||||
char normalizedUserName[256];
|
||||
linphone_proxy_config_normalize_number(proxyCfg, [username cStringUsingEncoding:[NSString defaultCStringEncoding]], normalizedUserName, sizeof(normalizedUserName));
|
||||
|
|
@ -436,8 +438,11 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
linphone_address_set_username(linphoneAddress, normalizedUserName);
|
||||
|
||||
if( domain && [domain length] != 0) {
|
||||
if( transport != nil ){
|
||||
server_address = [NSString stringWithFormat:@"%@;transport=%@", server_address, [transport lowercaseString]];
|
||||
}
|
||||
// when the domain is specified (for external login), take it as the server address
|
||||
linphone_proxy_config_set_server_addr(proxyCfg, [domain UTF8String]);
|
||||
linphone_proxy_config_set_server_addr(proxyCfg, [server_address UTF8String]);
|
||||
linphone_address_set_domain(linphoneAddress, [domain UTF8String]);
|
||||
}
|
||||
|
||||
|
|
@ -695,10 +700,11 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (IBAction)onSignInExternalClick:(id)sender {
|
||||
NSString *username = [WizardViewController findTextField:ViewElement_Username view:contentView].text;
|
||||
NSString *password = [WizardViewController findTextField:ViewElement_Password view:contentView].text;
|
||||
NSString *domain = [WizardViewController findTextField:ViewElement_Domain view:contentView].text;
|
||||
|
||||
NSString *username = [WizardViewController findTextField:ViewElement_Username view:contentView].text;
|
||||
NSString *password = [WizardViewController findTextField:ViewElement_Password view:contentView].text;
|
||||
NSString *domain = [WizardViewController findTextField:ViewElement_Domain view:contentView].text;
|
||||
NSString *transport = [self.transportChooser titleForSegmentAtIndex:self.transportChooser.selectedSegmentIndex];
|
||||
|
||||
|
||||
NSMutableString *errors = [NSMutableString string];
|
||||
if ([username length] == 0) {
|
||||
|
|
@ -720,7 +726,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
[errorView release];
|
||||
} else {
|
||||
[self.waitView setHidden:false];
|
||||
[self addProxyConfig:username password:password domain:domain];
|
||||
[self addProxyConfig:username password:password domain:domain withTransport:transport];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -745,7 +751,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
} else {
|
||||
[self.waitView setHidden:false];
|
||||
// domain and server will be configured from the default proxy values
|
||||
[self addProxyConfig:username password:password domain:nil];
|
||||
[self addProxyConfig:username password:password domain:nil withTransport:nil];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -995,7 +1001,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
if([response object] == [NSNumber numberWithInt:1]) {
|
||||
NSString *username = [WizardViewController findTextField:ViewElement_Username view:contentView].text;
|
||||
NSString *password = [WizardViewController findTextField:ViewElement_Password view:contentView].text;
|
||||
[self addProxyConfig:username password:password domain:nil];
|
||||
[self addProxyConfig:username password:password domain:nil withTransport:nil];
|
||||
} else {
|
||||
UIAlertView* errorView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Account validation issue",nil)
|
||||
message:NSLocalizedString(@"Your account is not validate yet.", nil)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue