Sample Call Processing Script for PIN

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

  1. Login to your Admin Console, go to Integrations > Call Scripts
  2. Click Add from Store

  1. Select one of the scripts available from the 3CX Call Processing Script Store. In this example we will select dtmf.cs. 
  2. Enter a name for the Call script ( should contain lowercase characters only with no spaces).
  3. Select how you want this script to be launched via the "Run this script" option.
  4. Depending on the previous selection, enter a dial code, select desired SIP trunk or assign a DID.
  5. Assign the script to a department.

  1. Click OK to proceed. This will redirect you to the code editor page which will automatically compile the script.

  1. 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

};

  1. 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

  1. When a *357 is dialed, the script “ivrlauncher” is triggered.
  2. An IVR plays and asks you to enter an input
  3. 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”
    • Related Articles

    • Call Forwarding 3CX Desktop App/Webclient

      Here you can: Set a custom message Enable/disable Push notifications for each status Rename “Lunch” and “Business Trip” profiles Set the number of seconds to activate forwarding of unanswered calls for “Available” and “Lunch” profiles Choose to ...
    • Call By Name

      Callers Can Dial an Extension Directly Whilst a digital receptionist prompt is playing, a caller can enter the extension number to call directly and connect to the extension without going through a receptionist. Simply instruct your callers in the ...
    • Outbound Call Routing

      Outbound Call Routing logic 3CX routes calls to SIP Trunks based on criterias the administrator defines in “Outbound Rules”. An outbound rule has a set of conditions which will trigger the rule, such as which user or department is calling, the dialed ...
    • Call Queues & Ring Groups

      Introduction With 3CX you can create call queues or ring groups and handle incoming calls as a team: Ring Groups- route calls concurrently to multiple extensions. Call Queues - queue calls for when agents are available. If all agents are busy, calls ...
    • Transfer Calls on Smartphone

      Transfer Calls on Smartphone Blind Transfer Press the transfer key during an active call Then enter the number you want to transfer the call to The call will immediately be transferred to the other line Attended Transfer Press the Attn. Tran button ...