简体   繁体   中英

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

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)

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM