Get Attached Data After Makecall API - CFD App

syadmins

Premier Customer
Joined
Jan 13, 2026
Messages
34
Reaction score
12
Hi,

I'm trying to collect the get attached call data when I use the Make Call API request but no luck. I'm doing the following, let me know if anything is wrongly implemented or am i missing something here :

1. I'm trying to make a call from a CFD app 3333 toward an External number 12345678

Request
https://3cx.domain/callcontrol/3333/makecall
body:
{
"destination": "12345678",
"timeout": 1,
"xyz": "123"
}

When I send the API request above, The CFD will initiate the call successfully and the external number answer the call and listen to the prompt but one thing not working which is the xyz variable is not played.

What's not working:
I want to catch the "xyz" value "123" from inside the CFD app and play the numbers in the playdigit component to the external number, but the value of "xyz" is coming empty.

This is my GetAttachedCallData1

1770981805094.png

And this is my playdigit component
1770981790828.png

I tried to do logger and placed the GetAttachedCallData1.DataValue in the trace from the logs , it is coming empty as below:

2026/02/13 14:11:39.958|0009|Trac| [_3CX.Script] _3333_28.Main.79317.[C:24049.1]-GetAttachedCallData1 - CallFlow.CFD.GetAttachedCallDataComponent 'GetAttachedCallData1' - Getting data attached to the call with Name='xyz'
2026/02/13 14:11:39.958|0009|Trac| [_3CX.Script] _3333_28.Main.79317.[C:24049.1]-GetAttachedCallData1 - CallFlow.CFD.GetAttachedCallDataComponent 'GetAttachedCallData1' - Data attached to the call obtained for Name='xyz' - Value=''

What could be wrong?

Thanks
 
The AttachedData property isn't used. It doesn't work for the MakeCall.
 
You mean I'm not using it properly, or it is not supported in the Makecall?

Appreciate some elaboration
 
You mean I'm not using it properly, or it is not supported in the Makecall?

Appreciate some elaboration
Not supported. The property is there but isn't used. Only destination and timeout are used.
 
I see.

Any suggestions of an alternative way to implement something similar?
 
I want to send an OTP code to a client over a call. So I wanted to trigger the Makecall with the destination number + OTP code attached in the Makecall request then the CFD app will play it.

Since the attacheddata is not supported in the Makecall, I have an idea:
It is possible when my backend system trigger the makecall, then the CFD app starts and perform an SQL query to the database and pull the OTP based on the destination number (client) and pass it to the playdigit component and play the prompt. But my intention waas to simplify and avoid doing db integration in the CFD.

If this idea is the only way to go, then I will go for it.

Let me know your thoughts
 
  • Like
Reactions: Evolute IT
I want to send an OTP code to a client over a call. So I wanted to trigger the Makecall with the destination number + OTP code attached in the Makecall request then the CFD app will play it.

Since the attacheddata is not supported in the Makecall, I have an idea:
It is possible when my backend system trigger the makecall, then the CFD app starts and perform an SQL query to the database and pull the OTP based on the destination number (client) and pass it to the playdigit component and play the prompt. But my intention waas to simplify and avoid doing db integration in the CFD.

If this idea is the only way to go, then I will go for it.

Let me know your thoughts
The DB/Query idea is the best. It's what we do.
 
I agree with @ConceptsWeb that this is the way to go with it, reading the number from the database, and playing it from the CFD app. However, you must ensure that you avoid a possible race condition here. If you need to trigger 2 calls almost at the same time, and you add 2 rows to your database table with 2 different OTPs for 2 different customers, you need to ensure that you play the correct value for each one. If you just query for OTPs which have not been played yet, you might be providing the wrong value to a customer, playing the same value twice for example.

As an alternative approach, if you want to avoid creating a CFD app for this, you could use SIP Caller. With SIP Caller you can use a REST API to add numbers with associated data to a running campaign. This way you can add the number and the OTP code, and ensure that SIP Caller will make the call and provide the correct code. In addition, SIP Caller can automatically handle call retries in case the customer doesn't pick up. And TTS charges are included, so you don't need to create a Google Cloud or AWS account for that.
 
Hi @edossantos_sipcaller

Well, actually your concern cross to my mind, but ain't the accuracy comes from the sql statement we write for it. For example; if the OTP 123456 supposed to be play for the destination number 01122334455.

My sql statement is something like this:
SQL:
select phonenumber, otp from otptbl where phonenumber=ani and isused=0 order by timestamp desc limit 1;

Above query ensures the last valid OTP is fetched for that destined user.

Also from our frontend (user interface) that the user trigger the send OTP, we have timers there, we don't allow multiple resend until the OTP is expired then the user can issue another one.

Appreciate your thoughts here.

By the way, for SIP Caller ; seems interesting, will give it a check now.
 
Yes, that SQL query will avoid issues when you need to send multiple OTPs to different customers at the same time. Just ensure that the outbound rules are not changing the dialed number (adding or removing prefixes), otherwise the number you see in the session.ani variable might not be exactly the number you dialed. Just run some tests to confirm this.
 

Forum statistics

Threads
111,973
Messages
590,070
Members
164,890
Latest member
James Hacker