Discovering left over Asterisk resources I created

I’m trying to figure out if my ARI based code is properly cleaning up after itself. My code creates bridges, channels, and playback resources. In simple tests it works fine (I check ws messages), but I would like to load test my code, in which case manually trying to reconcile all of the websocket messages is too much to do.

Is there an Asterisk CLI command that will show all bridges, channels, and resources in existence, so that I can see what is left over after my program runs? There is nothing else running on this test PBX, so it should only be my own leftovers.

I recall seeing some ARI commands to list resources, but I’m hoping not to have to write a program to check my program. A simple CLI command (or maybe if someone has prewritten a bash script) that would be fantastic.

My Seaskirt examples repo includes the rest tool, which you can use to invoke any ARI function from the command line. Example session:

rest --user=testing --password=please get /bridges
response = []

rest --user=testing --password=please post /bridges
response = {'id': '2141123d-ffce-4245-b368-9069d725edd1', 'technology': 'simple_bridge', 'bridge_type': 'mixing', 'bridge_class': 'stasis', 'creator': 'Stasis', 'name': '', 'channels': [], 'creationtime': '2024-10-21T12:12:21.041+1300', 'video_mode': 'talker'}

rest --user=testing --password=please delete /bridges/2141123d-ffce-4245-b368-9069d725edd1
response = None

rest --user=testing --password=please get /bridges
response = []

That’s probably a little simpler than CURL…so I’ll wait a day and if no better answers I’ll give that a try. Thanks

For CLI commands, core show channels and bridge show all should give you what you want. There are also two equivalent AMI commands CoreShowChannels and BridgeList. If you have the internal HTTP server enabled, you can invoke them via curl using the rawman URI…

curl -c cookies http://localhost:8088/rawman?action=login&username=test&secret=test
curl -b cookies http://localhost:8088/rawman?action=CoreShowChannels
curl -b cookies http://localhost:8088/rawman?action=BridgeList

You need the -c and -b options because the login action returns a cookie for authentication.

Besides invoking CLI commands with asterisk -rx, you can also invoke any CLI command via AMI with the Command action…

curl -c cookies http://localhost:8088/rawman?action=login&username=test&secret=test
curl -b cookies http://localhost:8088/rawman?action=Command&command=Core+Show+Channels
curl -b cookies http://localhost:8088/rawman?action=Command&command=Bridge+Show+all

Is rawman part of the AMI-over-HTTP interface? That’s been deprecated for a while now.

Not exactly deprecated. The page you reference does say “may be removed in the future” but there are no plans to do so. The code that provides that functionality is a tiny part of the manager and has been working fine for almost 20 years so there’s no reason to remove it. Even if we did find a reason, there’d be lots of advanced notice.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.