Park calls temporarily and ensure they return if unanswered.

This script places calls on hold to free up your extension. Then ensures the call is not forgotten by returning the call after a set amount of time.

The ‘Personal Parking with Auto-Return’ script enables users to park a call temporarily and free up your extension for other tasks. If the parked call isn’t picked up within a specified duration – for example 15 seconds – the system automatically returns the call to your extension. The caller hears music on hold while waiting.

How to Set Up Your Script

  1. Go to Admin Console > Integrations > Call Scripts.
  2. Select Add from Store and choose Personal Parking with Auto-Return.
  3. Assign a name for easy identification.
  4. Configure it to run when a user dials a dial code.
  5. Set a dial code of your choice – for example 55
  6. Apply the setting as System Wide.

How Your Agents Can Use the Script

  1. Answer an incoming call on the extension.
  2. Use the Blind Transfer option from the IP phone or softphone to transfer the call to the specified dial code as set above.
  3. The caller will hear music on hold for the set duration – for example 15 seconds.
  4. If unanswered, the call returns automatically to the original extension.

Why Use This Script?

  1. Free Your Extension: Handle other tasks while the call waits.
  2. Fail-Safe: Ensure no parked call gets overlooked.
  3. Customizable: Adjust the script for different parking scenarios or durations.

Things to Know

  • The system provides a similar feature using the Automatically Unpark Forgotten Calls option.
  • This script showcases the flexibility of Call Processing Scripts and can be modified for additional use cases.

Example Script

DISCLAIMER! This script is for reference purposes only. For the latest version, download from the store.

Script: Personal Parking with Automatic Return


#nullable disable
using CallFlow;
using System;
using System.Threading;
using System.Threading.Tasks;
using TCX.Configuration;
using TCX.PBXAPI;
namespace dummy
{
public class ParkingRoutePointSample : ScriptBase
{
async Task ProcessAutoPickup(RoutePoint sp, DestinationStruct returnTo, CancellationToken token)
{
while (true)
try
{
return await Task.Delay(TimeSpan.FromSeconds(15), token).ContinueWith(x =>
{
MyCall.Trace("{0} - automatic redirection of the call from {1}.{2} to '{3}'", MyCall.DN, MyCall.Caller?.CallerID, MyCall.Caller?.DN, returnTo);
return MyCall.RouteToAsync(new RouteRequest
{
RouteTarget = returnTo,
TimeOut = TimeSpan.FromSeconds(15) //will ring until failure
}
);
}
, TaskContinuationOptions.NotOnCanceled).Unwrap();
}
catch (OperationFailed ex)
{
MyCall.Trace("Automatic redirection failed: {0}", ex.TheResult);
MyCall.Trace("Continue hold call from {0}({1}) on {2}", MyCall.Caller?.CallerID, MyCall.Caller?.DN, MyCall.DN);
continue;
}
}
PhoneSystem ps = null; public override async Task StartAsync()
{
ps = MyCall.PS as PhoneSystem;
CallControlResult lastresult = null;
DN referredBy = null;
RoutePoint thisPark = null;
string callerID = "";
DN callerDN = null;
try
{
referredBy = MyCall.ReferredByDN?.GetFullSnapshot() as Extension;
thisPark = MyCall.DN?.Clone() as RoutePoint;
callerID = MyCall.Caller?.CallerID;
callerDN = MyCall.Caller?.DN?.Clone() as DN;
MyCall.Trace(
"Parked call from {0}({1}) on {2}", callerID, callerDN, thisPark
);
if (referredBy == null)
{
MyCall.Trace("{0} rejects call from {1}. Reason: No referrer specified", thisPark, callerDN);
return false;
}
var cancelationToken = new CancellationTokenSource();
MyCall.OnTerminated += () =>
{
cancelationToken.Cancel();
};
lastresult = await MyCall.AssureMedia().ContinueWith(
x =>
{
if(!string.IsNullOrWhiteSpace(ps.GetParameterValue("PARK_MOH_SOURCE")))
MyCall.SetBackgroundAudio(true, new string[] { ps.GetParameterValue("PARK_MOH_SOURCE") });
else
MyCall.SetBackgroundAudio(true, new string[] { ps.GetParameterValue("MUSICONHOLDFILE") });
return ProcessAutoPickup(thisPark, new DestinationStruct(referredBy), cancelationToken.Token);
}, TaskContinuationOptions.OnlyOnRanToCompletion).Unwrap();
return true;
}
catch (PBXIsNotConnected ex)
{
MyCall.Error($"Call control API is not available:\n{ex}");
}
catch (TaskCanceledException)
{
MyCall.Trace($"Call was disconnected from parking place");
}
catch (Exception ex)
{
MyCall.Error($"Parking failure:\n{ex}");
}
return false;
}
}
}

Last Updated
This document was last updated 9 December 2024