How to enable ARI and Connect with WebSocket on Asterisk
To Enable ARI And Connect With WebSocket On Asterisk
Introduction:
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 is conveyed via JSON events over a WebSocket.
Procedure Steps:
Step 1: Check the OS version by using the below command
root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
Step 2: I have already installed Asterisk on Ubuntu machine, now check the status of the Asterisk service by using the below command
root@linuxhelp:~# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
Loaded: loaded (/etc/init.d/asterisk; generated)
Active: active (running) since Thu 2023-09-14 10:24:21 IST; 2 months 7 days ago
Docs: man:systemd-sysv-generator(8)
Process: 1369 ExecStart=/etc/init.d/asterisk start (code=exited, status=0/SUCCESS)
Tasks: 78 (limit: 4489)
Memory: 83.7M
CPU: 7min 11.930s
CGroup: /system.slice/asterisk.service
└─1391 /usr/sbin/asterisk
Sep 14 10:24:20 linuxhelp systemd[1]: Starting LSB: Asterisk PBX...
Sep 14 10:24:21 linuxhelp asterisk[1369]: * Starting Asterisk PBX: asterisk
Sep 14 10:24:21 linuxhelp asterisk[1369]: ...done.
Sep 14 10:24:21 linuxhelp systemd[1]: Started LSB: Asterisk PBX.
Sep 14 10:24:24 linuxhelp asterisk[1391]: radcli: rc_read_config: rc_read_config: can't open /etc/radiusclient-ng/radius>
Sep 14 10:24:24 linuxhelp asterisk[1391]: radcli: rc_read_config: rc_read_config: can't open /etc/radiusclient-ng/radius>
Step 3: For enabling ARI, First move to the Asterisk directory by using the below command
root@linuxhelp:~# cd /etc/asterisk/
Step 4: Edit ari.conf file by using the below command
root@linuxhelp:/etc/asterisk# vim ari.conf
Check for the following line
enabled=yes
Add the following lines in the ari.conf file
[asterisk]
type=user
read_only=no
password=Linuxc#4
password_format=plain
Step 5: Now ARI has been enabled, need to configure http on asterisk, edit http.conf file in the asterisk directory by using the below command
root@linuxhelp:/etc/asterisk# vim http.conf
Check the following lines in the http.conf file and enter the values like below lines
[general]
enabled=yes
bindaddr=0.0.0.0
bindport=8088
Step 6: After changing the configuration file need to restart the asterisk service by using the below command
root@linuxhelp:/etc/asterisk# systemctl restart asterisk
Go to the browser and search with the following link http://enter-your-ip:8088/ari/endpoints?api_key=username:password
here I’m using my IP address http://192.168.6.113:8088/ari/endpoints?api_key=asterisk:password
After enter the above link enter your Username and Password
Now it will shows the status of the endpoints
Conclusion :
We have reached the end of this article. In this guide, we have walked you through the steps required to enable ARI and connect with Web socket on Asterisk. Your feedback is much welcome.
Comments ( 0 )
No comments available