« Astreinte » : différence entre les versions
Apparence
| Ligne 2 : | Ligne 2 : | ||
== via script== | == via script== | ||
< | <pre> | ||
using System; | using System; | ||
using System.Threading.Tasks; | using System.Threading.Tasks; | ||
| Ligne 60 : | Ligne 60 : | ||
} | } | ||
} | } | ||
}</ | }</pre> | ||
[[Catégorie:3CX]] | [[Catégorie:3CX]] | ||
Version du 1 avril 2026 à 16:57
par les statuts
via script
using System;
using System.Threading.Tasks;
using TCX.Configuration;
using CallFlow;
using System.Linq;
using System.Collections.Generic;
namespace dummy
{
public class SetDynamicAstreinte : ScriptBase<SetDynamicAstreinte>
{
public override Task<bool> StartAsync()
{
string targetExtNum = "111";
string mobileElu = "0743031843";
string profileName = "Away";
// --- AJOUT : Nommage de l'astreinte ---
string prenomElu = "ASTREINTE";
string nomElu = "ELU 6"; // Changez ceci pour chaque élu (ex: "DUPONT", "MAIRE", etc.)
try
{
IPhoneSystem ps = PhoneSystem.Root;
Extension targetExt = ps.GetDNByNumber(targetExtNum) as Extension;
if (targetExt != null)
{
// 1. Mise à jour du numéro de mobile
targetExt.SetProperty("MOBILENUMBER", mobileElu);
// 2. MISE À JOUR DU NOM (Affichage sur les téléphones)
targetExt.FirstName = prenomElu;
targetExt.LastName = nomElu;
// 3. Changement du profil de statut
var profile = targetExt.FwdProfiles.FirstOrDefault(p => p.Name.Equals(profileName, StringComparison.OrdinalIgnoreCase));
if (profile != null)
{
targetExt.CurrentProfile = profile;
}
// 4. Sauvegarde globale
targetExt.ResetCurrentProfileOverride();
targetExt.Save();
return Task.FromResult(true);
}
}
catch (Exception)
{
// Erreur silencieuse
}
return Task.FromResult(false);
}
}
}