Reputation: 63
I am using ari4java library and I have a problem with registering a stasis application. If I use the command line to connect to Asterisk and listen for events for a specific application name it works. It creates the application and everything is OK. The problem appears when I do it by using the ari4java library in Java. Actually, I'm trying the example from the library's github repository (i.e. - ConnectAndDial.java)[1]. I understand that the ARI.build(...) call:
ari = ARI.build(
ASTERISK_ADDRESS,
"app_test",
ASTERISK_USER,
ASTERISK_PASS,
AriVersion.ARI_3_0_0
);
must create an application named "app_test". The reality is that it does not.
for (Application app : ari.applications().list()) {
System.out.print(app.getName() + " ");
}
The code above, executed after ARI.build(...) prints nothing. That means there is no application registered in Asterisk. Running "ari show apps" in Asterisk CLI also tells me that there is no app registered.
I can't understand, where is the problem? Can somebody, please, help me with this?
Thanks in advance.
P.S.: I am using Asterisk 15.4.0
Upvotes: 1
Views: 1005
Reputation: 38
First of all you need to create an instance of ARI using ARI.build, as you did. For example:
ARI ari = ARI.build(asteriskUrl, "stasisApp", "userid", "secret", AriVersion.ARI_3_0_0);
Besides that you need to define configuration files as follows:
[general]
enabled = yes
pretty = yes
[userid]
type = user
read_only = no
password = secret
[general]
enabled = yes
pretty = yes
[userid]
type = user
read_only = no
password = secret
[general]
enabled = yes
bindaddr = 0.0.0.0
bindport = 8088
In addition, after creating ARI instance you can open a websocket to listen to ARI events, using: ari.events().eventWebsocket("stasisApp", true, ariCallback);
Upvotes: 1