From d011c9151284d0328d9ef2f02f10813b4f9cccf9 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 28 Feb 2011 01:12:33 +0100 Subject: mgcp: Prepare the show mgcp command to work on multiple trunks --- openbsc/src/mgcp/mgcp_vty.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/openbsc/src/mgcp/mgcp_vty.c b/openbsc/src/mgcp/mgcp_vty.c index bf8b7d4b0..b9e20e785 100644 --- a/openbsc/src/mgcp/mgcp_vty.c +++ b/openbsc/src/mgcp/mgcp_vty.c @@ -92,16 +92,19 @@ static int config_write_mgcp(struct vty *vty) return CMD_SUCCESS; } -DEFUN(show_mcgp, show_mgcp_cmd, "show mgcp", - SHOW_STR "Display information about the MGCP Media Gateway") +static void dump_trunk(struct vty *vty, struct mgcp_trunk_config *cfg) { int i; - vty_out(vty, "MGCP is up and running with %u endpoints:%s", - g_cfg->trunk.number_endpoints - 1, VTY_NEWLINE); - for (i = 1; i < g_cfg->trunk.number_endpoints; ++i) { - struct mgcp_endpoint *endp = &g_cfg->trunk.endpoints[i]; - vty_out(vty, " Endpoint 0x%.2x: CI: %d net: %u/%u bts: %u/%u on %s traffic received bts: %u/%u remote: %u/%u transcoder: %u/%u%s", + vty_out(vty, "%s trunk nr %d with %d endpoints:%s", + cfg->trunk_type == MGCP_TRUNK_VIRTUAL ? "Virtual" : "E1", + cfg->trunk_nr, cfg->number_endpoints - 1, VTY_NEWLINE); + + for (i = 1; i < cfg->number_endpoints; ++i) { + struct mgcp_endpoint *endp = &cfg->endpoints[i]; + vty_out(vty, + " Endpoint 0x%.2x: CI: %d net: %u/%u bts: %u/%u on %s " + "traffic received bts: %u/%u remote: %u/%u transcoder: %u/%u%s", i, endp->ci, ntohs(endp->net_end.rtp_port), ntohs(endp->net_end.rtcp_port), ntohs(endp->bts_end.rtp_port), ntohs(endp->bts_end.rtcp_port), @@ -111,7 +114,12 @@ DEFUN(show_mcgp, show_mgcp_cmd, "show mgcp", endp->trans_net.packets, endp->trans_bts.packets, VTY_NEWLINE); } +} +DEFUN(show_mcgp, show_mgcp_cmd, "show mgcp", + SHOW_STR "Display information about the MGCP Media Gateway") +{ + dump_trunk(vty, &g_cfg->trunk); return CMD_SUCCESS; } -- cgit v1.2.3