Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asterisk ARI Issue #158

Open
luckyboy125 opened this issue Nov 24, 2023 · 24 comments
Open

Asterisk ARI Issue #158

luckyboy125 opened this issue Nov 24, 2023 · 24 comments

Comments

@luckyboy125
Copy link

Hello, everyone.
I have purchased a FreePBX app in DigitalOcean. So I could access FreePBX admin panel and I got some endpoints.
Btw, I made a node server to test APIs and installed ari-client node module in it.
I tried to connect server using below codes, but it doesn't work. (It even doesn't give me an error)

const client = require("ari-client");

client
.connect("https://ip_addr/admin/api/api/rest", "username", "password")
.then(function (ari) {
console.log(ari);
})
.catch(function (err) {
console.log(err);
});

If you have worked in this field, hope to hear from you.
Thank you.

@RizeKishimaro
Copy link

Have You Tried Enable the ARI in Config files? If it's not You Should enable it,

Your code seems fine but you have to connect to ari when the server is initialized, try using
Node-lifecycle

the will ensure that when your server is started it will connect to the ARI endpoint

and remember the ari restapi default endpoint is http://ip:8088/ari

@AimHigh0601
Copy link

AimHigh0601 commented Mar 5, 2024

Hi, @RizeKishimaro

I installed Asterisk server in my Ubuntu PC. I tried to connect Zoiper 5 soft phone to Asterisk server and it worked well. I connected using local IP address. (192.168..*) I tried to connect to Asterisk server in Node.js server.
Here is my code:
`const client = require("ari-client");

const ENDPOINT = "PJSIP/100";

client.connect(
"http://{my global IP address}:8088/ari",
"6001", // username
"mypassword", // password
function (err, ari) {
console.log("Connecting to Asterisk Package!");
if (err) {
console.log("Asterisk Error : ", err);
return;
}
})
`

When I tried with local IP address, it's failed w/ errno -111. (HostIsNotReachable)
But when I run that code, I get nothing. Even I couldn't see any logs in terminal. If it's succeeded, I have to see any log among them. I am not sure what the problem is in the connection.
image

Hope to hear from you soon.
Thank you.

@dorlanpabon
Copy link

Good morning @AimHigh0601 , you asterisk runing in your machine?, the config ari.conf have enabled =yes?, the config ari.conf have comment the rule allowed_origins?
You has send capture ari.conf?

@AimHigh0601
Copy link

Thank you, @dorlanpabon
image
I just changed asterisk user info, and also tried with it. But it didn't work, same error.

@dorlanpabon
Copy link

@AimHigh0601 , you use the user aritest and password in ariclient?
restart diaplan or restart asterisk with now config?
Example:
client = await ariClient.connect("http://localhost:8088", "aritest", "testme");

@AimHigh0601
Copy link

AimHigh0601 commented Mar 5, 2024

image
Yes, I run this code

@dorlanpabon
Copy link

delete ari of URL , "http://localhost:8088/"

@AimHigh0601
Copy link

It doesn't work.

@dorlanpabon
Copy link

in my case work, with http://localhost:8080

Try delete / of URL; you has meet and review?

@dorlanpabon
Copy link

Try

curl -u aritest:testme http://localhost:8088/ari/asterisk/info

@dorlanpabon
Copy link

view http.conf and propertie "bindport" and "bindaddr" and "enabled"

@AimHigh0601
Copy link

image
image
Please check these.

@dorlanpabon
Copy link

uncoment line enable=yes in line 29

A Question, the virtual machine have communication with your pc?

@AimHigh0601
Copy link

I run the node server in that virtual machine. I will try again after I activate line 29.

@AimHigh0601
Copy link

Wow, it worked. But I got this error (warning).
image

@dorlanpabon
Copy link

This warning is a recomendation, but not is an error

@dorlanpabon
Copy link

Note: Not speak english, i am speak spanish, i am practice jejejej

@AimHigh0601
Copy link

Thank you, @dorlanpabon
May I ask you more?

Can I make an outbound call to global phone number using ARI?

@AimHigh0601
Copy link

If anyone has implemented an outbound calling system using ARI, please let me know how you did it.
Thank you.

@AimHigh0601
Copy link

Hola @dorlanpabon
Puedo preguntarte más?

Puedo hacer una llamada saliente a un número de teléfono global usando ARI?

@dorlanpabon
Copy link

dorlanpabon commented Mar 7, 2024

Good morning @AimHigh0601 , for call outbound global, you must have a trunk provider. example: https://www.didww.com/coverage-and-prices/sip-trunking-pricing

If you have a sip trunk with user and password, you was do edit config asterisk to connect the sip trunk for call outbound

ARI in the end is a API of asterisk, to manage actions, example, play audio, route call, make call, but asterisk has connect to sip to was do call outbound global

@AimHigh0601
Copy link

¿Quieres decir que tienes experiencia en el servicio DIDWW? Si es así, tengo algunas preguntas. 1. ¿El servicio DIDWW proporciona Rest API para iniciar, transferir y finalizar una llamada y rastrear una llamada (obtener eventos de clave)? 2. ¿Qué softphone proporciona DIDWW? De lo contrario, ¿qué podemos usar para ello? 3. ¿Su sugerencia es que podemos obtener un troncal SIP de DIDWW y administrar una llamada a través del servidor Asterisk? En este caso, ¿funciona correctamente para las dos preguntas anteriores? Gracias. @dorlanpabon

@dorlanpabon
Copy link

@AimHigh0601 , you can buy sip trunk, after connect asterisk to the sip trunk, then management the call with asterisk using ARI

@AimHigh0601
Copy link

AimHigh0601 commented Mar 7, 2024

Entiendo. Gracias @dorlanpabon
Sólo quiero comprar números turcos y crear un sistema VOIP para números TR. Hablé con el equipo de soporte de DIDWW, pero no proporcionan números TR. ¿Utilizó sólo DIDWW para el sistema VOIP? Hay canales, puentes y aplicaciones en Asterisk. ¿Podemos hacer una llamada saliente usando estos (Asterisk)? ¿Necesitamos simplemente servicios de terceros para una llamada global? Si conoces más servicios, por favor házmelo saber :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants