summaryrefslogtreecommitdiff
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2004-07-31 20:43:24 +0000
committerMark Spencer <markster@digium.com>2004-07-31 20:43:24 +0000
commitc4bfcdeec5fa188bff3794c98efc875f1ac564d2 (patch)
treec37fbac3168d3cf426527fea3cf73fac24ecc798 /channels/chan_zap.c
parentcfcc58d96e4a4f775b1a8eefbbcf030ce1ba6c9f (diff)
Create manager show channels comamnd (#2186) to monitor zap channel status
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3553 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_zap.c')
-rwxr-xr-xchannels/chan_zap.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index e025c89f3..88780490b 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -8457,6 +8457,49 @@ static int action_zapdialoffhook(struct mansession *s, struct message *m)
return 0;
}
+static int action_zapshowchannels(struct mansession *s, struct message *m)
+{
+ struct zt_pvt *tmp = NULL;
+ char *id = astman_get_header(m, "ActionID");
+ char idText[256] = "";
+
+ astman_send_ack(s, m, "Zapata channel status will follow");
+ if (id && !ast_strlen_zero(id))
+ snprintf(idText, sizeof(idText) - 1, "ActionID: %s\r\n", id);
+
+ ast_mutex_lock(&iflock);
+
+ tmp = iflist;
+ while (tmp) {
+ if (tmp->channel > 0) {
+ int alarm = get_alarms(tmp);
+
+ ast_cli(s->fd,
+ "Event: ZapShowChannels\r\n"
+ "Channel: %d\r\n"
+ "Signalling: %s\r\n"
+ "Context: %s\r\n"
+ "Alarm: %s\r\n"
+ "%s"
+ "\r\n",
+ tmp->channel, sig2str(tmp->sig), tmp->context,
+ alarm2str(alarm), idText);
+ }
+
+ tmp = tmp->next;
+ }
+
+ ast_mutex_unlock(&iflock);
+
+ ast_cli(s->fd,
+ "Event: ZapShowChannelsComplete\r\n"
+ "%s"
+ "\r\n",
+ idText);
+
+ return 0;
+}
+
static int __unload_module(void)
{
int x = 0;
@@ -8485,6 +8528,7 @@ static int __unload_module(void)
ast_manager_unregister( "ZapTransfer" );
ast_manager_unregister( "ZapDNDoff" );
ast_manager_unregister( "ZapDNDon" );
+ ast_manager_unregister("ZapShowChannels");
ast_unregister_application(app_callingpres);
ast_channel_unregister(typecompat);
ast_channel_unregister(type);
@@ -9262,6 +9306,7 @@ int load_module(void)
ast_manager_register( "ZapDialOffhook", 0, action_zapdialoffhook, "Dial over Zap channel while offhook" );
ast_manager_register( "ZapDNDon", 0, action_zapdndon, "Toggle Zap channel Do Not Disturb status ON" );
ast_manager_register( "ZapDNDoff", 0, action_zapdndoff, "Toggle Zap channel Do Not Disturb status OFF" );
+ ast_manager_register("ZapShowChannels", 0, action_zapshowchannels, "Show status zapata channels");
return res;
}