How to show just name and status on sip trunk?

Hi community is any way to show just trunk name and status when i run asterisk -rx “sip show peers”

I mean, i got almost 20 sip trunks and i need show just name and status

something like image

i try to use awk

asterisk -rx “sip show peers” | awk ‘{print $1 " " $8}’ but it doesn´t work

chan_sip is going away next year. The CLI commands aren’t designed for machine processing, except, think, for core show channels. The AMI interface is designed for machine processing.

The format used is:

#define PEERS_FORMAT2 "%-25.25s %-39.39s %-3.3s %-10.10s %-10.10s %-3.3s %-8s %-11s %-32.32s %s\n"

You ought to be able to get awk, or at least perl, to match that.

It is used here:

        ast_cli(fd, PEERS_FORMAT2, name,
		tmp_host,
		peer->host_dynamic ? " D " : "   ",	/* Dynamic or not? */
		force_rport_string(peer->flags),
		comedia_string(peer->flags),
		(!ast_acl_list_is_empty(peer->acl)) ? " A " : "   ",       /* permit/deny */
		tmp_port, status,
		peer->description ? peer->description : "",
		cont->realtimepeers ? (peer->is_realtime ? "Cached RT" : "") : "");
1 Like

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