Sample Call Processing Script for PIN
Introduction
This script implements an IVR which asks the caller for a DTMF number which can then be used as a PIN or be verified against a database.
Create a Call Processing Script in 3CX
- Login to your Admin Console, go to “Integrations” > “Call Scripts”
- Click “Add from Store”
- Select one of the scripts available from the 3CX Call Processing Script Store. In this example we will select dtmf.cs.
- Enter a name for the Call script ( should contain lowercase characters only with no spaces).
- Select how you want this script to be launched via the "Run this script" option.
- Depending on the previous selection, enter a dial code, select desired SIP trunk or assign a DID.
- Assign the script to a department.
- Click “OK” to proceed. This will redirect you to the code editor page which will automatically compile the script.
- You can now make C# changes to the code. One simple change can be the following:
The below screenshot explains how to add a new DTMF pin pattern of "2024" which routes to extension 250. To do this, simply add a new line { "2024", "250" },
// Mapping of PIN codes to destinations
private readonly Dictionary<string, string> UserInputMap = new Dictionary<string, string>
{
{ "2024", "250" },
{ "1234", "100" },
{ "2345", "101" },
{ "3456", "102" },
{ "", "103" } // No input
};
- Press Save to compile. If compilation is successful, you will see “Compilation Succeeded!” in the Script output as displayed above. Now when a user dials DTMF "2024", the call will be routed to extension "250".
How it Works
- When a *357 is dialed, the script “ivrlauncher” is triggered.
- An IVR plays and asks you to enter an input
- User enters DTMF “2024” and the script will transfer the call to the destination declared in the C# Code. In this example the call will be routed to extension “250”
See also
- How to create a Call Processing Script
- Call Control API for Linux
- Call Control API for Windows
- Google Cloud Storage & Speech API
- Call Processing Script for DTMF Input
- Configure a Call Processing Script for a holiday prompt
Last Updated
This document was last updated on 15 October 2024