diff options
author | Richard Mudgett <rmudgett@digium.com> | 2011-04-21 22:53:05 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2011-04-21 22:53:05 +0000 |
commit | 0f1ff9141e22d0bfd46126cb4b22bc7de5cce3ae (patch) | |
tree | 30f81ccc30556c9db6a3f7e2e182b437744e6cae /channels/sig_pri.c | |
parent | 13e925b276887c6a5593f77541ceb9161c4b0281 (diff) |
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
Diffstat (limited to 'channels/sig_pri.c')
-rw-r--r-- | channels/sig_pri.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/channels/sig_pri.c b/channels/sig_pri.c index 49fb246be..c032bf2de 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -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; |