mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-17 20:08:31 +00:00
Add SIP proxy URL and outbound proxy to third party registration and account settings
This commit is contained in:
parent
0f6d8b1296
commit
f08bb865aa
7 changed files with 93 additions and 18 deletions
|
|
@ -2,6 +2,6 @@ import Foundation
|
||||||
|
|
||||||
public enum AppGitInfo {
|
public enum AppGitInfo {
|
||||||
public static let branch = "master"
|
public static let branch = "master"
|
||||||
public static let commit = "d39e4a0e3"
|
public static let commit = "0f6d8b129"
|
||||||
public static let tag = "6.1.0-alpha"
|
public static let tag = "6.1.0-alpha"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@
|
||||||
"account_settings_outbound_proxy_title" = "Outbound proxy";
|
"account_settings_outbound_proxy_title" = "Outbound proxy";
|
||||||
"account_settings_push_notification_not_available_title" = "Push notifications aren't available!";
|
"account_settings_push_notification_not_available_title" = "Push notifications aren't available!";
|
||||||
"account_settings_push_notification_title" = "Allow push notifications";
|
"account_settings_push_notification_title" = "Allow push notifications";
|
||||||
"account_settings_sip_proxy_url_title" = "SIP proxy server URL";
|
"account_settings_sip_proxy_url_title" = "Registrar URI";
|
||||||
|
"account_settings_outbound_proxy_title" = "Outbound SIP Proxy URI";
|
||||||
"account_settings_stun_server_url_title" = "STUN/TURN server URL";
|
"account_settings_stun_server_url_title" = "STUN/TURN server URL";
|
||||||
"account_settings_title" = "Account settings";
|
"account_settings_title" = "Account settings";
|
||||||
"account_settings_turn_password_title" = "TURN password";
|
"account_settings_turn_password_title" = "TURN password";
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@
|
||||||
"account_settings_outbound_proxy_title" = "Serveur mandataire sortant";
|
"account_settings_outbound_proxy_title" = "Serveur mandataire sortant";
|
||||||
"account_settings_push_notification_not_available_title" = "Notifications push non disponibles";
|
"account_settings_push_notification_not_available_title" = "Notifications push non disponibles";
|
||||||
"account_settings_push_notification_title" = "Activer les notifications";
|
"account_settings_push_notification_title" = "Activer les notifications";
|
||||||
"account_settings_sip_proxy_url_title" = "URL du serveur mandataire";
|
"account_settings_sip_proxy_url_title" = "Registrar URI";
|
||||||
|
"account_settings_outbound_proxy_title" = "URI du proxy SIP sortant";
|
||||||
"account_settings_stun_server_url_title" = "URL du serveur STUN/TURN";
|
"account_settings_stun_server_url_title" = "URL du serveur STUN/TURN";
|
||||||
"account_settings_title" = "Paramètres de compte";
|
"account_settings_title" = "Paramètres de compte";
|
||||||
"account_settings_turn_password_title" = "Mot de passe TURN";
|
"account_settings_turn_password_title" = "Mot de passe TURN";
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ struct ThirdPartySipAccountLoginFragment: View {
|
||||||
@FocusState var isPasswordFocused: Bool
|
@FocusState var isPasswordFocused: Bool
|
||||||
@FocusState var isDomainFocused: Bool
|
@FocusState var isDomainFocused: Bool
|
||||||
@FocusState var isDisplayNameFocused: Bool
|
@FocusState var isDisplayNameFocused: Bool
|
||||||
@FocusState var isSipProxyUrlFocused: Bool
|
|
||||||
@FocusState var isAuthIdFocused: Bool
|
@FocusState var isAuthIdFocused: Bool
|
||||||
|
@FocusState var isSipProxyUrlFocused: Bool
|
||||||
@FocusState var isOutboundProxyFocused: Bool
|
@FocusState var isOutboundProxyFocused: Bool
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
|
@ -289,13 +289,14 @@ struct ThirdPartySipAccountLoginFragment: View {
|
||||||
)
|
)
|
||||||
.focused($isAuthIdFocused)
|
.focused($isAuthIdFocused)
|
||||||
}
|
}
|
||||||
|
.padding(.bottom)
|
||||||
|
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
Text("account_settings_sip_proxy_url_title")
|
Text("account_settings_sip_proxy_url_title")
|
||||||
.default_text_style_700(styleSize: 15)
|
.default_text_style_700(styleSize: 15)
|
||||||
.padding(.bottom, -5)
|
.padding(.bottom, -5)
|
||||||
|
|
||||||
TextField("account_settings_sip_proxy_url_title", text: $accountLoginViewModel.outboundProxy)
|
TextField("account_settings_sip_proxy_url_title", text: $accountLoginViewModel.sipProxyUrl)
|
||||||
.id(2)
|
.id(2)
|
||||||
.default_text_style(styleSize: 15)
|
.default_text_style(styleSize: 15)
|
||||||
.frame(height: 25)
|
.frame(height: 25)
|
||||||
|
|
@ -306,11 +307,33 @@ struct ThirdPartySipAccountLoginFragment: View {
|
||||||
.overlay(
|
.overlay(
|
||||||
RoundedRectangle(cornerRadius: 60)
|
RoundedRectangle(cornerRadius: 60)
|
||||||
.inset(by: 0.5)
|
.inset(by: 0.5)
|
||||||
.stroke(isOutboundProxyFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
.stroke(isSipProxyUrlFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||||
)
|
)
|
||||||
.focused($isOutboundProxyFocused)
|
.focused($isSipProxyUrlFocused)
|
||||||
}
|
}
|
||||||
.padding(.bottom)
|
.padding(.bottom)
|
||||||
|
|
||||||
|
VStack(alignment: .leading) {
|
||||||
|
Text("account_settings_outbound_proxy_title")
|
||||||
|
.default_text_style_700(styleSize: 15)
|
||||||
|
.padding(.bottom, -5)
|
||||||
|
|
||||||
|
TextField("account_settings_outbound_proxy_title", text: $accountLoginViewModel.outboundProxy)
|
||||||
|
.id(3)
|
||||||
|
.default_text_style(styleSize: 15)
|
||||||
|
.frame(height: 25)
|
||||||
|
.padding(.horizontal, 20)
|
||||||
|
.padding(.vertical, 15)
|
||||||
|
.background(.white)
|
||||||
|
.cornerRadius(60)
|
||||||
|
.overlay(
|
||||||
|
RoundedRectangle(cornerRadius: 60)
|
||||||
|
.inset(by: 0.5)
|
||||||
|
.stroke(isOutboundProxyFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||||
|
)
|
||||||
|
.focused($isOutboundProxyFocused)
|
||||||
|
}
|
||||||
|
.padding(.bottom)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
.frame(maxWidth: SharedMainViewModel.shared.maxWidth)
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ class AccountLoginViewModel: ObservableObject {
|
||||||
@Published var displayName: String = ""
|
@Published var displayName: String = ""
|
||||||
@Published var transportType: String = "TLS"
|
@Published var transportType: String = "TLS"
|
||||||
@Published var authId: String = ""
|
@Published var authId: String = ""
|
||||||
|
@Published var sipProxyUrl: String = ""
|
||||||
@Published var outboundProxy: String = ""
|
@Published var outboundProxy: String = ""
|
||||||
|
|
||||||
private var mCoreDelegate: CoreDelegate!
|
private var mCoreDelegate: CoreDelegate!
|
||||||
|
|
@ -102,18 +103,27 @@ class AccountLoginViewModel: ObservableObject {
|
||||||
|
|
||||||
// We also need to configure where the proxy server is located
|
// We also need to configure where the proxy server is located
|
||||||
var serverAddress: Address
|
var serverAddress: Address
|
||||||
if (!self.outboundProxy.isEmpty) {
|
if (!self.sipProxyUrl.isEmpty) {
|
||||||
let server = self.outboundProxy.starts(with: "sip:") ? self.outboundProxy : String("sip:" + self.outboundProxy)
|
let server = self.sipProxyUrl.starts(with: "sip:") ? self.sipProxyUrl : String("sip:" + self.sipProxyUrl)
|
||||||
serverAddress = try Factory.Instance.createAddress(addr: server)
|
serverAddress = try Factory.Instance.createAddress(addr: server)
|
||||||
} else {
|
} else {
|
||||||
serverAddress = try Factory.Instance.createAddress(addr: String("sip:" + self.domain))
|
serverAddress = try Factory.Instance.createAddress(addr: String("sip:" + self.domain))
|
||||||
}
|
}
|
||||||
|
|
||||||
let address = serverAddress
|
|
||||||
|
|
||||||
// We use the Address object to easily set the transport protocol
|
// We use the Address object to easily set the transport protocol
|
||||||
try address.setTransport(newValue: transport)
|
try serverAddress.setTransport(newValue: transport)
|
||||||
try accountParams.setServeraddress(newValue: address)
|
try accountParams.setServeraddress(newValue: serverAddress)
|
||||||
|
|
||||||
|
var routeAddress: Address
|
||||||
|
if (!self.outboundProxy.isEmpty) {
|
||||||
|
let server = self.outboundProxy.starts(with: "sip:") ? self.outboundProxy : String("sip:" + self.outboundProxy)
|
||||||
|
routeAddress = try Factory.Instance.createAddress(addr: server)
|
||||||
|
try routeAddress.setTransport(newValue: transport)
|
||||||
|
try accountParams.setRoutesaddresses(newValue: [routeAddress])
|
||||||
|
} else {
|
||||||
|
try accountParams.setRoutesaddresses(newValue: [])
|
||||||
|
}
|
||||||
|
|
||||||
// And we ensure the account will start the registration process
|
// And we ensure the account will start the registration process
|
||||||
accountParams.registerEnabled = true
|
accountParams.registerEnabled = true
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ struct AccountSettingsFragment: View {
|
||||||
@FocusState var isTurnUsernameFocused: Bool
|
@FocusState var isTurnUsernameFocused: Bool
|
||||||
@FocusState var isTurnPasswordFocused: Bool
|
@FocusState var isTurnPasswordFocused: Bool
|
||||||
@FocusState var isSipProxyUrlFocused: Bool
|
@FocusState var isSipProxyUrlFocused: Bool
|
||||||
|
@FocusState var isOutboundProxyFocused: Bool
|
||||||
@FocusState var isSettingsExpireFocused: Bool
|
@FocusState var isSettingsExpireFocused: Bool
|
||||||
@FocusState var isConferenceFactoryUriFocused: Bool
|
@FocusState var isConferenceFactoryUriFocused: Bool
|
||||||
@FocusState var isAudioVideoConferenceFactoryUriFocused: Bool
|
@FocusState var isAudioVideoConferenceFactoryUriFocused: Bool
|
||||||
|
|
@ -354,8 +355,25 @@ struct AccountSettingsFragment: View {
|
||||||
.focused($isSipProxyUrlFocused)
|
.focused($isSipProxyUrlFocused)
|
||||||
}
|
}
|
||||||
|
|
||||||
Toggle("account_settings_outbound_proxy_title", isOn: $accountSettingsViewModel.outboundProxy)
|
VStack(alignment: .leading) {
|
||||||
.default_text_style_700(styleSize: 15)
|
Text("account_settings_outbound_proxy_title")
|
||||||
|
.default_text_style_700(styleSize: 15)
|
||||||
|
.padding(.bottom, -5)
|
||||||
|
|
||||||
|
TextField("account_settings_outbound_proxy_title", text: $accountSettingsViewModel.outboundProxy)
|
||||||
|
.default_text_style(styleSize: 15)
|
||||||
|
.frame(height: 25)
|
||||||
|
.padding(.horizontal, 20)
|
||||||
|
.padding(.vertical, 15)
|
||||||
|
.background(.white)
|
||||||
|
.cornerRadius(60)
|
||||||
|
.overlay(
|
||||||
|
RoundedRectangle(cornerRadius: 60)
|
||||||
|
.inset(by: 0.5)
|
||||||
|
.stroke(isOutboundProxyFocused ? Color.orangeMain500 : Color.gray200, lineWidth: 1)
|
||||||
|
)
|
||||||
|
.focused($isOutboundProxyFocused)
|
||||||
|
}
|
||||||
|
|
||||||
Toggle("account_settings_avpf_title", isOn: $accountSettingsViewModel.avpf)
|
Toggle("account_settings_avpf_title", isOn: $accountSettingsViewModel.avpf)
|
||||||
.default_text_style_700(styleSize: 15)
|
.default_text_style_700(styleSize: 15)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ class AccountSettingsViewModel: ObservableObject {
|
||||||
@Published var turnPassword: String
|
@Published var turnPassword: String
|
||||||
@Published var transport: String
|
@Published var transport: String
|
||||||
@Published var sipProxyUrl: String
|
@Published var sipProxyUrl: String
|
||||||
@Published var outboundProxy: Bool
|
@Published var outboundProxy: String
|
||||||
@Published var avpf: Bool
|
@Published var avpf: Bool
|
||||||
@Published var bundleMode: Bool
|
@Published var bundleMode: Bool
|
||||||
@Published var cpimInBasicConversations: Bool
|
@Published var cpimInBasicConversations: Bool
|
||||||
|
|
@ -82,7 +82,7 @@ class AccountSettingsViewModel: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.sipProxyUrl = accountModel.account.params?.serverAddress?.asStringUriOnly() ?? ""
|
self.sipProxyUrl = accountModel.account.params?.serverAddress?.asStringUriOnly() ?? ""
|
||||||
self.outboundProxy = accountModel.account.params?.outboundProxyEnabled ?? false
|
self.outboundProxy = accountModel.account.params?.routesAddresses.first?.asStringUriOnly() ?? ""
|
||||||
self.avpf = accountModel.account.avpfEnabled
|
self.avpf = accountModel.account.avpfEnabled
|
||||||
self.bundleMode = accountModel.account.params?.rtpBundleEnabled ?? false
|
self.bundleMode = accountModel.account.params?.rtpBundleEnabled ?? false
|
||||||
self.cpimInBasicConversations = accountModel.account.params?.cpimInBasicChatRoomEnabled ?? false
|
self.cpimInBasicConversations = accountModel.account.params?.cpimInBasicChatRoomEnabled ?? false
|
||||||
|
|
@ -140,7 +140,29 @@ class AccountSettingsViewModel: ObservableObject {
|
||||||
try? newParams.setServeraddress(newValue: serverAddress)
|
try? newParams.setServeraddress(newValue: serverAddress)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newParams.outboundProxyEnabled = self.outboundProxy
|
|
||||||
|
if !self.outboundProxy.isEmpty {
|
||||||
|
Log.info("\(AccountSettingsViewModel.TAG) Outbound proxy server set to \(self.outboundProxy)")
|
||||||
|
if let outboundProxyAddress = core.interpretUrl(url: self.outboundProxy, applyInternationalPrefix: false) {
|
||||||
|
var transportTmp: TransportType = .Tls
|
||||||
|
if self.transport == "TLS" {
|
||||||
|
transportTmp = .Tls
|
||||||
|
} else if self.transport == "TCP" {
|
||||||
|
transportTmp = .Tcp
|
||||||
|
} else if self.transport == "UDP" {
|
||||||
|
transportTmp = .Udp
|
||||||
|
} else {
|
||||||
|
transportTmp = .Dtls
|
||||||
|
}
|
||||||
|
|
||||||
|
try? outboundProxyAddress.setTransport(newValue: transportTmp)
|
||||||
|
try? newParams.setRoutesaddresses(newValue: [outboundProxyAddress])
|
||||||
|
} else {
|
||||||
|
Log.error("\(AccountSettingsViewModel.TAG) Failed to parse outbound proxy server!")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try? newParams.setRoutesaddresses(newValue: [])
|
||||||
|
}
|
||||||
|
|
||||||
if let natPolicy = self.natPolicy {
|
if let natPolicy = self.natPolicy {
|
||||||
print("\(AccountSettingsViewModel.TAG) Also applying changes to NAT policy")
|
print("\(AccountSettingsViewModel.TAG) Also applying changes to NAT policy")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue