mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Progress commit
This commit is contained in:
parent
792a66b963
commit
a23db83456
13 changed files with 272 additions and 175 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5053" systemVersion="13C64" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3747"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="WizardViewController">
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
<outlet property="createAccountView" destination="44" id="70"/>
|
||||
<outlet property="externalAccountButton" destination="39" id="133"/>
|
||||
<outlet property="externalAccountView" destination="56" id="72"/>
|
||||
<outlet property="remoteParamsLabel" destination="bBb-47-pCq" id="aSA-QL-JR7"/>
|
||||
<outlet property="remoteProvisioningButton" destination="Kbn-dL-C5h" id="PPk-DJ-nEb"/>
|
||||
<outlet property="validateAccountView" destination="101" id="112"/>
|
||||
<outlet property="welcomeView" destination="21" id="28"/>
|
||||
|
|
@ -291,13 +292,6 @@
|
|||
<action selector="onSignInClick:" destination="-1" eventType="touchUpInside" id="116"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label hidden="YES" opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="105" contentMode="left" text="remote provisioning details" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumFontSize="10" adjustsFontSizeToFit="NO" id="W9Y-Z9-Rmz" userLabel="remoteProvisionDetails">
|
||||
<rect key="frame" x="40" y="242" width="240" height="80"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
|
|
@ -316,7 +310,7 @@
|
|||
<size key="shadowOffset" width="-1" height="-1"/>
|
||||
</label>
|
||||
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" tag="200" contentMode="left" text="Enter your username and password with your SIP domain." textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" minimumFontSize="10" adjustsFontSizeToFit="NO" id="58" userLabel="label">
|
||||
<rect key="frame" x="40" y="80" width="240" height="44"/>
|
||||
<rect key="frame" x="40" y="82" width="240" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||
|
|
@ -368,6 +362,13 @@
|
|||
<action selector="onSignInExternalClick:" destination="-1" eventType="touchUpInside" id="115"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label hidden="YES" opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="These parameters were retrieved from a remote provisioning profile." textAlignment="center" lineBreakMode="wordWrap" numberOfLines="7" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="bBb-47-pCq" userLabel="remoteParamsLabel">
|
||||
<rect key="frame" x="34" y="269" width="254" height="53"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
|
|
@ -435,19 +436,6 @@
|
|||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" id="7Az-KG-XEW" userLabel="remoteProvisionWaitView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="whiteLarge" id="GG1-Sn-aIT" userLabel="activity">
|
||||
<rect key="frame" x="142" y="221" width="37" height="37"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="color" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</activityIndicatorView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.29999999999999999" colorSpace="calibratedWhite"/>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="button_background_default.png" width="550" height="101"/>
|
||||
|
|
@ -455,4 +443,4 @@
|
|||
<image name="field_background.png" width="542" height="88"/>
|
||||
<image name="setup_welcome_logo.png" width="179" height="161"/>
|
||||
</resources>
|
||||
</document>
|
||||
</document>
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ 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);
|
||||
|
|
@ -83,6 +84,7 @@ 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"];
|
||||
|
|
@ -96,12 +98,13 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
}else snprintf(tmp,sizeof(tmp)-1,"%s",linphone_address_get_domain(proxy_addr));
|
||||
[self setString: tmp forKey:@"proxy_preference"];
|
||||
}
|
||||
linphone_address_destroy(addr);
|
||||
|
||||
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"];
|
||||
|
|
@ -111,8 +114,27 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
[self setObject:@"" forKey:@"password_preference"];
|
||||
[self setBool:FALSE forKey:@"outbound_proxy_preference"];
|
||||
}
|
||||
|
||||
[self setBool:lp_config_get_int(linphone_core_get_config(lc), LINPHONERC_APPLICATION_KEY, "pushnotification_preference", 0) forKey:@"pushnotification_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"];
|
||||
{
|
||||
LinphoneAddress *parsed = linphone_core_get_primary_contact_parsed(lc);
|
||||
if(parsed != NULL) {
|
||||
|
|
@ -147,31 +169,13 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
[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"];
|
||||
}
|
||||
{
|
||||
LCSipTransports tp;
|
||||
const char *tname = "udp";
|
||||
int port = 5060;
|
||||
linphone_core_get_sip_transports(lc, &tp);
|
||||
if (tp.udp_port>0) {
|
||||
tname = "udp";
|
||||
port = tp.udp_port;
|
||||
} else if (tp.tcp_port>0) {
|
||||
tname = "tcp";
|
||||
port = tp.tcp_port;
|
||||
} else if (tp.tls_port>0) {
|
||||
tname = "tls";
|
||||
port = tp.tls_port;
|
||||
}
|
||||
[self setString:tname forKey:@"transport_preference"];
|
||||
[self setInteger:port forKey:@"port_preference"];
|
||||
|
||||
[self setInteger:lp_config_get_int(linphone_core_get_config(lc),"sip","sip_random_port", 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"];
|
||||
}
|
||||
}
|
||||
{
|
||||
|
|
@ -291,6 +295,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
|
||||
- (void)synchronizeAccount {
|
||||
LinphoneCore *lc = [LinphoneManager getLc];
|
||||
LpConfig* conf = linphone_core_get_config(lc);
|
||||
LinphoneManager* lLinphoneMgr = [LinphoneManager instance];
|
||||
LinphoneProxyConfig* proxyCfg = NULL;
|
||||
/* unregister before modifying any settings */
|
||||
|
|
@ -312,43 +317,43 @@ 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"];
|
||||
|
||||
NSString* transport = [self stringForKey:@"transport_preference"];
|
||||
int port_preference = [self integerForKey:@"port_preference"];
|
||||
BOOL random_port_preference = [self boolForKey:@"random_port_preference"];
|
||||
lp_config_set_int(linphone_core_get_config(lc),"sip","sip_random_port", random_port_preference);
|
||||
lp_config_set_int(linphone_core_get_config(lc),"sip","sip_tcp_random_port", random_port_preference);
|
||||
lp_config_set_int(linphone_core_get_config(lc),"sip","sip_tls_random_port", 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
|
||||
}
|
||||
|
||||
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=port_preference;
|
||||
transportValue.udp_port=0;
|
||||
transportValue.tls_port=0;
|
||||
} else if ([transport isEqualToString:@"udp"]){
|
||||
transportValue.udp_port=port_preference;
|
||||
transportValue.tcp_port=0;
|
||||
transportValue.tls_port=0;
|
||||
} else if ([transport isEqualToString:@"tls"]){
|
||||
transportValue.tls_port=port_preference;
|
||||
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"];
|
||||
}
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if (linphone_core_set_sip_transports(lc, &transportValue)) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"cannot set transport"];
|
||||
}
|
||||
|
||||
BOOL enable_ipv6 = [self boolForKey:@"use_ipv6"];
|
||||
lp_config_set_int(linphone_core_get_config(lc), "sip", "use_ipv6", enable_ipv6);
|
||||
|
|
@ -364,6 +369,7 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
NSString* username = [self stringForKey:@"username_preference"];
|
||||
NSString* domain = [self stringForKey:@"domain_preference"];
|
||||
NSString* accountPassword = [self stringForKey:@"password_preference"];
|
||||
NSString* sha1 = [self stringForKey:@"password_ha1_preference"];
|
||||
bool isOutboundProxy= [self boolForKey:@"outbound_proxy_preference"];
|
||||
|
||||
|
||||
|
|
@ -372,43 +378,53 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
//clear existing proxy config
|
||||
linphone_core_clear_proxy_config(lc);
|
||||
if (username && [username length] >0 && domain && [domain length]>0) {
|
||||
NSString* proxyAddress = [self stringForKey:@"proxy_preference"];
|
||||
if ((!proxyAddress || [proxyAddress length] <1 ) && domain) {
|
||||
proxyAddress = [NSString stringWithFormat:@"sip:%@",domain] ;
|
||||
NSString* proxy_pref = [self stringForKey:@"proxy_preference"];
|
||||
if ((!proxy_pref || [proxy_pref length] <1 ) && domain) {
|
||||
proxy_pref = [NSString stringWithFormat:@"sip:%@",domain] ;
|
||||
} else {
|
||||
proxyAddress = [NSString stringWithFormat:@"sip:%@",proxyAddress] ;
|
||||
proxy_pref = [NSString stringWithFormat:@"sip:%@",proxy_pref] ;
|
||||
}
|
||||
|
||||
const char* proxy = [proxyAddress cStringUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
|
||||
|
||||
|
||||
//possible valid config detected
|
||||
proxyCfg = linphone_core_create_proxy_config(lc);
|
||||
char normalizedUserName[256];
|
||||
|
||||
// prepare identity
|
||||
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]];
|
||||
|
||||
// configure proxy entries
|
||||
const char* identity = linphone_address_as_string_uri_only(linphoneAddress);
|
||||
linphone_proxy_config_set_identity(proxyCfg, identity);
|
||||
linphone_proxy_config_set_server_addr(proxyCfg, proxy);
|
||||
|
||||
// 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_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){
|
||||
info=linphone_auth_info_new(linphone_address_get_username(from),NULL,password,NULL,NULL,linphone_proxy_config_get_domain(proxyCfg));
|
||||
// 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));
|
||||
linphone_core_add_auth_info(lc,info);
|
||||
linphone_address_destroy(from);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int expire = [self integerForKey:@"expire_preference"];
|
||||
linphone_proxy_config_expires(proxyCfg,expire);
|
||||
|
|
@ -421,10 +437,10 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
|
|||
linphone_proxy_config_expires(proxyCfg, expire);
|
||||
}
|
||||
|
||||
if (isOutboundProxy)
|
||||
linphone_proxy_config_set_route(proxyCfg, proxy);
|
||||
|
||||
if ([self objectForKey:@"prefix_preference"]) {
|
||||
|
||||
|
||||
|
||||
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]]);
|
||||
|
|
|
|||
|
|
@ -177,6 +177,7 @@ typedef struct _LinphoneManagerSounds {
|
|||
@property (readonly) NSString* contactSipField;
|
||||
@property (readonly,copy) NSString* contactFilter;
|
||||
@property (copy) void (^silentPushCompletion)(UIBackgroundFetchResult);
|
||||
@property (readonly) BOOL wasRemoteProvisioned;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ extern void libmsbcg729_init();
|
|||
@synthesize bluetoothEnabled;
|
||||
@synthesize photoLibrary;
|
||||
@synthesize silentPushCompletion;
|
||||
@synthesize wasRemoteProvisioned;
|
||||
|
||||
struct codec_name_pref_table{
|
||||
const char *name;
|
||||
|
|
@ -288,6 +289,8 @@ struct codec_name_pref_table codec_pref_table[]={
|
|||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self forKeyPath:kLinphoneGlobalStateUpdate];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self forKeyPath:kLinphoneConfiguringStateUpdate];
|
||||
|
||||
|
||||
[photoLibrary release];
|
||||
[pendindCallIdFromRemoteNotif release];
|
||||
|
|
@ -344,6 +347,31 @@ struct codec_name_pref_table codec_pref_table[]={
|
|||
}
|
||||
|
||||
|
||||
struct _entry_data {
|
||||
const LpConfig* conf;
|
||||
const char* section;
|
||||
};
|
||||
|
||||
static void dump_entry(const char* entry, void*data) {
|
||||
struct _entry_data *d = (struct _entry_data*)data;
|
||||
const char* value = lp_config_get_string(d->conf, d->section, entry, "");
|
||||
[LinphoneLogger log:LinphoneLoggerLog format:@"%s=%s", entry, value];
|
||||
}
|
||||
|
||||
static void dump_section(const char* section, void* data){
|
||||
[LinphoneLogger log:LinphoneLoggerLog format:@"[%s]", section ];
|
||||
struct _entry_data d = {(const LpConfig*)data, section};
|
||||
lp_config_for_each_entry((const LpConfig*)data, section, dump_entry, &d);
|
||||
}
|
||||
|
||||
+ (void)dumpLCConfig {
|
||||
if(theLinphoneCore ){
|
||||
LpConfig* conf = linphone_core_get_config(theLinphoneCore);
|
||||
lp_config_for_each_section(conf, dump_section, conf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Logs Functions
|
||||
|
||||
//generic log handler for debug version
|
||||
|
|
@ -620,6 +648,16 @@ static void linphone_iphone_configuring_status_changed(LinphoneCore *lc, Linphon
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
-(void)configuringStateChangedNotificationHandler:(NSNotification*)notif {
|
||||
if( (LinphoneConfiguringState)[[[notif userInfo] valueForKey:@"state"] integerValue] == LinphoneConfiguringSuccessful){
|
||||
wasRemoteProvisioned = TRUE;
|
||||
} else {
|
||||
wasRemoteProvisioned = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Registration State Functions
|
||||
|
||||
- (void)onRegister:(LinphoneCore *)lc cfg:(LinphoneProxyConfig*) cfg state:(LinphoneRegistrationState) state message:(const char*) message {
|
||||
|
|
@ -900,7 +938,6 @@ static LinphoneCoreVTable linphonec_vtable = {
|
|||
linphone_core_iterate(theLinphoneCore);
|
||||
}
|
||||
|
||||
|
||||
- (void)audioSessionInterrupted:(NSNotification *)notification
|
||||
{
|
||||
int interruptionType = [notification.userInfo[AVAudioSessionInterruptionTypeKey] intValue];
|
||||
|
|
@ -985,18 +1022,18 @@ static LinphoneCoreVTable linphonec_vtable = {
|
|||
|
||||
|
||||
- (void)startLibLinphone {
|
||||
if (theLinphoneCore != nil) {
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"linphonecore is already created"];
|
||||
|
||||
static BOOL libStarted = FALSE;
|
||||
if ( libStarted ) {
|
||||
[LinphoneLogger logc:LinphoneLoggerError format:"Liblinphone is already initialized!"];
|
||||
return;
|
||||
}
|
||||
|
||||
NSString* factoryConfig = [LinphoneManager bundleFile:[LinphoneManager runningOnIpad]?@"linphonerc-factory~ipad":@"linphonerc-factory"];
|
||||
NSString *confiFileName = [LinphoneManager documentFile:@".linphonerc"];
|
||||
|
||||
libStarted = TRUE;
|
||||
|
||||
connectivity = none;
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
//log management
|
||||
|
||||
|
||||
libmsilbc_init();
|
||||
#if defined (HAVE_SILK)
|
||||
libmssilk_init();
|
||||
|
|
@ -1011,43 +1048,21 @@ static LinphoneCoreVTable linphonec_vtable = {
|
|||
#if HAVE_G729
|
||||
libmsbcg729_init(); // load g729 plugin
|
||||
#endif
|
||||
/* Initialize linphone core*/
|
||||
|
||||
|
||||
/*to make sure we don't loose debug trace*/
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey:@"debugenable_preference"]) {
|
||||
linphone_core_enable_logs_with_cb((OrtpLogFunc)linphone_iphone_log_handler);
|
||||
ortp_set_log_level_mask(ORTP_DEBUG|ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
|
||||
}
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"Create linphonecore"];
|
||||
|
||||
theLinphoneCore = linphone_core_new (&linphonec_vtable
|
||||
, [confiFileName cStringUsingEncoding:[NSString defaultCStringEncoding]]
|
||||
, [factoryConfig cStringUsingEncoding:[NSString defaultCStringEncoding]]
|
||||
,self /* user_data */);
|
||||
|
||||
/* The core will call the linphone_iphone_configuring_status_changed callback when the remote provisioning is loaded (or skipped).
|
||||
Wait for this to finish the code configuration */
|
||||
|
||||
// start scheduler
|
||||
mIterateTimer = [NSTimer scheduledTimerWithTimeInterval:0.02
|
||||
target:self
|
||||
selector:@selector(iterate)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
// create linphone core
|
||||
[self createLinphoneCore];
|
||||
|
||||
//init audio session
|
||||
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
|
||||
BOOL bAudioInputAvailable= audioSession.inputAvailable;
|
||||
NSError* err;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(audioSessionInterrupted:)
|
||||
name:AVAudioSessionInterruptionNotification
|
||||
object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(globalStateChangedNotificationHandler:) name:kLinphoneGlobalStateUpdate object:nil];
|
||||
|
||||
|
||||
|
||||
if( ![audioSession setActive:NO error: &err] && err ){
|
||||
NSLog(@"audioSession setActive failed: %@", [err description]);
|
||||
}
|
||||
|
|
@ -1069,6 +1084,42 @@ static LinphoneCoreVTable linphonec_vtable = {
|
|||
|
||||
}
|
||||
|
||||
- (void)createLinphoneCore {
|
||||
|
||||
if (theLinphoneCore != nil) {
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"linphonecore is already created"];
|
||||
return;
|
||||
}
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"Create linphonecore"];
|
||||
|
||||
connectivity=none;
|
||||
|
||||
NSString* factoryConfig = [LinphoneManager bundleFile:[LinphoneManager runningOnIpad]?@"linphonerc-factory~ipad":@"linphonerc-factory"];
|
||||
NSString *confiFileName = [LinphoneManager documentFile:@".linphonerc"];
|
||||
theLinphoneCore = linphone_core_new (&linphonec_vtable
|
||||
, [confiFileName cStringUsingEncoding:[NSString defaultCStringEncoding]]
|
||||
, [factoryConfig cStringUsingEncoding:[NSString defaultCStringEncoding]]
|
||||
,self /* user_data */);
|
||||
|
||||
/* set the CA file no matter what, since the remote provisioning could be hitting an HTTPS server */
|
||||
const char* lRootCa = [[LinphoneManager bundleFile:@"rootca.pem"] cStringUsingEncoding:[NSString defaultCStringEncoding]];
|
||||
linphone_core_set_root_ca(theLinphoneCore, lRootCa);
|
||||
|
||||
/* The core will call the linphone_iphone_configuring_status_changed callback when the remote provisioning is loaded (or skipped).
|
||||
Wait for this to finish the code configuration */
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioSessionInterrupted:) name:AVAudioSessionInterruptionNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(globalStateChangedNotificationHandler:) name:kLinphoneGlobalStateUpdate object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(configuringStateChangedNotificationHandler:) name:kLinphoneConfiguringStateUpdate object:nil];
|
||||
|
||||
// start scheduler
|
||||
mIterateTimer = [NSTimer scheduledTimerWithTimeInterval:0.02
|
||||
target:self
|
||||
selector:@selector(iterate)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
}
|
||||
|
||||
- (void)destroyLibLinphone {
|
||||
[mIterateTimer invalidate];
|
||||
//just in case
|
||||
|
|
@ -1095,35 +1146,10 @@ static LinphoneCoreVTable linphonec_vtable = {
|
|||
|
||||
- (void) resetLinphoneCore {
|
||||
[self destroyLibLinphone];
|
||||
if (theLinphoneCore != nil) {
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"linphonecore is already created"];
|
||||
return;
|
||||
}
|
||||
[LinphoneLogger logc:LinphoneLoggerLog format:"Create linphonecore"];
|
||||
[self createLinphoneCore];
|
||||
|
||||
NSString* factoryConfig = [LinphoneManager bundleFile:[LinphoneManager runningOnIpad]?@"linphonerc-factory~ipad":@"linphonerc-factory"];
|
||||
NSString *confiFileName = [LinphoneManager documentFile:@".linphonerc"];
|
||||
theLinphoneCore = linphone_core_new (&linphonec_vtable
|
||||
, [confiFileName cStringUsingEncoding:[NSString defaultCStringEncoding]]
|
||||
, [factoryConfig cStringUsingEncoding:[NSString defaultCStringEncoding]]
|
||||
,self /* user_data */);
|
||||
|
||||
/* The core will call the linphone_iphone_configuring_status_changed callback when the remote provisioning is loaded (or skipped).
|
||||
Wait for this to finish the code configuration */
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioSessionInterrupted:) name:AVAudioSessionInterruptionNotification object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(globalStateChangedNotificationHandler:) name:kLinphoneGlobalStateUpdate object:nil];
|
||||
connectivity=none;
|
||||
// reset network state to trigger a new network connectivity assessment
|
||||
linphone_core_set_network_reachable(theLinphoneCore, FALSE);
|
||||
// start scheduler
|
||||
mIterateTimer = [NSTimer scheduledTimerWithTimeInterval:0.02
|
||||
target:self
|
||||
selector:@selector(iterate)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static int comp_call_id(const LinphoneCall* call , const char *callid) {
|
||||
|
|
|
|||
|
|
@ -237,13 +237,16 @@ static PhoneMainView* phoneMainViewInstance=nil;
|
|||
}
|
||||
|
||||
- (void)onGlobalStateChanged:(NSNotification*)notif {
|
||||
LinphoneConfiguringState state = [[[notif userInfo] valueForKey:@"state"] integerValue];
|
||||
LinphoneAppDelegate *appDelegate = (LinphoneAppDelegate *)[[UIApplication sharedApplication] delegate];
|
||||
if( state == LinphoneGlobalOn && !(appDelegate.started) ){
|
||||
if( [[LinphoneManager instance] lpConfigBoolForKey:@"show_login_view" forSection:@"app"] ){
|
||||
LinphoneGlobalState state = [[[notif userInfo] valueForKey:@"state"] integerValue];
|
||||
static BOOL already_shown = FALSE;
|
||||
if( state == LinphoneGlobalOn && !already_shown && [LinphoneManager instance].wasRemoteProvisioned ){
|
||||
LinphoneProxyConfig* conf = NULL;
|
||||
linphone_core_get_default_proxy([LinphoneManager getLc], &conf);
|
||||
if( [[LinphoneManager instance] lpConfigBoolForKey:@"show_login_view" forSection:@"app"] && conf == NULL){
|
||||
already_shown = TRUE;
|
||||
WizardViewController *controller = DYNAMIC_CAST([[PhoneMainView instance] changeCurrentView:[WizardViewController compositeViewDescription]], WizardViewController);
|
||||
if(controller != nil) {
|
||||
[controller handleRemoteProvisioning];
|
||||
[controller fillDefaultValues];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@
|
|||
@property (nonatomic, retain) IBOutlet UIButton *connectAccountButton;
|
||||
@property (nonatomic, retain) IBOutlet UIButton *externalAccountButton;
|
||||
@property (retain, nonatomic) IBOutlet UIButton *remoteProvisioningButton;
|
||||
@property (retain, nonatomic) IBOutlet UILabel *remoteParamsLabel;
|
||||
|
||||
|
||||
@property (nonatomic, retain) IBOutlet UIImageView *choiceViewLogoImageView;
|
||||
|
|
@ -58,7 +59,7 @@
|
|||
@property (nonatomic, retain) IBOutlet UITapGestureRecognizer *viewTapGestureRecognizer;
|
||||
|
||||
- (void)reset;
|
||||
- (void)handleRemoteProvisioning;
|
||||
- (void)fillDefaultValues;
|
||||
|
||||
- (IBAction)onStartClick:(id)sender;
|
||||
- (IBAction)onBackClick:(id)sender;
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ typedef enum _ViewElement {
|
|||
@synthesize createAccountButton;
|
||||
@synthesize connectAccountButton;
|
||||
@synthesize externalAccountButton;
|
||||
@synthesize remoteProvisioningButton;
|
||||
@synthesize remoteParamsLabel;
|
||||
|
||||
@synthesize choiceViewLogoImageView;
|
||||
|
||||
|
|
@ -103,7 +105,8 @@ typedef enum _ViewElement {
|
|||
|
||||
[viewTapGestureRecognizer release];
|
||||
|
||||
[_remoteProvisioningButton release];
|
||||
[remoteProvisioningButton release];
|
||||
[remoteParamsLabel release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
@ -154,6 +157,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
[remoteParamsLabel setHidden:TRUE];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self
|
||||
name:kLinphoneRegistrationUpdate
|
||||
object:nil];
|
||||
|
|
@ -200,25 +204,52 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)handleRemoteProvisioning {
|
||||
- (void)fillDefaultValues {
|
||||
|
||||
LinphoneCore* lc = [LinphoneManager getLc];
|
||||
|
||||
[self resetTextFields];
|
||||
|
||||
LinphoneProxyConfig* current_conf = NULL;
|
||||
linphone_core_get_default_proxy([LinphoneManager getLc], ¤t_conf);
|
||||
if( current_conf != NULL ){
|
||||
const char* proxy_addr = linphone_proxy_config_get_identity(current_conf);
|
||||
if( proxy_addr ){
|
||||
LinphoneAddress *addr = linphone_address_new( proxy_addr );
|
||||
if( addr ){
|
||||
const LinphoneAuthInfo *auth = linphone_core_find_auth_info(lc, NULL, linphone_address_get_username(addr), linphone_proxy_config_get_domain(current_conf));
|
||||
linphone_address_destroy(addr);
|
||||
if( auth ){
|
||||
[LinphoneLogger log:LinphoneLoggerLog format:@"A proxy config was set up with the remote provisioning, skip wizard"];
|
||||
[self onCancelClick:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LinphoneProxyConfig* default_conf = linphone_core_create_proxy_config([LinphoneManager getLc]);
|
||||
const char* identity = linphone_proxy_config_get_identity(default_conf);
|
||||
if( identity ){
|
||||
LinphoneAddress* default_addr = linphone_address_new(identity);
|
||||
if( default_addr ){
|
||||
const char* domain = linphone_address_get_domain(default_addr);
|
||||
|
||||
const char* username = linphone_address_get_username(default_addr);
|
||||
if( domain && strlen(domain) > 0){
|
||||
UITextField* domainfield = [WizardViewController findTextField:ViewElement_Domain view:externalAccountView];
|
||||
UITextField* domainfield = [WizardViewController findTextField:ViewElement_Domain view:externalAccountView];
|
||||
[domainfield setText:[NSString stringWithUTF8String:domain]];
|
||||
}
|
||||
|
||||
if( username && strlen(username) > 0 && username[0] != '?' ){
|
||||
UITextField* userField = [WizardViewController findTextField:ViewElement_Username view:externalAccountView];
|
||||
[userField setText:[NSString stringWithUTF8String:username]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[self changeView:externalAccountView back:FALSE animation:TRUE];
|
||||
|
||||
[remoteParamsLabel setHidden:FALSE];
|
||||
|
||||
linphone_proxy_config_destroy(default_conf);
|
||||
|
||||
}
|
||||
|
|
@ -801,7 +832,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
switch (status) {
|
||||
case LinphoneConfiguringSuccessful:
|
||||
[self handleRemoteProvisioning];
|
||||
[self fillDefaultValues];
|
||||
break;
|
||||
case LinphoneConfiguringFailed:
|
||||
{
|
||||
|
|
@ -1019,6 +1050,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
|
||||
- (void)viewDidUnload {
|
||||
[self setRemoteProvisioningButton:nil];
|
||||
[self setRemoteParamsLabel:nil];
|
||||
[super viewDidUnload];
|
||||
}
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -157,3 +157,18 @@
|
|||
|
||||
/* Class = "IBUIImageView"; accessibilityLabel = "Icône de l'assistant de configuration de compte"; ObjectID = "128"; */
|
||||
"128.accessibilityLabel" = "Icône de l'assistant de configuration de compte";
|
||||
|
||||
/* Class = "IBUIButton"; accessibilityLabel = "Sign in SIP account"; ObjectID = "Kbn-dL-C5h"; */
|
||||
"Kbn-dL-C5h.accessibilityLabel" = "Sign in SIP account";
|
||||
|
||||
/* Class = "IBUIButton"; normalTitle = "Remote Provisioning"; ObjectID = "Kbn-dL-C5h"; */
|
||||
"Kbn-dL-C5h.normalTitle" = "Configuration distante";
|
||||
|
||||
/* Class = "IBUILabel"; text = "remote provisioning details"; ObjectID = "W9Y-Z9-Rmz"; */
|
||||
"W9Y-Z9-Rmz.text" = "remote provisioning details";
|
||||
|
||||
/* Class = "IBUILabel"; text = "Ces paramètres proviennent d'un fichier de provision récupéré ici:\n%@"; ObjectID = "bBb-47-pCq"; */
|
||||
"bBb-47-pCq.text" = "Ces paramètres proviennent d'un fichier de provision.";
|
||||
|
||||
/* Class = "IBUILabel"; text = "Invalid character:"; ObjectID = "uHm-NE-GLV"; */
|
||||
"uHm-NE-GLV.text" = "Invalid character:";
|
||||
|
|
|
|||
|
|
@ -169,3 +169,18 @@
|
|||
|
||||
/* Class = "IBUIImageView"; accessibilityLabel = "Иконка помощника настройки"; ObjectID = "128"; */
|
||||
"128.accessibilityLabel" = "Иконка помощника настройки";
|
||||
|
||||
/* Class = "IBUIButton"; accessibilityLabel = "Sign in SIP account"; ObjectID = "Kbn-dL-C5h"; */
|
||||
"Kbn-dL-C5h.accessibilityLabel" = "Sign in SIP account";
|
||||
|
||||
/* Class = "IBUIButton"; normalTitle = "Remote Provisioning"; ObjectID = "Kbn-dL-C5h"; */
|
||||
"Kbn-dL-C5h.normalTitle" = "Remote Provisioning";
|
||||
|
||||
/* Class = "IBUILabel"; text = "remote provisioning details"; ObjectID = "W9Y-Z9-Rmz"; */
|
||||
"W9Y-Z9-Rmz.text" = "remote provisioning details";
|
||||
|
||||
/* Class = "IBUILabel"; text = "These parameters were retrieve from the remote provisioning profile at this address:
%@"; ObjectID = "bBb-47-pCq"; */
|
||||
"bBb-47-pCq.text" = "These parameters were retrieve from the remote provisioning profile at this address:
%@";
|
||||
|
||||
/* Class = "IBUILabel"; text = "Invalid character:"; ObjectID = "uHm-NE-GLV"; */
|
||||
"uHm-NE-GLV.text" = "Invalid character:";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
[sip]
|
||||
sip_random_port=1
|
||||
contact="Linphone iPhone" <sip:linphone.iphone@unknown-host>
|
||||
keepalive_period=30000
|
||||
default_proxy=0
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ register_only_when_network_is_up=1
|
|||
auto_net_state_mon=0
|
||||
keepalive_period=30000
|
||||
ping_with_options=0
|
||||
sip_random_port=0
|
||||
|
||||
[rtp]
|
||||
audio_jitt_comp=60
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ register_only_when_network_is_up=1
|
|||
auto_net_state_mon=0
|
||||
keepalive_period=30000
|
||||
ping_with_options=0
|
||||
sip_random_port=0
|
||||
|
||||
[rtp]
|
||||
audio_jitt_comp=60
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
[sip]
|
||||
sip_random_port=1
|
||||
contact="Linphone iPhone" <sip:linphone.iphone@unknown-host>
|
||||
keepalive_period=30000
|
||||
default_proxy=0
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue