Author: kmoore
Date: Fri Oct  3 08:32:24 2014
New Revision: 424424

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=424424
Log:
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/
........

Merged revisions 424423 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    branches/13/   (props changed)
    branches/13/main/manager.c

Propchange: branches/13/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: branches/13/main/manager.c
URL: 
http://svnview.digium.com/svn/asterisk/branches/13/main/manager.c?view=diff&rev=424424&r1=424423&r2=424424
==============================================================================
--- branches/13/main/manager.c (original)
+++ branches/13/main/manager.c Fri Oct  3 08:32:24 2014
@@ -812,6 +812,49 @@
                        <para>Send a reload event.</para>
                </description>
        </manager>
+       <managerEvent language="en_US" name="CoreShowChannel">
+               <managerEventInstance class="EVENT_FLAG_CALL">
+                       <synopsis>Raised in response to a CoreShowChannels 
command.</synopsis>
+                       <syntax>
+                               <xi:include 
xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])"
 />
+                               <channel_snapshot/>
+                               <parameter name="BridgeId">
+                                       <para>Identifier of the bridge the 
channel is in, may be empty if not in one</para>
+                               </parameter>
+                               <parameter name="Application">
+                                       <para>Application currently executing 
on the channel</para>
+                               </parameter>
+                               <parameter name="ApplicationData">
+                                       <para>Data given to the currently 
executing application</para>
+                               </parameter>
+                               <parameter name="Duration">
+                                       <para>The amount of time the channel 
has existed</para>
+                               </parameter>
+                       </syntax>
+                       <see-also>
+                               <ref type="manager">CoreShowChannels</ref>
+                               <ref 
type="managerEvent">CoreShowChannelsComplete</ref>
+                       </see-also>
+               </managerEventInstance>
+       </managerEvent>
+       <managerEvent language="en_US" name="CoreShowChannelsComplete">
+               <managerEventInstance class="EVENT_FLAG_CALL">
+                       <synopsis>Raised at the end of the CoreShowChannel list 
produced by the CoreShowChannels command.</synopsis>
+                       <syntax>
+                               <xi:include 
xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])"
 />
+                               <parameter name="EventList">
+                                       <para>Conveys the status of the command 
reponse list</para>
+                               </parameter>
+                               <parameter name="ListItems">
+                                       <para>The total number of list items 
produced</para>
+                               </parameter>
+                       </syntax>
+                       <see-also>
+                               <ref type="manager">CoreShowChannels</ref>
+                               <ref type="managerEvent">CoreShowChannel</ref>
+                       </see-also>
+               </managerEventInstance>
+       </managerEvent>
        <manager name="CoreShowChannels" language="en_US">
                <synopsis>
                        List currently active channels.
@@ -822,6 +865,12 @@
                <description>
                        <para>List currently defined channels and some 
information about them.</para>
                </description>
+               <responses>
+                       <list-elements>
+                               <xi:include 
xpointer="xpointer(/docs/managerEvent[@name='CoreShowChannel'])" />
+                       </list-elements>
+                       <xi:include 
xpointer="xpointer(/docs/managerEvent[@name='CoreShowChannelsComplete'])" />
+               </responses>
        </manager>
        <manager name="LoggerRotate" language="en_US">
                <synopsis>
@@ -5509,18 +5558,37 @@
        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++;
 


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to