3CX API Unix

Status
Not open for further replies.

mear

Joined
Aug 9, 2011
Messages
16
Reaction score
1
Hi Guys,

We have been looking at the API documentation so we could integrate some functionality from our own system, but I am confused about the API for instances running on Unix.

Does the Application still have to be running from the Unix server?

I can see the documentation but I only see examples for Windows.

https://www.3cx.com/docs/call-control-api/

Can you please help?
 
Yes, the API works in Linux without any problem. In fact, all the 3CX modules use the API. The program you create using the 3CX Call Control API needs to be running in the 3CX server, be it Windows or Linux.

The samples provided include instructions to configure everything in Windows, because you usually develop in Visual Studio, and it's easier that way. But you can create the program and run it on Linux without any problem.
 
We are developing a REST API that you can call from anywhere. If you have specific requirements, let us know and we can incorporate them into our API. We have a limited release now on both Windows and Linux.
 
We are developing a REST API that you can call from anywhere. If you have specific requirements, let us know and we can incorporate them into our API. We have a limited release now on both Windows and Linux.

Can you please give me some more information about it?

Regards
 
Yes, the API works in Linux without any problem. In fact, all the 3CX modules use the API. The program you create using the 3CX Call Control API needs to be running in the 3CX server, be it Windows or Linux.

The samples provided include instructions to configure everything in Windows, because you usually develop in Visual Studio, and it's easier that way. But you can create the program and run it on Linux without any problem.

We are developing an ASP.NET page, the idea is to retrieve information about calls.

this means I will need to port this to my instance and then run it from there as a web server?

Regards
 
There are a couple of challenges that must be overcome when building custom solutions for 3CX. (1) 3CX Support does not want any non-3cx software installed directly on the 3CX server, (2) the 3CX Call Control API only responds to requests from localhost, (3) call history records are not accessible via any API (although you can get limited information from the CDR files), and (4) last time I checked you are only allowed to have one active connection to the Call Control API at a time.

If you want access to the Call Control API, you are going to need some kind of REST / WCF based API that exposes the call control API to remote computers (since 3CX doesn't want you installing applications on the 3CX server). It's a bit of a catch-22 because you can't install anything on the 3CX server, but the call control API only responds to localhost requests. Our solution was to build a small Relay application (very small footprint) that is installed on the 3CX server and makes the one permitted connection to the API. Then our applications are installed on a separate server and communicate with 3CX through the Relay.

Our current Relay uses WCF for communication, but our new Relay uses REST and SignalR for communication. Since our add-on applications all need to communicate with 3CX for various reasons we have elected to make our REST API available through our Universal suite of tools. So if any of our application needs the REST API to function, we will make that function available to any developer who purchases our Suite of tools. If you need an API method that is not part of our REST API, we will consider adding it. The Relay makes it possible to install custom applications anywhere regardless of where our tools or 3CX are installed. Our new Relay

To access historical call information, the only supported method is either using 3CX reports or by processing the optionally created CDR files. While the data contained in the CDR files is limited, it still has very valuable information in an easy-to-interpret structure. But if you need more information than what's available in the CDR files (queue statistics for example) then the only option is to pull the data directly from the 3CX PostgreSQL database. But let me be very clear on this point, accessing the 3CX database directly is not supported and strongly discouraged by 3CX support. 3CX has a good reason for being restrictive about people accessing the database directly -- you can really screw things up if you are not extremely careful. One safe option (although not endorsed by 3CX) is to use our Exporter tool to copy the data from the PostgreSQL database to either Microsoft SQL or MySQL. Exporter has been in use for about 7-8 years with no reported issues. Once you have the data in SQL, you can build whatever reports / queries you need without impacting 3CX in any way.
 
@voiptoys

Yeah I do understand that to be honest, it does not make much sense having an API if it is quite dificult to use it.

What do you guys normaly do? Run ASP.NET under unix and output the details you wish?

Regards
 
It depends on what is needed. Our new Relay is ASP.Net Core and implements a REST API. We use this API when querying 3CX. For events we use SignalR. When we need historical information, we use our Exporter tool to process the CDR files, or if we have no other options we use Exporter to get data that is available no other way.
 
At the moment we are collecting the CDR file via SFTP and then processing it and saving all data into a database.

But there is some information we would like to have that we can't with the CDR file.

Idea would be similar to what you describe, having an API running on the 3cx machine that connects and requests information from the 3CX api, although this makes no much sense.
 
There is no 3CX API for accessing the historical data in the PostgreSQL database and we don't plan on building an API for this. We use Exporter to pull data from the PostgreSQL database.
 
That might be an option for us, as it will give us some more data.
 
Status
Not open for further replies.

Latest Posts

Forum statistics

Threads
112,323
Messages
591,896
Members
165,474
Latest member
costionofrei