Problem use Ari

Hello everyone,
I’m new in the world of asterisk, I’ve been working on it for only 1 month.

Today I have to set up a Server Asterisk 18.3 / Freepbx 14 on a Redhat. Successfull thing.
The system must be able to make an automatic call to a phone through a TCP request.
I was advised to use the ARI tool!
Here comes my problem… I can’t find many examples of how to install and use this tool. Could someone help me with the different points:
- Which Library to choose?
- How to install the library?
- How to test the library with a simple call script?
- Where do I start?

I have configured ARI and a User Ari through freepbx, this operation is functional.

Thanks you.

Translated with www.DeepL.com/Translator (free version)strong text

You can initiate a call in Asterisk through ARI, a shell script, a python script, a manager command … ARI being the newest and probably the most complicated one.
so start by learning the basics first (asterisk -rx “originate …” , asterisk -rx “core show application originate” for help) then choose whichever suits your skills,
My favourite one is the manager interface.

Thanks for your answer!

I have done a first exercise which is to launch a call via a Telnet connection with AMI.

ex :

Telnet @Ip 5038

Action: login

username:asterisk

secret:asterisk

Action:Originate

Channel:PJSIP/1000

Context:From-internal

exten:1000

priority:1

Application:Playback

data:alarm2

This works. Now I would like to try to do the same with a Js or python script and using ARI, but I can’t do it…

Could someone explain me the procedure please?

https://www.tutorialspoint.com/python/python_networking.htm

or for a more abstract interface, see

https://wiki.asterisk.org/wiki/display/AST/AMI+Libraries+and+Frameworks

It’s not the expected answer but thank you!

Let me explain:

I would like to make my Asterisk server make an automatic call to a phone.
And in a second time that the server performs an audio message in the conversation.
All this through ARI since I have to run this system with a TCP connection.

I would like to have some examples of script of this type.

thanks

Although I didn’t understand “a second time that”, this doesn’t sound like a typical case where ARI would be the best solution.

Accessing by TCP leaves a very large number of options open, including planting call files with FTP.

The nearest thing for which you are likely to find worked examples is click to call, for which I think all the worked examples will pre-date ARI’s introduction.

As a general point, this forum is best at giving you general pointers, for further research. You will have to be very lucky to get worked examples for your particular requirement, particularly if you over constrain the requirements.

Thank you once again for your reply.

Sorry for my broken English, I use a translator.

I understand what you are saying, but isn’t ARI supposed to be an application that allows us to make our own communication applications, combining AGI and AMI? Did I misunderstand this?

To explain with more details:

A monitoring system will raise alarms, if an alarm goes up, this system will contact the Asterisk server which will execute an on-call procedure. I was advised to use ARI to do this, but I admit I’m a bit confused and don’t really see how to do this.

It is s protocol for implementing complex dialplan applications. It has nothing to do with AMI. It is currently overused, because it is new, and therefore fashionable.

This is an example using call files, rather than AMI or ARI. Most of it is about technical details on creating an announcement on the fly. Actually sending it is very simple.

You already have a successful call using AMI, my advice would be to stick to AMI, there are plenty of libraries that you can use.
ARI is not impossible but for someone who has yet to understand AGI and AMI and other basics it could be.

Thanks, I didn’t understand that on ARI.

I read this on : Asterisk REST Interface (ARI) - Asterisk Project - Asterisk Project Wiki

ARI: An Interface for Communications Applications

The Asterisk RESTful Interface (ARI) was created to address these concerns. While AMI is good at call control and AGI is good at allowing a remote process to execute dialplan applications, neither of these APIs was designed to let a developer build their own custom communications application. ARI is an asynchronous API that allows developers to build communications applications by exposing the raw primitive objects in Asterisk - channels, bridges, endpoints, media, etc. - through an intuitive REST interface. The state of the objects being controlled by the user are conveyed via JSON events over a WebSocket.

for me, it combined the AMI and AGI features.
Thanks for the links I will look at

Indeed AMI and AGI are already very complicated,

However, I also have to implement a system that is just as complicated.

I am asked to implement an automatic on-call system that invites us to call another number to confirm an identity and then to listen to information about the system failure.

Alarm > On call > hang up > The on call person calls a number > confirms his identity by password > listens to the information about the alarm > hang up

Is it possible to do this with AMI?

ps: according to my superiors this kind of system has already been implemented with asterisk

Most should be done with dialplan. AMI is just used to start the process off.

Okay thanks, one more question:
How to manage the dialplan with Freepbx?

Wrong forum. However, I think you would need its ability to run custom dialplan, so your dialplan would probably be outside the control of FreePBX.

The peer support forum for FreePBX is

I’m pretty sure you need at least one custom dialplan application call (Stasis()) even if most is done in ARI.

Thank you so much for your help!

I realize that this is really not easy to set up.

I’m going to keep looking into how to do all of this.

go bare bones, freepbx is very complexe, it will get in the way and you won’t know it.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.