Introduction
In this article we will describe how to create an application for automatic outgoing dialing of subscribers (Dialer) in
3CX Call Flow Designer using the MakeCall component. The dialer automatically dials the subscribers from the list and connects the call to the extension number or the 3CX call queue. The dialer application allows you to conduct efficient, automated outbound dialing campaigns. Call center operators save time and effort by simply accepting dial-up calls - no need to search and dial the desired number!
Recall that in previous articles we looked at the
operation of CFDs with databases (which can also be used to get a subscriber number) and the
routing of incoming calls depending on the time of day (which can be combined with outgoing dialing).
Please note - the 3CX CFD development environment is free. But voice applications will be run only on
3CX Pro and Enterprise editions . Download CFD
from here .
')
The demo project of this voice application comes with the 3CX CFD distribution and is located in the
Documents \ 3CX Call Flow Designer Demos folder.
It is important to note that by default, the dialer starts working when the 3CX Queue Manager Service starts. Therefore, it is necessary to specify a certain condition by which the dialer will make calls. For this, the voice application uses the
Create a Condition component (s). For example, you can check (set) the time of day at which calls should be performed.
Without setting the conditions, the call starts at the moment the service starts and continues until the 3CX Queue Manager Service service is stopped, or the Queue with this voice application is deleted, or the voice application is not deleted from the Call Queue. Agree, it is inconvenient.
Calling numbers can come from any source - a text file, a database, etc. In our example, the numbers are taken from a text file. The voice application also checks the current date and time (dialing is performed only on working days and during working hours), and the status of agents for call distribution (if there are no free agents, dialing is suspended).
Project creation
To create a CFD project, go to
File → New → Project , specify the project folder and its name, for example,
OutboundDialerDemo .
The new project by default contains the voice application
Main.flow . It is not used in this project, so delete it in the Project Explorer window. In the same window, add a new application - right-click on the project name and select
New Dialer . Call it
MainDialer . In the Project Explorer, select the
MailDialer object and set its properties in the
Properties Window , as shown below.
A dialer has two parameters defining its behavior:
- ParallelDialers - the number of simultaneously running dialer entities;
- PauseBetweenDialerExecution - the time each entity waits for before making a call (strictly speaking, before starting the procedure for checking the conditions for making a call).
Let us explain this with an example. Suppose we set ParallelDialers to 5, and PauseBetweenDialerExecution to 30 seconds. The application will work as follows:
- The first dialer (entity) is created, gets a number to call, rings and waits for 30 seconds.
- After 6 seconds a second dialer is created, receives a number, calls and starts to wait 30 seconds.
- After 6 seconds a third dialer is created, receives a number, calls and starts to wait 30 seconds.
- After 6 seconds the fourth dialer is created, receives a number, calls and waits for 30 seconds.
- After 6 seconds the fifth dialer is created, receives a number, calls and waits for 30 seconds.
- After 6 seconds The first dialer wakes up, gets a number to call, rings and waits for 30 seconds.
- After 6 seconds The second dialer “wakes up”, receives a call number, calls and waits for 30 seconds, etc.
As you can see, these two parameters determine the frequency of dialing. When ParallelDialers is set to 5 and PauseBetweenDialerExecution in 30 seconds, 10 calls per minute will be made. Changing the parameters, we determine the desired frequency of calls.
Determining the appropriate time to call
In our example, dialing will be performed only from Monday to Friday from 9 to 17. To meet this condition, drag the
Create a condition component from the sidebar of the components into the main window of the development environment and name it
checkTimeToCall . The component will have two branches:
timeToCall - performed when the conditions (time) of the call are
met and
nothingToDo - is performed if the conditions are not met.
Create a condition to execute the
timeToCall branch (Condition parameter). In CFD, this uses the C # expression, which returns True when it falls into the time frame:
((int)DateTime.Now.DayOfWeek) > 0 && ((int)DateTime.Now.DayOfWeek) < 6 && DateTime.Now.Hour >= 9 && DateTime.Now.Hour < 17
Definition of free operators
Let me remind you that our dialer "takes" a number from a text file and commutes it with the number of the 3CX Call Queue, to which, of course, the operators must be connected. Suppose that the Queue number is 800, and the numbers of the operators are 201, 202 and 203. It is necessary to check whether one of these operators is ready to accept the call. To do this, run the
3CX Call Control API script from the
Launch External Script component.
This script is also written in C #. It checks the DN objects of each extension for the presence of the ActiveConnection attribute:
using System; using TCX.Configuration; namespace OutboundDialerDemo { public class ExtensionStateHelper { public bool IsThereAnyFreeExtension() { return PhoneSystem.Root.GetDNByNumber("201").GetActiveConnections().Length == 0 || PhoneSystem.Root.GetDNByNumber("202").GetActiveConnections().Length == 0 || PhoneSystem.Root.GetDNByNumber("203").GetActiveConnections().Length == 0; } } }
Save the script in a file named
CheckExtensionsState.cs in the project
Libraries folder. Then drag the
Launch External Script component to the
timeToCall branch, name it
checkFreeExtensions and configure it as shown below.

Now you should check the result of the script. Immediately below the
Launch External Script component, add the
Create a condition component component and name it
isThereAnyFreeExtension . The component will have two branches:
yesMakeCall and
noFreeExtensions , as shown below.

Create a
yesMakeCall branch
condition , which is executed if the previous script returns True. The expression has the form:
checkFreeExtensions.ReturnValue
When the condition is fulfilled, the
yesMakeCall branch
is executed, because all the necessary conditions are fulfilled: the right time and at least one free operator. You can call the subscriber!
Receiving and switching subscriber numbers
Let me remind you that in our example, the numbers are taken from the file.
Name the file
NumbersToCall.txt - each line of the file contains one number.
For successful work with the file, you need to create an index variable for the line number, which will be common to all entities of the dialers. Choosing a number, we increase the index, and the next dialer "takes" the number from the next line, and so on, in turn. Let's create another C #
CallIndexHolder.cs script in which we will define a static variable (the script should also be saved in the
Libraries folder.
using System; namespace TCX { public class CallIndexHolder { private static int callIndex = 0; public int GetCallIndex() { return callIndex; } public void SetCallIndex(int index) { callIndex = index; } } }
Since the
callIndex variable
is declared as static, there is only one entity in the 3CX Queue Manager service process that is shared between the dialers.
So, we need another
Launch External Script component (let's call it
getCallIndex) , which we put into the branch
yesMakeCall and set up as shown below:

We now turn, in fact, to reading the numbers from a text file. Immediately after the
getCallIndex component
, add the
Read / Write to File component, name it
readNumberToCall and configure it as shown below:

Pay attention to the format of the path to the file with numbers and specify the path on your 3CX server.
When all lines in the file are read, the
readNumberToCall component counts the empty string. At this point, calls must be suspended. To do this, add another component,
Create a condition , which will check whether the number is read from the file or not. It has one branch with the following condition:
GREAT_THAN(LEN(readNumberToCall.Result),0)
If the condition is fulfilled, the
CallIndexHolder.cs script is
executed , increasing the
callindex variable, and the
Make Call component makes the call. The
Make Call component is configured as shown below:

He makes a call from the extension of Queue 800 (to which operators 201, 202 and 203 are connected) to the number read from the text file.
Pay attention to the general view of the
yesMakeCall branch after adding all the necessary components.
Compiling and installing the application on the 3CX server
Voice application is ready! Now it should be compiled and uploaded to the 3CX server. For this:
- Go to Build> Build All , and CFD will create the OutboundDialerDemo.tcxvoiceapp file.
- Go to the 3CX management interface, in the Call Queues section. Create a new Call Queue, specify the name and extension number of the Queue, and then set the Voice Applications option and download the compiled file.
- Save your changes to the Call Queue. Voice application is ready to use.
