Index: channels/chan_dahdi.c =================================================================== --- channels/chan_dahdi.c (revision 270975) +++ channels/chan_dahdi.c (working copy) @@ -15244,6 +15244,61 @@ return 0; } +#if defined(HAVE_PRI) +static int action_dahdishowspans(struct mansession *s, const struct message *m) +{ + int span, count, x; + struct dahdi_pvt *tmp = NULL; + const char *id = astman_get_header(m, "ActionID"); + char idText[256] = ""; + + astman_send_ack(s, m, "DAHDI span status will follow"); + if (!ast_strlen_zero(id)) { + snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id); + } + + for (span = count = 0; span < NUM_SPANS; span++) { + if (pris[span].pri) { + for (x = 0; x < NUM_DCHANS; x++) { + if (pris[span].dchannels[x]) { + count++; + + astman_append(s, + "Event: DAHDIShowSpans\r\n" + "DAHDISpan: %d/%d\r\n" + "Channel: %d\r\n" + "DChannel: %d\r\n" + "Provisioned: %d\r\n" + "Alarm: %d\r\n" + "Up: %d\r\n" + "Active: %d\r\n" + "%s" + "\r\n", + span + 1, x, + span + 1, + x, + pris[span].dchanavail[x] & DCHAN_PROVISIONED ? 1 : 0, + pris[span].dchanavail[x] & DCHAN_NOTINALARM ? 0 : 1, + pris[span].dchanavail[x] & DCHAN_UP ? 1 : 0, + pris[span].dchans[x] == pris[span].pri ? 1 : 0, + idText + ); + } + } + } + } + + astman_append(s, + "Event: DAHDIShowSpansComplete\r\n" + "Items: %d\r\n" + "%s" + "\r\n", + count, + idText); + return 0; +} +#endif + #if defined(HAVE_SS7) static int linkset_addsigchan(int sigchan) { @@ -15818,6 +15873,9 @@ ast_manager_unregister("DAHDIDNDoff"); ast_manager_unregister("DAHDIDNDon"); ast_manager_unregister("DAHDIShowChannels"); +#if defined(HAVE_PRI) + ast_manager_unregister("DAHDIShowSpans"); +#endif ast_manager_unregister("DAHDIRestart"); ast_channel_unregister(&dahdi_tech); @@ -17469,6 +17527,9 @@ ast_manager_register_xml("DAHDIDNDoff", 0, action_dahdidndoff); ast_manager_register_xml("DAHDIShowChannels", 0, action_dahdishowchannels); ast_manager_register_xml("DAHDIRestart", 0, action_dahdirestart); +#if defined(HAVE_PRI) + ast_manager_register_xml("DAHDIShowSpans", 0, action_dahdishowspans); +#endif ast_cond_init(&ss_thread_complete, NULL);