entone

entone

ExARI: An Elixir Library for interfacing with Asterisk the Open Source Communications Software using ARI

ExARI

An Elixir library for interfacing with Asterisk using the ARI protocol.

Be sure to check out the example application https://github.com/citybaseinc/ex_ari_example

The ARI protocol is a robust interface for controlling Asterisk and reacting to Asterisk events. It has been thoroughly tested with Asterisk versions 15 and 16.

ARI stands for Asterisk REST Interface. Through the REST interface it is possible to control just about every aspect of an Asterisk server. ARI also provides a Websocket interface for consuming events from the Asterisk Server. This library has full support for both the REST and Websocket protocols.

If you’re not to familiar with Asterisk, there’s an example repo that will get you up and running with a custom Asterisk IVR in a few minutes, https://github.com/citybaseinc/ex_ari_example .

The documentation is pretty thorough, but it definitely helps to understand Asterisk and ARI.

Check the docs here, https://hexdocs.pm/ex_ari/readme.html

and on hex.pm https://hex.pm/packages/ex_ari

Brought to you by CityBase

Most Liked

trarbr

trarbr

I haven’t even looked at the code yet but I know I am going to love this :heart:

trarbr

trarbr

So I wanted to try the ex_ari_example out last night, but I had some trouble with the Asterisk part. I haven’t played with Asterisk before so I’m not really sure what’s going wrong.

  1. The docker run ... command uses --net host, which doesn’t work on Mac unfortunately. So I ran it like this instead: docker run -p 8088:8088 -p 8089:8089 -p 5062:5062/tcp -p 5062:5062/udp -p 10000-10099:10000-10099/udp --name asterisk -v $PWD/asterisk_local_config/pjsip.conf:/etc/asterisk/pjsip.conf ex-ari-asterisk (I googled around a bit and guessed at the ports). After this, I could start the project with iex -S mix and it connected!
  2. However, I was unable to connect to Asterisk with Zoiper. On the accounts page it says Request Timeout (code: 408) and there is nothing in the Asterisk logs.
  3. I then tried running the Asterisk container inside an Ubuntu virtual machine, using --net host, and running it on a bridged network (VM had IP 192.168.33.10). I changed all the references to 127.0.0.1 to 192.168.33.10 in dev.env, so the Elixir project works fine. But Zoiper gives me a new error now. Instead of Request Timeout (code: 408) error, I now get Unauthorized (code: 401) and I see this in the Asterisk logs:
[Feb 14 07:29:30] NOTICE[37]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'REGISTER' from '<sip:ex_ari@192.168.33.10>' failed for '192.168.33.1:5063' (callid: _R51m7KNwSEepDSdZ6NrSA..) - No matching endpoint found
[Feb 14 07:29:30] NOTICE[37]: res_pjsip/pjsip_distributor.c:676 log_failed_request: Request 'REGISTER' from '<sip:ex_ari@192.168.33.10>' failed for '192.168.33.1:5063' (callid: _R51m7KNwSEepDSdZ6NrSA..) - Failed to authenticate
<--- Transmitting SIP response (505 bytes) to UDP:192.168.33.1:5063 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.33.1:5063;rport=5063;received=192.168.33.1;branch=z9hG4bK-524287-1---339444ffe79eb675
Call-ID: _R51m7KNwSEepDSdZ6NrSA..
From: <sip:ex_ari@192.168.33.10>;tag=5292835a
To: <sip:ex_ari@192.168.33.10>;tag=z9hG4bK-524287-1---339444ffe79eb675
CSeq: 2 REGISTER
WWW-Authenticate: Digest realm="ex_ari",nonce="1581665370/39d4d6299126e965bb54cf6033f8eca3",opaque="389d044662fe0ad8",algorithm=md5,qop="auth"
Server: Asterisk PBX 16.3.0
Content-Length:  0

I wonder if I am using the wrong username/password?

lawik

lawik

Nerves Core Team

Super curious about this stuff. I don’t have the time anytime soon to dive into Asterisk but damn if I don’t want to :slight_smile:

Considering the Erlang/OTP telecommunications heritage, are there previous solutions to work with Asterisk around, do you know?

Cool that you are doing and releasing this!

entone

entone

I run Linux so haven’t had the Mac issues. It looks like you got really really close! I should probably be explicit about the demo only working on Linux as of now.

I’ll dig in a bit more in a few hours. Asterisk is NOT simple to setup. If we get it working would be great if you could write-up some notes for Mac dev.

entone

entone

It looks like your port is incorrect in your Zoiper settings.

Under Settings -> Advanced -> Network

All the way at the bottom.

Make sure your SIP Options port is set to 5062 and the Open random port above 32000 is unchecked

You may need to update the AOR_IPS in dev.env to be 192.168.33.1:5062 as well.

But give it a try with just the port update in Zoiper first.

Where Next?

Popular in Libraries Top

wmnnd
Hi there, for my project DBLSQD, I needed a file storage solution that is a bit more flexible than Arc. Because I thought others might f...
New
versilov
Could not wait for the missing Elixir ML libraries to appear, so, I wrote one myself, taking https://github.com/sdwolfz/exlearn as a foun...
New
deadtrickster
I’ve just released stable versions of my Prometheus Elixir libs: Elixir client [docs]; Ecto collector [docs]; Plugs instrumenter/Export...
New
woutdp
Hi! I wanted to introduce my latest project LiveSvelte. It allows you to render Svelte inside LiveView with end-to-end reactivity. It’s ...
New
jakub-zawislak
Hi everyone, I’m coming from the Symfony (PHP) framework. I like Phoenix, but it has a one thing that was build much better in the Symfo...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
gabrielpoca
Hello everyone! I want to share with you something that I’m really proud of: https://stillstatic.io/ Still is a static site builder for...
New
KallDrexx
For a good number of months I've been working on creating a very basic RTMP live video streaming server. Now that I have a very, very ba...
New
ostinelli
Let’s write a database! Well not really, but I think it’s a little sad that there doesn’t seem to be a simple in-memory distributed KV da...
New
New

Other popular topics Top

chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

Sub Categories:

We're in Beta

About us Mission Statement