How can I get realtime info on pjsip connection

I acquired a script to monitor my trunks, due to my internet service being satellite and having occasional outages.

This script had sip and iax2 capability but I am using pjsip to connect to my trunk provider, so I modified to use “pjsip show registrations” to tell if I have connection or not. This works to a point, but in testing I disconnect my internet from the router, and run the script (or just do a 'asterisk -rx “pjsip show registrations” ') and it shows “Registered” even tho when I go to freepbx dashboard and it says trunk is down. What command would I use to get the info the dashboard is displaying?

Ok, I found the routine that creates the graph for the dashboard & see it uses “pjsip show endpoints” to get it’s information.

I got the script from

Here is the modified script if anyone else needs such a thing