Implement AMI action PRIShowSpans.

PRIShowSpans works like the AMI action DAHDIShowChannels but for PRI
spans.  It is similar to the CLI command "pri show spans".

(closes issue #15980)
Reported by: dwery


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@314735 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Richard Mudgett
2011-04-21 22:53:05 +00:00
parent 13e925b276
commit 0f1ff9141e
3 changed files with 122 additions and 0 deletions

View File

@@ -7040,6 +7040,52 @@ static void *pri_dchannel(void *vpri)
return NULL;
}
/*!
* \brief Output AMI show spans response events for the given PRI span.
* \since 1.10
*
* \param show_cmd AMI command name
* \param s AMI session to output span information.
* \param pri PRI span control structure.
* \param dchannels Array of D channel channel numbers.
* \param action_id Action ID line to use.
*
* \return Number of D channels on this span.
*/
int sig_pri_ami_show_spans(struct mansession *s, const char *show_cmd, struct sig_pri_span *pri, const int *dchannels, const char *action_id)
{
int count;
int x;
count = 0;
for (x = 0; x < ARRAY_LEN(pri->dchans); ++x) {
if (pri->dchans[x]) {
++count;
astman_append(s,
"Event: %s\r\n"
"Span: %d\r\n"
"DChannel: %d\r\n"
"Order: %s\r\n"
"Active: %s\r\n"
"Alarm: %s\r\n"
"Up: %s\r\n"
"%s"
"\r\n",
show_cmd,
pri->span,
dchannels[x],
pri_order(x),
(pri->dchans[x] == pri->pri) ? "Yes" : "No",
(pri->dchanavail[x] & DCHAN_NOTINALARM) ? "No" : "Yes",
(pri->dchanavail[x] & DCHAN_UP) ? "Yes" : "No",
action_id
);
}
}
return count;
}
void sig_pri_init_pri(struct sig_pri_span *pri)
{
int i;