Page 1 sur 1

3CX

Posté : 04 avr. 2025 - 11:31
par smandel
Bonjour,

La version "msi" du client 3CX n'est plus mis à jour et je n'ai pas trouvé de paquet dans le store WAPT proposant la version MSIX à jour.
J'ai donc créé un paquet pour ceux que ça peut intéressé en m'inspirant du paquet Teams UWP du store.
Il faut au préalable télécharger les dernières versions des MSIX sur https://store.rg-adguard.net/
Il y a surement mieux au niveau du code mais ça marche :)

setup.py

Code : Tout sélectionner

# -*- coding: utf-8 -*-
from setuphelpers import *

appx_package_name = "3CX"
appx_dir = makepath(systemdrive,programfiles, "3CX", "3CX.msix")
appx_dir_dependance = makepath(systemdrive,programfiles, "3CX", "Microsoft.WindowsAppRuntime.1.6.msix")

def install():
    # Declare local variables
    bin_path = glob.glob(f"{appx_package_name}*.msix")[0]
    bin_path_dependance = glob.glob(f"Microsoft.WindowsAppRuntime.1.6.msix")[0]
    mkdirs(makepath(systemdrive,programfiles,"3CX"))

    filecopyto(bin_path, appx_dir)
    filecopyto(bin_path, appx_dir_dependance)

    # Remove old versions
    appxprovisionedpackage = run_powershell(f'Get-AppXProvisionedPackage -Online | Where-Object DisplayName -Like "{appx_package_name}*"')
    if appxprovisionedpackage is None:
        remove_appx(appx_package_name, False)
        appxprovisionedpackage = {"Version": "0"}
    elif force:
        uninstall()

    #Installing the application
    if Version(appxprovisionedpackage["Version"], 4) < Version(control.get_software_version(), 4):
        print(f"Installing: {bin_path.split(os.sep)[-1]} ({control.get_software_version()})")
        killalltasks(ensure_list(control.impacted_process))
        run_powershell(f'Add-AppxProvisionedPackage -Online -PackagePath "{bin_path_dependance}" -SkipLicense')
        run_powershell(f'Add-AppxProvisionedPackage -Online -PackagePath "{bin_path}" -SkipLicense')

    else:
        print(f'{appxprovisionedpackage["PackageName"]} is already installed and up-to-date.')

    if isdir(makepath(programfiles,"3CX")):
        remove_tree(makepath(programfiles,"3CX"))

def uninstall():
    print(f"Removing AppX: {appx_package_name}")
    remove_appx(appx_package_name)


def audit():
    # Declaring local variables
    audit_result = "OK"
    audit_version = True
    appxprovisionedpackage = run_powershell(f'Get-AppXProvisionedPackage -Online | Where-Object DisplayName -Like "{appx_package_name}*"')

    # Auditing software
    if appxprovisionedpackage is None:
        print(f"{appx_package_name} is not installed.")
        audit_result = "ERROR"
    elif audit_version:
        if Version(appxprovisionedpackage.get("Version", "0"), 4) < Version(control.get_software_version(), 4):
            print(
                f'{appxprovisionedpackage["PackageName"]} is installed in version: {appxprovisionedpackage["Version"]} instead of: {control.get_software_version()}.'
            )
            audit_result = "WARNING"
        else:
            print(f'{appxprovisionedpackage["PackageName"]} is installed and up-to-date.')
    else:
        print(f'{appxprovisionedpackage["PackageName"]} is installed.')

    return audit_result


def remove_appx(package, default_user=True):
    """Remove Windows AppX package from the computer environment, excluding NonRemovable packages.

    Args:
        package (str): AppX package name. You can use an asterisk (*) as a wildcard.
        default_user (bool): Remove AppX package from the Windows image to prevent installation for new users.

    .. versionchanged:: 2.5
        No longer try to remove NonRemovable AppX package

    .. versionchanger:: 2.6
        No longer use run_powershell for uninstall
    """

    if running_as_admin() or running_as_system():
        if default_user:
            ps_script = f'Get-AppXProvisionedPackage -Online | Where-Object DisplayName -Like ""{package}*"" | Remove-AppxProvisionedPackage -Online -AllUsers'
            run_powershell_script(ps_script, output_format="text")

        ps_script = f'Get-AppxPackage -Name ""{package}*"" -AllUsers | Where-Object -property NonRemovable -notlike True | Remove-AppxPackage -AllUsers'
        run_powershell_script(ps_script, output_format="text")

    else:
        ps_script = f'Get-AppxPackage -Name ""{package}"" | Where-Object -property NonRemovable -notlike True | Remove-AppxPackage'
        run_powershell_script(ps_script, output_format="text")
update-package.py

Code : Tout sélectionner

# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *


def update_package():
    # Declaring local variables
    package_updated = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()

    download_url = "https://downloads-global.3cx.com/downloads/3cxsoftphone/3CX.msix"
    latest_bin = download_url.split("/")[-1]

    # Deleting binaries
    remove_file(latest_bin)

    # Downloading latest binaries
    print("Download URL is: %s" % download_url)
    if not isfile(latest_bin):
        print("Downloading: %s" % latest_bin)
        wget(download_url, latest_bin, proxies=proxies)
    else:
        print("Binary is present: %s" % latest_bin)

    # Checking version from file
    if get_os_name() == "Windows" and "windows" in control.target_os.lower():
        version_bin = unzip(latest_bin, ".", "3CXSoftphone.exe")[0]
        version = get_version_from_binary(version_bin).split("+")[-2]
        remove_file((version_bin))
    else:
        version = control.get_software_version()

    # Changing version of the package
    if Version(version, 4) > Version(control.get_software_version(), 4):
        print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
        package_updated = True
    else:
        print("Software version up-to-date (%s)" % Version(version))
    control.set_software_version(version)
    control.save_control_to_wapt()

    # Validating update-package-sources
    return package_updated

    # # Changing version of the package and validating update-package-sources
    # return complete_control_version(control, version)
control

Code : Tout sélectionner

package           : xxx-3cx-msix
version           : 20.0.751.0-3
architecture      : x64
section           : base
priority          : optional
name              : 3CX
categories        : Office
maintainer        : xxx
description       : 3CX is a unified communications application that allows users to manage their calls, messages and meetings
depends           :
conflicts         :
maturity          : PROD
locale            : all
target_os         : windows
min_wapt_version  : 2.3
sources           : https://downloads-global.3cx.com/downloads/3cxsoftphone/3CX.msix
installed_size    : 271764868
impacted_process  : 3CXSoftphone
description_fr    : 3CX est une application de communication unifiée permettant aux utilisateurs de gérer leurs appels, leurs messages et leurs réunions
description_pl    : 3CX to aplikacja do ujednoliconej komunikacji, która pozwala użytkownikom zarządzać połączeniami, wiadomościami i spotkaniami
description_de    : 3CX ist eine Unified-Communications-Anwendung, mit der Benutzer ihre Anrufe, Nachrichten und Besprechungen verwalten können
description_es    : 3CX es una aplicación de comunicaciones unificadas que permite a los usuarios gestionar sus llamadas, mensajes y reuniones
description_pt    : A 3CX é uma aplicação de comunicações unificadas que permite aos utilizadores gerir as suas chamadas, mensagens e reuniões
description_it    : 3CX è un'applicazione per le comunicazioni unificate che consente agli utenti di gestire chiamate, messaggi e riunioni
description_nl    : 3CX is een toepassing voor Unified Communications waarmee gebruikers hun gesprekken, berichten en vergaderingen kunnen beheren
description_ru    : 3CX - это приложение для унифицированных коммуникаций, которое позволяет пользователям управлять своими звонками, сообщениями и встречами
audit_schedule    :
editor            : 3CX Software DMCC
keywords          : collaboration,meetings,video
licence           : proprietary_free,wapt_public
homepage          : https://www.3cx.com/
package_uuid      : 628a2ed4-e0b3-4e80-8fc6-87788d9a07b3
valid_from        :
valid_until       :
forced_install_on :
changelog         : https://www.3cx.com/blog/change-log/windows-app/

Re: 3CX

Posté : 04 avr. 2025 - 11:34
par smandel
Et ne pas oublier de déployer ces clés de registre sur les postes ou par GPO pour éviter des erreurs à l'installation du package :

Code : Tout sélectionner

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Appx]
"AllowDevelopmentWithoutDevLicense"=dword:00000001
"AllowAllTrustedApps"=dword:00000001