summaryrefslogtreecommitdiff
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
authorOlle Johansson <oej@edvina.net>2007-12-06 14:33:14 +0000
committerOlle Johansson <oej@edvina.net>2007-12-06 14:33:14 +0000
commit39c8fc532d1492f50267bdd10f0f067afac32c59 (patch)
tree994e7aa2d5d304652548d56eb7c0032f0a6d29b0 /channels/chan_zap.c
parent9f1c4887faa3046e9ecfdcf1072c0b6dd21bfc26 (diff)
Update ZapShowChannels so that you can specify one channel.
Action ZapShowChannels Header changes - Channel: -> ZapChannel For active channels, the Channel: and Uniqueid: headers are added You can now add a "ZapChannel: " argument to zapshowchannels actions to only get information about one channel. From the moremanager branch git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91386 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_zap.c')
-rw-r--r--channels/chan_zap.c68
1 files changed, 55 insertions, 13 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index b38b4d5c0..1485cfd12 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -11825,7 +11825,13 @@ static int action_zapshowchannels(struct mansession *s, const struct message *m)
{
struct zt_pvt *tmp = NULL;
const char *id = astman_get_header(m, "ActionID");
+ const char *zapchannel = astman_get_header(m, "ZapChannel");
char idText[256] = "";
+ int channels = 0;
+ int zapchanquery = -1;
+ if (!ast_strlen_zero(zapchannel)) {
+ zapchanquery = atoi(zapchannel);
+ }
astman_send_ack(s, m, "Zapata channel status will follow");
if (!ast_strlen_zero(id))
@@ -11837,18 +11843,52 @@ static int action_zapshowchannels(struct mansession *s, const struct message *m)
while (tmp) {
if (tmp->channel > 0) {
int alarm = get_alarms(tmp);
- astman_append(s,
- "Event: ZapShowChannels\r\n"
- "Channel: %d\r\n"
- "Signalling: %s\r\n"
- "Context: %s\r\n"
- "DND: %s\r\n"
- "Alarm: %s\r\n"
- "%s"
- "\r\n",
- tmp->channel, sig2str(tmp->sig), tmp->context,
- tmp->dnd ? "Enabled" : "Disabled",
- alarm2str(alarm), idText);
+
+ /* If a specific channel is queried for, only deliver status for that channel */
+ if (zapchanquery > 0 && tmp->channel != zapchanquery)
+ continue;
+
+ channels++;
+ if (tmp->owner) {
+ /* Add data if we have a current call */
+ astman_append(s,
+ "Event: ZapShowChannels\r\n"
+ "ZapChannel: %d\r\n"
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n"
+ "AccountCode: %s\r\n"
+ "Signalling: %s\r\n"
+ "SignallingCode: %d\r\n"
+ "Context: %s\r\n"
+ "DND: %s\r\n"
+ "Alarm: %s\r\n"
+ "%s"
+ "\r\n",
+ tmp->channel,
+ tmp->owner->name,
+ tmp->owner->uniqueid,
+ tmp->owner->accountcode,
+ sig2str(tmp->sig),
+ tmp->sig,
+ tmp->context,
+ tmp->dnd ? "Enabled" : "Disabled",
+ alarm2str(alarm), idText);
+ } else {
+ astman_append(s,
+ "Event: ZapShowChannels\r\n"
+ "ZapChannel: %d\r\n"
+ "Signalling: %s\r\n"
+ "SignallingCode: %d\r\n"
+ "Context: %s\r\n"
+ "DND: %s\r\n"
+ "Alarm: %s\r\n"
+ "%s"
+ "\r\n",
+ tmp->channel, sig2str(tmp->sig), tmp->sig,
+ tmp->context,
+ tmp->dnd ? "Enabled" : "Disabled",
+ alarm2str(alarm), idText);
+ }
}
tmp = tmp->next;
@@ -11859,8 +11899,10 @@ static int action_zapshowchannels(struct mansession *s, const struct message *m)
astman_append(s,
"Event: ZapShowChannelsComplete\r\n"
"%s"
+ "Items: %d\r\n"
"\r\n",
- idText);
+ idText,
+ channels);
return 0;
}