How to get list of sip peers from endpoints with ari-py

1.1k Views Asked by At

It is not clear how to get list of sip peers from ari/endpoints with this library.

Examples in repository show actions with channels and bridges but not with endpoints.

The JSON response is available via localhost:8088/ari/endpoints/SIP with browser or wscat.

How to get it via ari client ?

import ari
SERVER_ADDR = "http://localhost:8088/"
USER = "user"
PWD = "pwd"
client = ari.connect(SERVER_ADDR, USER, PWD)
1

There are 1 best solutions below

0
On BEST ANSWER

To list the endpoints, you can use:

client.endpoints.list()

To list the SIP endpoints, you can use:

client.endpoints.listByTech(tech='SIP')

The ari-py client is built from the OpenAPI spec returned by Asterisk. There is no other documentation than the OpenAPI spec. You can read the OpenAPI spec with SwaggerUI.

You can also read the OpenAPI spec directly in text on Github for example. The name of the methods of the ari-py client are the same as the nickname of the OpenAPI spec operations, which unfortunately is not shown in SwaggerUI at http://ari.asterisk.org.