Easily change your extension status by dialing a dial code.
This set of scripts allows users to change their own extension status – Available, Away, Out of Office, Custom 1, or Custom 2 – by dialing a custom code. This script gives users a quick way to update their availability without navigating through the 3CX interface.
The system also includes prebuilt dial codes for changing profile statuses, which can be used instead of custom codes. This script demonstrates the flexibility of Call Processing Scripts and can be modified for additional functionality.
How to Set Up the Script for Extension Status Changes
- Go to Admin Console > Integrations > Call Scripts.
- Add from Store and select Set Extension Available Status.
- Assign a name for easy identification – for example ‘Available’.
- Run this script when a user dials a dial code.
- Add a dial code of your choice – for example 57.
- Select System Wide.
How to Set Up Scripts for Other Statuses
- Follow the same steps as above.
- In step 3, use a unique name for each script – for example “setaway”.
- In step 5, assign a unique dial code for each script – for example 58 for Out of Office, 59 for Custom 1.
Why Use This Script
- Quick Status Updates: Change your availability without accessing the Web Client or mobile app.
- Customizable Options: Tailor the codes and statuses to fit your needs.
- Flexible and Scalable: Expand functionality with additional scripts as required.
Example Script
DISCLAIMER! This script is for reference purposes only. For the latest version, download from the store.
Script: Available
using System;
using System.Threading.Tasks;
using TCX.Configuration;
using CallFlow;
using System.Linq;
using System.Collections.Generic;
namespace dummy
{
public class SetAvailableStatus : ScriptBase
{
public override async Task StartAsync()
{
var profileName = "Available";
var prompt = "ST_AVAILABLE_SET";
//-----call is direct from the extension and profile extension has required profile
if (MyCall.Caller.DN is Extension ext
&& MyCall.ReferredByDN is not DN
&& ext.FwdProfiles.FirstOrDefault(x=>x.Name.Equals(profileName)) is FwdProfile fwdProfile)
{
//set current status
ext.CurrentProfile = fwdProfile;
//reset profile override
ext.ResetCurrentProfileOverride();
ext.Save();
//----play system prompt about current status
try
{
MyCall.Info($"Extension {ext.Number} is set to {profileName}");
await MyCall.AssureMedia()
.ContinueWith(_ => MyCall.PlayPrompt(ext.GetPropertyValue("PROMPTSETID"), [prompt], PlayPromptOptions.Blocked))
.Unwrap();
}
catch
{
//ignore prompt playback failures. action is performed
}
//we made modifications
return true;
}
//we did not make any modifications
return false;
}
}
}
Script: Away
using System;
using System.Threading.Tasks;
using TCX.Configuration;
using CallFlow;
using System.Linq;
using System.Collections.Generic;
namespace dummy
{
public class SetAwayStatus : ScriptBase
{
public override async Task StartAsync()
{
var profileName = "Away";
var prompt = "ST_AWAY_SET";
//-----call is direct from the extension and profile extension has required profile
if (MyCall.Caller.DN is Extension ext
&& MyCall.ReferredByDN is not DN
&& ext.FwdProfiles.FirstOrDefault(x=>x.Name.Equals(profileName)) is FwdProfile fwdProfile)
{
//set current status
ext.CurrentProfile = fwdProfile;
//reset profile override
ext.ResetCurrentProfileOverride();
ext.Save();
//----play system prompt about current status
try
{
MyCall.Info($"Extension {ext.Number} is set to {profileName}");
await MyCall.AssureMedia()
.ContinueWith(_ => MyCall.PlayPrompt(ext.GetPropertyValue("PROMPTSETID"), [prompt], PlayPromptOptions.Blocked))
.Unwrap();
}
catch
{
//ignore prompt playback failures. action is performed
}
//we made modifications
return true;
}
//we did not make any modifications
return false;
}
}
}
Script: Out of office
using System;
using System.Threading.Tasks;
using TCX.Configuration;
using CallFlow;
using System.Linq;
using System.Collections.Generic;
namespace dummy
{
public class SetDNDStatus : ScriptBase
{
public override async Task StartAsync()
{
var profileName = "Out of office";
var prompt = "ST_OUTOFFICE_SET";
//-----call is direct from the extension and profile extension has required profile
if (MyCall.Caller.DN is Extension ext
&& MyCall.ReferredByDN is not DN
&& ext.FwdProfiles.FirstOrDefault(x=>x.Name.Equals(profileName)) is FwdProfile fwdProfile)
{
//set current status
ext.CurrentProfile = fwdProfile;
//reset profile override
ext.ResetCurrentProfileOverride();
ext.Save();
//----play system prompt about current status
try
{
MyCall.Info($"Extension {ext.Number} is set to {profileName}");
await MyCall.AssureMedia()
.ContinueWith(_ => MyCall.PlayPrompt(ext.GetPropertyValue("PROMPTSETID"), [prompt], PlayPromptOptions.Blocked))
.Unwrap();
}
catch
{
//ignore prompt playback failures. action is performed
}
//we made modifications
return true;
}
//we did not make any modifications
return false;
}
}
}
Script: Custom 1
using System;
using System.Threading.Tasks;
using TCX.Configuration;
using CallFlow;
using System.Linq;
using System.Collections.Generic;
namespace dummy
{
public class SetCustom1Status : ScriptBase
{
public override async Task StartAsync()
{
var profileName = "Custom 1";
var prompt = "ST_CUSTOM1_SET";
//-----call is direct from the extension and profile extension has required profile
if (MyCall.Caller.DN is Extension ext
&& MyCall.ReferredByDN is not DN
&& ext.FwdProfiles.FirstOrDefault(x=>x.Name.Equals(profileName)) is FwdProfile fwdProfile)
{
//set current status
ext.CurrentProfile = fwdProfile;
//reset profile override
ext.ResetCurrentProfileOverride();
ext.Save();
//----play system prompt about current status
try
{
MyCall.Info($"Extension {ext.Number} is set to {profileName}");
await MyCall.AssureMedia()
.ContinueWith(_ => MyCall.PlayPrompt(ext.GetPropertyValue("PROMPTSETID"), [prompt], PlayPromptOptions.Blocked))
.Unwrap();
}
catch
{
//ignore prompt playback failures. action is performed
}
//we made modifications
return true;
}
//we did not make any modifications
return false;
}
}
}
Script: Custom 2
using System;
using System.Threading.Tasks;
using TCX.Configuration;
using CallFlow;
using System.Linq;
using System.Collections.Generic;
namespace dummy
{
public class SetCustom2Status : ScriptBase
{
public override async Task StartAsync()
{
var profileName = "Custom 2";
var prompt = "ST_CUSTOM2_SET";
//-----call is direct from the extension and profile extension has required profile
if (MyCall.Caller.DN is Extension ext
&& MyCall.ReferredByDN is not DN
&& ext.FwdProfiles.FirstOrDefault(x=>x.Name.Equals(profileName)) is FwdProfile fwdProfile)
{
//set current status
ext.CurrentProfile = fwdProfile;
//reset profile override
ext.ResetCurrentProfileOverride();
ext.Save();
//----play system prompt about current status
try
{
MyCall.Info($"Extension {ext.Number} is set to {profileName}");
await MyCall.AssureMedia()
.ContinueWith(_ => MyCall.PlayPrompt(ext.GetPropertyValue("PROMPTSETID"), [prompt], PlayPromptOptions.Blocked))
.Unwrap();
}
catch
{
//ignore prompt playback failures. action is performed
}
//we made modifications
return true;
}
//we did not make any modifications
return false;
}
}
}
No Comment! Be the first one.