Bridge creation time

Using Asterisk with another switch and around once per day, the other switch never sends a bye and so we have a stuck bridge and channels. I’ve been kicking one of the channels out of the bridge using the CLI. However, would like to have a program that runs that does it. The main problem is we only want to touch the bridges that are at least 48 hours old. I was planning on using AMI, but the BridgeList doesn’t contain the creationtime (this is Asterisk 18.5.1). Do later versions of Asterisk include it? If not, is there some other way to get it?

The AMI events returned from BridgeList or BridgeInfo do not contain the created time but the ARI bridge list does.

curl http://<user>:<pass>@127.0.0.1:8088/ari/bridges
[
  {
    "id": "b16ffa2b-5d96-49b5-bbc5-64b648f4fe3e",
    "technology": "simple_bridge",
    "bridge_type": "mixing",
    "bridge_class": "basic",
    "creator": "",
    "name": "",
    "channels": [
      "ernie-1719869531.6",
      "ernie-1719869531.7"
    ],
    "creationtime": "2024-07-01T15:32:13.474-0600",
    "video_mode": "none"
  }
]

EDIT:
Although you can list all bridges via ARI, you can’t manipulate/destroy them via ARI unless they were created via ARI. You can still use ARI to get the bridge id and creationtime though, then use AMI BridgeDestroy to kill it.

Is it failing to send BYE when the session is ended, or is it failing to end the session (e.g. because the upstream has failed to signal release)?

In the first case, using session timers should cause the channel to be dropped, relatively quickly.

You can also set a maximum lifetime for a channel, with AbsoluteTimeout(), but I don’t know at one points the expiry will be honoured, and I don’t know if it works for channels that are not in the dialplan.