Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gigaset N720, tune code tone #184

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/wazo-gigaset/N720/plugin-info
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1.14",
"version": "0.1.15",
"description": "Plugin for Gigaset N720 IP/DM PRO.",
"description_fr": "Greffon pour Gigaset N720 IP/DM PRO.",
"capabilities": {
Expand Down
1 change: 1 addition & 0 deletions plugins/wazo-gigaset/N720/templates/base.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<SYMB_ITEM ID="BS_IP_Data.aucS_HTTP_PROXY_URL[%]" class="symb_item" value='""'/>
<SYMB_ITEM ID="BS_IP_Data.uiI_HTTP_PROXY_PORT" class="symb_item" value="8080"/>
<SYMB_ITEM ID="BS_IP_Data.ucI_HTTPLANGUAGE" class="symb_item" value="1"/>
<SYMB_ITEM ID="BS_AE_SwConfig.ucCountryCodeTone" class="symb_item" value="{{ XX_country }}"/>

{%- if ntp_enabled %}
<SYMB_ITEM ID="BS_IP_Data.aucS_TIME_NTP_SERVER[%]" class="symb_item" value='"{{ ntp_ip }}"'/>
Expand Down
18 changes: 17 additions & 1 deletion plugins/wazo-gigaset/common/common.py
BnLG marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Copyright 2011-2023 The Wazo Authors (see the AUTHORS file)
Copyright 2016-2023 The Wazo Authors (see the AUTHORS file)
SPDX-License-Identifier: GPL-3.0-or-later

Common code shared by the various wazo-gigaset plugins.
Expand Down Expand Up @@ -129,6 +129,14 @@ def path_preprocess(self, request):
class BaseGigasetPlugin(StandardPlugin):
_ENCODING = 'UTF-8'

_COUNTRY_CODE = {
'de_DE': '0',
'en_US': '1',
'es_ES': '6',
'fr_FR': '7',
'fr_CA': '1',
}

_TZ_GIGASET = {
(-12, 0): 0x00,
(-11, 0): 0x01,
Expand Down Expand Up @@ -193,6 +201,13 @@ def _add_phonebook(self, raw_config):
uuid_format = '{scheme}://{hostname}:{port}/0.1/directories/lookup/default/gigaset/{user_uuid}?' # noqa: E501
plugins.add_xivo_phonebook_url_from_format(raw_config, uuid_format)

def _add_country_code(self, raw_config):
locale = raw_config.get('locale')
if locale in self._COUNTRY_CODE:
raw_config['XX_country'] = self._COUNTRY_CODE[locale]
else:
raw_config['XX_country'] = '0'

def _add_timezone_code(self, raw_config):
timezone = raw_config.get('timezone', 'Etc/UTC')
tz_db = tzinform.TextTimezoneInfoDB()
Expand Down Expand Up @@ -234,6 +249,7 @@ def configure(self, device, raw_config):
filename = self._dev_specific_filename(device)
tpl = self._tpl_helper.get_dev_template(filename, device)

self._add_country_code(raw_config)
self._add_sip_info(raw_config)
self._add_xx_vars(device, raw_config)
self._add_phonebook(raw_config)
Expand Down