From: Kinsey Moore Date: Fri, 3 Oct 2014 13:24:21 +0000 (+0000) Subject: Manager: Add missing fields and documentation for CoreShowChannels X-Git-Tag: 12.7.0-rc1~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4c6f2483ba955e14b5027c8622b6456d8449394;p=thirdparty%2Fasterisk.git Manager: Add missing fields and documentation for CoreShowChannels This corrects some issues introduced in the responses to the CoreShowChannels AMI command as well as adding documentation for the responses. The command in Asterisk 12 was missing the following fields: Duration, Application, ApplicationData, and BridgedChannel and BridgedUniqueID (replaced with BridgeId). ASTERISK-24262 #close Reported by: Mitch Claborn Review: https://reviewboard.asterisk.org/r/4040/ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@424423 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/manager.c b/main/manager.c index 97e040b75e..f2ca20eb85 100644 --- a/main/manager.c +++ b/main/manager.c @@ -803,6 +803,30 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") List currently defined channels and some information about them. + + + Raised in response to a CoreShowChannels command. + + + + + Identifier of the bridge the channel is in, may be empty if not in one + + + Application currently executing on the channel + + + Data given to the currently executing application + + + The amount of time the channel has existed + + + + CoreShowChannels + + + Module management. @@ -5427,18 +5451,37 @@ static int action_coreshowchannels(struct mansession *s, const struct message *m for (; (msg = ao2_iterator_next(&it_chans)); ao2_ref(msg, -1)) { struct ast_channel_snapshot *cs = stasis_message_data(msg); struct ast_str *built = ast_manager_build_channel_state_string_prefix(cs, ""); + char durbuf[10] = ""; if (!built) { continue; } + if (!ast_tvzero(cs->creationtime)) { + int duration, durh, durm, durs; + + duration = (int)(ast_tvdiff_ms(ast_tvnow(), cs->creationtime) / 1000); + durh = duration / 3600; + durm = (duration % 3600) / 60; + durs = duration % 60; + snprintf(durbuf, sizeof(durbuf), "%02d:%02d:%02d", durh, durm, durs); + } + astman_append(s, "Event: CoreShowChannel\r\n" "%s" "%s" + "Application: %s\r\n" + "ApplicationData: %s\r\n" + "Duration: %s\r\n" + "BridgeId: %s\r\n" "\r\n", idText, - ast_str_buffer(built)); + ast_str_buffer(built), + cs->appl, + cs->data, + durbuf, + cs->bridgeid); numchans++;