Humm no ! 3CX is not a ONLY Voice Plateform.+1
You're a voice platform, not a replacement for Teams
If you want to block this feature for all users, it's simple: set the number of LiveChat connections per visitor IP address to 0.
Doesn't stop you having to add a link name every time you edit a user without one. It would make much more sense that if the link name was blank, chat was disabled for that user.
Making it a mandatory field is a PITA for general admin.


// Guillaume Bourgeois, 2024-08-05
// Objective: Update Talk Link names in a telephony system for extensions only, play a goodbye message, and terminate the call.
// Script language: C#
// Disclaimer: This script is provided as is without support from 3CX. Use at your own risk.
// Note: It is recommended to perform a backup of your 3CX system before implementing any third-party scripts.
#nullable disable
using CallFlow;
using System;
using System.Threading.Tasks;
using TCX.Configuration;
namespace UpdateTalkLinkNames
{
public class TalkLinkNameScript : ScriptBase<TalkLinkNameScript>
{
// Define the PhoneSystem variable and the path for the goodbye audio file.
private PhoneSystem ps = null;
private readonly string goodbyeAudioPath = "/var/lib/3cxpbx/Instance1/Data/Ivr/Prompts/Sets/8210986B-9412-497f-AD77-3A554F4A9BDB/thankyou_goodbye.wav";
// Override the StartAsync method from ScriptBase to provide the script's main logic.
public override async Task<bool> StartAsync()
{
// Attempt to retrieve the PhoneSystem instance.
ps = MyCall.PS as PhoneSystem;
try
{
// Update the Talk Link names for extensions only.
UpdateTalkLinkNameForExtensions();
MyCall.Debug("Talk Link names for extensions updated successfully.");
// Play the goodbye message and terminate the call.
return await PlayGoodbyeMessageAndTerminate();
}
catch (Exception ex)
{
// Log an error if there is an issue during the Talk Link name update.
MyCall.Error("Error during Talk Link name update for extensions: {0}", ex);
// Ensure the goodbye message is played and the call is terminated even in case of an error.
await PlayGoodbyeMessageAndTerminate();
return false;
}
}
// Method to update Talk Link names for extensions only.
private void UpdateTalkLinkNameForExtensions()
{
// Ensure that the PhoneSystem is initialized.
ps = PhoneSystem.Root;
if (ps == null)
{
throw new InvalidOperationException("PhoneSystem is not initialized.");
}
// Retrieve all DNs and update their properties if they are of type 'Extension'.
var allDNs = ps.GetDN();
foreach (var dn in allDNs)
{
if (dn is Extension)
{
string C2CID = dn.GetPropertyValue("C2CID");
string WM_FRIENDLYNAME = dn.GetPropertyValue("WM_FRIENDLYNAME");
// Check if either C2CID or WM_FRIENDLYNAME is empty or missing, and update accordingly.
if (string.IsNullOrEmpty(C2CID) || string.IsNullOrEmpty(WM_FRIENDLYNAME))
{
string newValue = dn.Number;
C2CID = string.IsNullOrEmpty(C2CID) ? newValue : C2CID;
WM_FRIENDLYNAME = string.IsNullOrEmpty(WM_FRIENDLYNAME) ? newValue : WM_FRIENDLYNAME;
dn.SetProperty("C2CID", C2CID);
dn.SetProperty("WM_FRIENDLYNAME", WM_FRIENDLYNAME);
}
else if (C2CID != WM_FRIENDLYNAME)
{
// Ensure C2CID and WM_FRIENDLYNAME are identical.
WM_FRIENDLYNAME = string.IsNullOrEmpty(WM_FRIENDLYNAME) ? C2CID : WM_FRIENDLYNAME;
C2CID = WM_FRIENDLYNAME;
dn.SetProperty("C2CID", C2CID);
dn.SetProperty("WM_FRIENDLYNAME", WM_FRIENDLYNAME);
}
// Save the changes to the DN.
dn.Save();
}
}
}
// Method to play the goodbye message and terminate the call.
private async Task<bool> PlayGoodbyeMessageAndTerminate()
{
// Ensure media is ready before playing the prompt.
await MyCall.AssureMedia();
// Play the goodbye prompt in a blocking manner.
await MyCall.PlayPrompt(null, [goodbyeAudioPath], PlayPromptOptions.Blocked);
// Terminate the call after the prompt is played.
TerminateCall();
return true;
}
// Method to terminate the current call.
private void TerminateCall()
{
// Terminate the call effectively.
MyCall.Terminate(); // This method ends the current call.
}
}
}
Founded in 2005, when VoIP was an emerging technology, 3CX has gone on to establish itself as a global leader in business communications.