Call Flow Designer

Filatura

Customer
Joined
Feb 4, 2026
Messages
3
Reaction score
0
Hello everyone, I would like to create a call flow rule that automatically distinguishes whether the caller is a known number (present in the contacts) – if yes, perform one action; if not, perform another. I haven't found a specific guide; using tools like GPT/Grok etc., they propose solutions that use "Execute C# Code," but I can't apply the suggested implementations. Has anyone already developed a similar script? Thanks.


The standard approach uses an "Execute C# Code" component first to query the phonebook, setting a boolean variable like contactFound, followed by a "Create a Condition" checking session.contactFound == true for routing (e.g., known callers to IVR 800, unknown to extension 106).

Working C# Script Example​

Paste this into your "Execute C# Code" component's code editor (pass session.ani as parameter "callerNumber"):


text
<span><span>var tenant = PhoneSystem.Root.GetTenant();<br></span></span><span>var phoneBookEntries = tenant.FindContacts(callerNumber);<br></span><span>contactFound = phoneBookEntries.Count() &gt; 0;<br></span><span></span>
This searches the 3CX company phonebook; if matches exist, sets contactFound to true.

Step-by-Step CFD Setup​

  • Drag "Execute C# Code" to the canvas; set input parameter callerNumber = {ANI} and output contactFound (boolean).
  • Add "Create a Condition" below; click Fx button, select session.contactFound == true (use Fx to avoid "invalid expression" errors).
  • True branch (known): "Transfer Call To" → select IVR or extension (e.g., "800").
  • False branch (unknown): "Transfer Call To" → extension (e.g., "106").
  • Build → ZIP → Upload to 3CX Admin Console > Advanced > Call Flow Apps; assign to Inbound Rule DID.
Test with known/unknown numbers; if errors persist (e.g., compilation), share your 3CX version or exact code screenshot for tweaks. Many users have succeeded with this phonebook lookup pattern
 
You're actually posting the solution to your question. Did you try following those steps?
 
@Filatura
Based on your fragment - better, works, is readable and copy + paste works also:
C#:
var tenant = PhoneSystem.Root.GetTenant();
var phoneBookEntries = tenant.FindContacts(callerNumber);
bool contactFound = phoneBookEntries.Count() > 0;
return contactFound;
But the code is bad and I don't know if it's that what you really want.

1770220017644.png
 
I'm not very familiar with this tool and I'm struggling to understand how to put together something so simple; I also don't understand the condition part and how to make the true/false distinction.

1770222660360.png




1770222626446.png
 
I'm not very familiar with this tool and I'm struggling to understand how to put together something so simple; I also don't understand the condition part
that's bad
Read the doc and use the CFD integrated help:
https://www.3cx.com/docs/manual/call-flow-designer/
Expression Editor:
https://www.3cx.com/docs/manual/cfd-prompts-expressions/#h.v17ic2wxant9

how to make the true/false distinction
possible solution:
Code:
EQUAL(FindPhonebookContact.ReturnValue,true)

1770224019544.png
 
What are the actions to be taken? With update 8 the AI receptionists has knowledge of the phonebook and can transfer calls accordingly, as an option.
 
Hi , thanks whit yours suggestions i was able to get it working correctly

Yes, AI can do it but OpenAi API key is required.
 

Members Online Now

Forum statistics

Threads
111,834
Messages
589,287
Members
164,662
Latest member
DejanMDS