From 86ee6085635b8d384a63a9ffc2773b9ea8a46561 Mon Sep 17 00:00:00 2001 From: Stefano Date: Fri, 24 Nov 2023 17:15:12 +0100 Subject: [PATCH] Add outbound proxy to phone configuration (#284) * Add proxy to yealink template * don't enable proxy if variable is set and empty * Add proxy to Sangoma template * Add backup proxy to Sangoma template * Add proxy to nethphone template * Add proxy to Fanvil templates * Add proxy to Akuvox templates * Add proxy variables to documentation * Add proxy to Gigaset Maxwell template * Choose default proxy port keeping in account encryption configuration --- data/templates/akuvox.tmpl | 10 +++++----- data/templates/akuvox410w.tmpl | 10 +++++----- data/templates/akuvox480w.tmpl | 10 +++++----- data/templates/fanvil-V67.tmpl | 10 +++++----- data/templates/fanvil-X3.tmpl | 10 +++++----- data/templates/fanvil-X5.tmpl | 10 +++++----- data/templates/gigaset-Maxwell.tmpl | 8 ++++++++ data/templates/nethesis.tmpl | 10 +++++----- data/templates/sangoma.tmpl | 8 ++++++++ data/templates/yealink.tmpl | 14 +++++++------- docs/_data/variables.tsv | 4 ++++ 11 files changed, 62 insertions(+), 42 deletions(-) diff --git a/data/templates/akuvox.tmpl b/data/templates/akuvox.tmpl index ee0dc800..9fcbde82 100644 --- a/data/templates/akuvox.tmpl +++ b/data/templates/akuvox.tmpl @@ -196,11 +196,11 @@ Config.Account{{ line }}.SIP.TransType = {{ _context['account_encryption_' ~ lin Config.Account{{ line }}.SIP.ListenPortMin = 5062 Config.Account{{ line }}.SIP.ListenPortMax = 5062 -Config.Account{{ line }}.OUTPROXY.Enable = 0 -Config.Account{{ line }}.OUTPROXY.Server = -Config.Account{{ line }}.OUTPROXY.Port = 5060 -Config.Account{{ line }}.OUTPROXY.BakServer = -Config.Account{{ line }}.OUTPROXY.BakPort = 5060 +Config.Account{{ line }}.OUTPROXY.Enable = {{ _context['outbound_proxy_' ~ line] is defined and _context['outbound_proxy_' ~ line] != '' ? '1' : '0' }} +Config.Account{{ line }}.OUTPROXY.Server = {{ _context['outbound_proxy_' ~ line] is defined ? _context['outbound_proxy_' ~ line] : '' }} +Config.Account{{ line }}.OUTPROXY.Port = {{ _context['outbound_proxy_port_' ~ line] is defined ? _context['outbound_proxy_port_' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} +Config.Account{{ line }}.OUTPROXY.BakServer = {{ _context['outbound_proxy2_' ~ line] is defined ? _context['outbound_proxy2_' ~ line] : '' }} +Config.Account{{ line }}.OUTPROXY.BakPort = {{ _context['outbound_proxy2_port_' ~ line] is defined ? _context['outbound_proxy2_port' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} Config.Account{{ line }}.OUTPROXY.DHCPOption = 0 Config.Account{{ line }}.STUN.Enable = 0 diff --git a/data/templates/akuvox410w.tmpl b/data/templates/akuvox410w.tmpl index 81891c23..b535f0a4 100644 --- a/data/templates/akuvox410w.tmpl +++ b/data/templates/akuvox410w.tmpl @@ -196,11 +196,11 @@ Config.Account{{ line }}.SIP.TransType = {{ _context['account_encryption_' ~ lin Config.Account{{ line }}.SIP.ListenPortMin = 1024 Config.Account{{ line }}.SIP.ListenPortMax = 65535 -Config.Account{{ line }}.OUTPROXY.Enable = 0 -Config.Account{{ line }}.OUTPROXY.Server = -Config.Account{{ line }}.OUTPROXY.Port = 5060 -Config.Account{{ line }}.OUTPROXY.BakServer = -Config.Account{{ line }}.OUTPROXY.BakPort = 5060 +Config.Account{{ line }}.OUTPROXY.Enable = {{ _context['outbound_proxy_' ~ line] is defined and _context['outbound_proxy_' ~ line] != '' ? '1' : '0' }} +Config.Account{{ line }}.OUTPROXY.Server = {{ _context['outbound_proxy_' ~ line] is defined ? _context['outbound_proxy_' ~ line] : '' }} +Config.Account{{ line }}.OUTPROXY.Port = {{ _context['outbound_proxy_port_' ~ line] is defined ? _context['outbound_proxy_port_' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} +Config.Account{{ line }}.OUTPROXY.BakServer = {{ _context['outbound_proxy2_' ~ line] is defined ? _context['outbound_proxy2_' ~ line] : '' }} +Config.Account{{ line }}.OUTPROXY.BakPort = {{ _context['outbound_proxy2_port_' ~ line] is defined ? _context['outbound_proxy2_port' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} Config.Account{{ line }}.OUTPROXY.DHCPOption = 0 Config.Account{{ line }}.STUN.Enable = 0 diff --git a/data/templates/akuvox480w.tmpl b/data/templates/akuvox480w.tmpl index 8065c1e1..1a6fa056 100644 --- a/data/templates/akuvox480w.tmpl +++ b/data/templates/akuvox480w.tmpl @@ -196,11 +196,11 @@ Config.Account{{ line }}.SIP.TransType = {{ _context['account_encryption_' ~ lin Config.Account{{ line }}.SIP.ListenPortMin = 1024 Config.Account{{ line }}.SIP.ListenPortMax = 65535 -Config.Account{{ line }}.OUTPROXY.Enable = 0 -Config.Account{{ line }}.OUTPROXY.Server = -Config.Account{{ line }}.OUTPROXY.Port = 5060 -Config.Account{{ line }}.OUTPROXY.BakServer = -Config.Account{{ line }}.OUTPROXY.BakPort = 5060 +Config.Account{{ line }}.OUTPROXY.Enable = {{ _context['outbound_proxy_' ~ line] is defined and _context['outbound_proxy_' ~ line] != '' ? '1' : '0' }} +Config.Account{{ line }}.OUTPROXY.Server = {{ _context['outbound_proxy_' ~ line] is defined ? _context['outbound_proxy_' ~ line] : '' }} +Config.Account{{ line }}.OUTPROXY.Port = {{ _context['outbound_proxy_port_' ~ line] is defined ? _context['outbound_proxy_port_' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} +Config.Account{{ line }}.OUTPROXY.BakServer = {{ _context['outbound_proxy2_' ~ line] is defined ? _context['outbound_proxy2_' ~ line] : '' }} +Config.Account{{ line }}.OUTPROXY.BakPort = {{ _context['outbound_proxy2_port_' ~ line] is defined ? _context['outbound_proxy2_port' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} Config.Account{{ line }}.OUTPROXY.DHCPOption = 0 Config.Account{{ line }}.STUN.Enable = 0 diff --git a/data/templates/fanvil-V67.tmpl b/data/templates/fanvil-V67.tmpl index 1fb5989e..c381587c 100644 --- a/data/templates/fanvil-V67.tmpl +++ b/data/templates/fanvil-V67.tmpl @@ -117,13 +117,13 @@ SIP{{ line }} Backup Port : SIP{{ line }} Backup Transport :0 SIP{{ line }} Backup TTL :3600 SIP{{ line }} Enable Reg :1 -SIP{{ line }} Proxy Addr : -SIP{{ line }} Proxy Port : +SIP{{ line }} Proxy Addr :{{ _context['outbound_proxy_' ~ line] is defined ? _context['outbound_proxy_' ~ line] : '' }} +SIP{{ line }} Proxy Port :{{ _context['outbound_proxy_port_' ~ line] is defined ? _context['outbound_proxy_port_' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} SIP{{ line }} Proxy User : SIP{{ line }} Proxy Pswd : -SIP{{ line }} BakProxy Addr : -SIP{{ line }} BakProxy Port : -SIP{{ line }} Enable Failback :0 +SIP{{ line }} BakProxy Addr :{{ _context['outbound_proxy2_' ~ line] is defined ? _context['outbound_proxy2_' ~ line] : '' }} +SIP{{ line }} BakProxy Port :{{ _context['outbound_proxy2_port_' ~ line] is defined ? _context['outbound_proxy2_port' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} +SIP{{ line }} Enable Failback :{{ _context['outbound_proxy2_' ~ line] is defined and _context['outbound_proxy2_' ~ line] != '' ? '1' : '0' }} SIP{{ line }} Failback Interval :1800 SIP{{ line }} Signal Failback :0 SIP{{ line }} Signal Retry Counts:3 diff --git a/data/templates/fanvil-X3.tmpl b/data/templates/fanvil-X3.tmpl index c7991544..7bb7c0e5 100644 --- a/data/templates/fanvil-X3.tmpl +++ b/data/templates/fanvil-X3.tmpl @@ -230,13 +230,13 @@ SIP{{ line }} Backup Transpo:0 SIP{{ line }} Backup TTL :3600 SIP{{ line }} Backup Mode :0 SIP{{ line }} Enable Reg :1 -SIP{{ line }} Proxy Addr : -SIP{{ line }} Proxy Port : +SIP{{ line }} Proxy Addr :{{ _context['outbound_proxy_' ~ line] is defined ? _context['outbound_proxy_' ~ line] : '' }} +SIP{{ line }} Proxy Port :{{ _context['outbound_proxy_port_' ~ line] is defined ? _context['outbound_proxy_port_' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} SIP{{ line }} Proxy User : SIP{{ line }} Proxy Pswd : -SIP{{ line }} BakProxy Addr : -SIP{{ line }} BakProxy Port : -SIP{{ line }} Enable Failbac:0 +SIP{{ line }} BakProxy Addr :{{ _context['outbound_proxy2_' ~ line] is defined ? _context['outbound_proxy2_' ~ line] : '' }} +SIP{{ line }} BakProxy Port :{{ _context['outbound_proxy2_port_' ~ line] is defined ? _context['outbound_proxy2_port' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} +SIP{{ line }} Enable Failbac:{{ _context['outbound_proxy2_' ~ line] is defined and _context['outbound_proxy2_' ~ line] != '' ? '1' : '0' }} SIP{{ line }} Failback Hold :1 SIP{{ line }} Failback Inter:1800 SIP{{ line }} Signal Failbac:0 diff --git a/data/templates/fanvil-X5.tmpl b/data/templates/fanvil-X5.tmpl index bb565fcf..27c524d3 100644 --- a/data/templates/fanvil-X5.tmpl +++ b/data/templates/fanvil-X5.tmpl @@ -121,13 +121,13 @@ SIP{{ line }} Backup Port : SIP{{ line }} Backup Transport :0 SIP{{ line }} Backup TTL :3600 SIP{{ line }} Enable Reg :1 -SIP{{ line }} Proxy Addr : -SIP{{ line }} Proxy Port : +SIP{{ line }} Proxy Addr :{{ _context['outbound_proxy_' ~ line] is defined ? _context['outbound_proxy_' ~ line] : '' }} +SIP{{ line }} Proxy Port :{{ _context['outbound_proxy_port_' ~ line] is defined ? _context['outbound_proxy_port_' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} SIP{{ line }} Proxy User : SIP{{ line }} Proxy Pswd : -SIP{{ line }} BakProxy Addr : -SIP{{ line }} BakProxy Port : -SIP{{ line }} Enable Failback :0 +SIP{{ line }} BakProxy Addr :{{ _context['outbound_proxy2_' ~ line] is defined ? _context['outbound_proxy2_' ~ line] : '' }} +SIP{{ line }} BakProxy Port :{{ _context['outbound_proxy2_port_' ~ line] is defined ? _context['outbound_proxy2_port' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} +SIP{{ line }} Enable Failback :{{ _context['outbound_proxy2_' ~ line] is defined and _context['outbound_proxy2_' ~ line] != '' ? '1' : '0' }} SIP{{ line }} Failback Interval :1800 SIP{{ line }} Signal Failback :0 SIP{{ line }} Signal Retry Counts:3 diff --git a/data/templates/gigaset-Maxwell.tmpl b/data/templates/gigaset-Maxwell.tmpl index 42557da0..17113cfb 100644 --- a/data/templates/gigaset-Maxwell.tmpl +++ b/data/templates/gigaset-Maxwell.tmpl @@ -55,8 +55,16 @@ + {% if _context['outbound_proxy_' ~ line] is defined and _context['outbound_proxy_' ~ line] != '' %} + + + + + + {% else %} + {% endif %} diff --git a/data/templates/nethesis.tmpl b/data/templates/nethesis.tmpl index 9a9b62eb..61db1b29 100644 --- a/data/templates/nethesis.tmpl +++ b/data/templates/nethesis.tmpl @@ -117,13 +117,13 @@ SIP{{ line }} Backup Port : SIP{{ line }} Backup Transport :0 SIP{{ line }} Backup TTL :3600 SIP{{ line }} Enable Reg :1 -SIP{{ line }} Proxy Addr : -SIP{{ line }} Proxy Port : +SIP{{ line }} Proxy Addr :{{ _context['outbound_proxy_' ~ line] is defined ? _context['outbound_proxy_' ~ line] : '' }} +SIP{{ line }} Proxy Port :{{ _context['outbound_proxy_port_' ~ line] is defined ? _context['outbound_proxy_port_' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} SIP{{ line }} Proxy User : SIP{{ line }} Proxy Pswd : -SIP{{ line }} BakProxy Addr : -SIP{{ line }} BakProxy Port : -SIP{{ line }} Enable Failback :0 +SIP{{ line }} BakProxy Addr :{{ _context['outbound_proxy2_' ~ line] is defined ? _context['outbound_proxy2_' ~ line] : '' }} +SIP{{ line }} BakProxy Port :{{ _context['outbound_proxy2_port_' ~ line] is defined ? _context['outbound_proxy2_port' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} +SIP{{ line }} Enable Failback :{{ _context['outbound_proxy2_' ~ line] is defined and _context['outbound_proxy2_' ~ line] != '' ? '1' : '0' }} SIP{{ line }} Failback Interval :1800 SIP{{ line }} Signal Failback :0 SIP{{ line }} Signal Retry Counts:3 diff --git a/data/templates/sangoma.tmpl b/data/templates/sangoma.tmpl index 0145a07c..e5dc18d3 100644 --- a/data/templates/sangoma.tmpl +++ b/data/templates/sangoma.tmpl @@ -10,8 +10,16 @@ 1 + {% if outbound_proxy_1 is defined and outbound_proxy_1 != '' %} + {{ outbound_proxy_1 }}:{{ outbound_proxy_port_1 is defined and outbound_proxy_port_1 != '' ? outbound_proxy_port_1 : account_encryption_1 ? '5061' : '5060' }} + {% else %} + {% endif %} + {% if outbound_proxy_1 is defined and outbound_proxy_1 != '' and outbound_proxy2_1 is defined and outbound_proxy2_1 != '' %} + {{ outbound_proxy2_1 }}:{{ outbound_proxy2_port_1 is defined and outbound_proxy2_port_1 != '' ? outbound_proxy2_port_1 : account_encryption_1 ? '5061' : '5060' }} + {% else %} + {% endif %} {{ account_encryption_1 ? '2' : '0' }} 2 {{ account_display_name_1 }} diff --git a/data/templates/yealink.tmpl b/data/templates/yealink.tmpl index 2a2fb550..13300dfc 100644 --- a/data/templates/yealink.tmpl +++ b/data/templates/yealink.tmpl @@ -1831,11 +1831,11 @@ account.{{ line }}.sip_server.1.transport_type = {{ _context['account_encryption account.{{ line }}.sip_server.1.expires = 3600 account.{{ line }}.sip_server.1.retry_counts = 3 -account.{{ line }}.outbound_proxy_enable = 0 -account.{{ line }}.outbound_proxy.1.address = -account.{{ line }}.outbound_proxy.1.port = 5060 -account.{{ line }}.outbound_proxy.2.address = -account.{{ line }}.outbound_proxy.2.port = 5060 +account.{{ line }}.outbound_proxy_enable = {{ _context['outbound_proxy_' ~ line] is defined and _context['outbound_proxy_' ~ line] != '' ? '1' : '0' }} +account.{{ line }}.outbound_proxy.1.address = {{ _context['outbound_proxy_' ~ line] is defined ? _context['outbound_proxy_' ~ line] : '' }} +account.{{ line }}.outbound_proxy.1.port = {{ _context['outbound_proxy_port_' ~ line] is defined ? _context['outbound_proxy_port_' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} +account.{{ line }}.outbound_proxy.2.address = {{ _context['outbound_proxy2_' ~ line] is defined ? _context['outbound_proxy2_' ~ line] : '' }} +account.{{ line }}.outbound_proxy.2.port = {{ _context['outbound_proxy2_port_' ~ line] is defined ? _context['outbound_proxy2_port' ~ line] : _context['account_encryption_' ~ line] ? '5061' : '5060' }} account.{{ line }}.outbound_proxy_fallback_interval = 3600 account.{{ line }}.nat.nat_traversal = 0 @@ -1921,8 +1921,8 @@ account.{{ line }}.reg_failed_retry_min_time = 0 account.{{ line }}.redundancy_with_reg_fail.enable = 0 ##V83 Add -account.{{ line }}.sip_server.1.outbound_proxy_enable = 0 -account.{{ line }}.sip_server.2.outbound_proxy_enable = 0 +account.{{ line }}.sip_server.1.outbound_proxy_enable = {{ _context['outbound_proxy_' ~ line] is defined ? '1' : '0' }} +account.{{ line }}.sip_server.2.outbound_proxy_enable = {{ _context['outbound_proxy2_' ~ line] is defined ? '1' : '0' }} ################################################################ # SIP Basic config ## diff --git a/docs/_data/variables.tsv b/docs/_data/variables.tsv index 739d8ce2..4ff65af1 100644 --- a/docs/_data/variables.tsv +++ b/docs/_data/variables.tsv @@ -65,6 +65,10 @@ rw dss_transfer Call transfer mode. string one of `verify`,`attended`,`blind` ro cap_dss_transfer_blacklist Comma separate list of [dss_transfer](#dss_transfer) modes that are not supported by the phone. string rw adminpw Phone and web UI admin password. string rw userpw Phone and web UI user password. string +rw outbound_proxy_$line string Outbound proxy IP/host name +rw outbound_proxy_port_$line integer Outbound proxy port +rw outbound_proxy2_$line string Backup outbound proxy IP/host name +rw outbound_proxy2_port_$line integer Backup outbound proxy port ro provisioning_complete The provisioning is considered complete when the phone uses `tok2` for authentication. The temporary `tok1` token is invalidated. boolean rw provisioning_url_scheme URI scheme to fetch the provisioning resources. string one of `http`, `https` rw provisioning_url_path Basic URI path component, that is prefixed to the security token and file name components, e.g. `/provisioning/`. string