[asterisk-commits] file: branch group/stasis_cache_usage r393776 - /team/group/stasis_cache_usag...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Jul 7 14:30:32 CDT 2013
Author: file
Date: Sun Jul 7 14:30:29 2013
New Revision: 393776
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393776
Log:
Incorporate review feedback.
Modified:
team/group/stasis_cache_usage/main/manager.c
team/group/stasis_cache_usage/main/manager_channels.c
Modified: team/group/stasis_cache_usage/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/group/stasis_cache_usage/main/manager.c?view=diff&rev=393776&r1=393775&r2=393776
==============================================================================
--- team/group/stasis_cache_usage/main/manager.c (original)
+++ team/group/stasis_cache_usage/main/manager.c Sun Jul 7 14:30:29 2013
@@ -221,6 +221,106 @@
value for the specified channel variables.</para>
</description>
</manager>
+ <managerEvent language="en_US" name="Status">
+ <managerEventInstance class="EVENT_FLAG_CALL">
+ <synopsis>Raised in response to a Status command.</synopsis>
+ <syntax>
+ <parameter name="ActionID" required="false"/>
+ <parameter name="Channel">
+ <para>Name of the channel</para>
+ </parameter>
+ <parameter name="Type">
+ <para>Type of channel</para>
+ </parameter>
+ <parameter name="DNID">
+ <para>Dialed number identifier</para>
+ </parameter>
+ <parameter name="ChannelState">
+ <para>A numeric code for the channel's current state, related to ChannelStateDesc</para>
+ </parameter>
+ <parameter name="ChannelStateDesc">
+ <para>Name for the channel's current state</para>
+ <enumlist>
+ <enum name="Down"/>
+ <enum name="Rsrvd"/>
+ <enum name="OffHook"/>
+ <enum name="Dialing"/>
+ <enum name="Ring"/>
+ <enum name="Ringing"/>
+ <enum name="Up"/>
+ <enum name="Busy"/>
+ <enum name="Dialing Offhook"/>
+ <enum name="Pre-ring"/>
+ <enum name="Unknown"/>
+ </enumlist>
+ </parameter>
+ <parameter name="CallerIDNum">
+ </parameter>
+ <parameter name="CallerIDName">
+ </parameter>
+ <parameter name="ConnectedLineNum">
+ </parameter>
+ <parameter name="ConnectedLineName">
+ </parameter>
+ <parameter name="EffectiveConnectedLineNum">
+ </parameter>
+ <parameter name="EffectiveConnectedLineName">
+ </parameter>
+ <parameter name="AccountCode">
+ </parameter>
+ <parameter name="Context">
+ </parameter>
+ <parameter name="Exten">
+ </parameter>
+ <parameter name="Priority">
+ </parameter>
+ <parameter name="Uniqueid">
+ <para>Unique identifier for the channel</para>
+ </parameter>
+ <parameter name="TimeToHangup">
+ <para>Absolute lifetime of the channel</para>
+ </parameter>
+ <parameter name="BridgeID">
+ <para>Identifier of the bridge the channel is in, may be empty if not in one</para>
+ </parameter>
+ <parameter name="Linkedid">
+ </parameter>
+ <parameter name="Application">
+ <para>Application currently executing on the channel</para>
+ </parameter>
+ <parameter name="Data">
+ <para>Data given to the currently executing channel</para>
+ </parameter>
+ <parameter name="Nativeformats">
+ <para>Media formats the connected party is willing to send or receive</para>
+ </parameter>
+ <parameter name="Readformat">
+ <para>Media formats that frames from the channel are received in</para>
+ </parameter>
+ <parameter name="Readtrans">
+ <para>Translation path for media received in native formats</para>
+ </parameter>
+ <parameter name="Writeformat">
+ <para>Media formats that frames to the channel are accepted in</para>
+ </parameter>
+ <parameter name="Writetrans">
+ <para>Translation path for media sent to the connected party</para>
+ </parameter>
+ <parameter name="Callgroup">
+ <para>Configured call group on the channel</para>
+ </parameter>
+ <parameter name="Pickupgroup">
+ <para>Configured pickup group on the channel</para>
+ </parameter>
+ <parameter name="Seconds">
+ <para>Number of seconds the channel has been active</para>
+ </parameter>
+ </syntax>
+ <see-also>
+ <ref type="manager">Status</ref>
+ </see-also>
+ </managerEventInstance>
+ </managerEvent>
<manager name="Setvar" language="en_US">
<synopsis>
Set a channel variable.
@@ -3702,6 +3802,7 @@
);
struct ast_str *str = ast_str_create(1000);
struct ao2_iterator it_chans;
+ struct timeval now = ast_tvnow();
if (!ast_strlen_zero(id)) {
snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
@@ -3741,6 +3842,7 @@
struct ast_channel_snapshot *snapshot = stasis_message_data(msg);
struct ast_channel *c;
struct ast_str *built = ast_manager_build_channel_state_string_prefix(snapshot, "");
+ long elapsed_seconds = 0;
if (!built) {
continue;
@@ -3768,13 +3870,52 @@
channels++;
+
+ if (!ast_tvzero(snapshot->creationtime)) {
+ elapsed_seconds = now.tv_sec - snapshot->creationtime.tv_sec;
+ }
+
astman_append(s,
"Event: Status\r\n"
"Privilege: Call\r\n"
+ "Type: %s\r\n"
+ "DNID: %s\r\n"
+ "EffectiveConnectedLineNum: %s\r\n"
+ "EffectiveConnectedLineName: %s\r\n"
+ "TimeToHangup: %ld\r\n"
+ "BridgeID: %s\r\n"
+ "Linkedid: %s\r\n"
+ "Application: %s\r\n"
+ "Data: %s\r\n"
+ "Nativeformats: %s\r\n"
+ "Readformat: %s\r\n"
+ "Readtrans: %s\r\n"
+ "Writeformat: %s\r\n"
+ "Writetrans: %s\r\n"
+ "Callgroup: %llu\r\n"
+ "Pickupgroup: %llu\r\n"
+ "Seconds: %ld\r\n"
"%s"
"%s"
"%s"
"\r\n",
+ snapshot->type,
+ snapshot->caller_dnid,
+ S_OR(snapshot->effective_number, "<unknown>"),
+ S_OR(snapshot->effective_name, "<unknown>"),
+ snapshot->hanguptime.tv_sec,
+ snapshot->bridgeid,
+ snapshot->linkedid,
+ snapshot->appl,
+ snapshot->data,
+ snapshot->nativeformats,
+ snapshot->readformat,
+ snapshot->readtrans,
+ snapshot->writeformat,
+ snapshot->writetrans,
+ snapshot->callgroup,
+ snapshot->pickupgroup,
+ (long) elapsed_seconds,
ast_str_buffer(built),
ast_str_buffer(str),
idText);
Modified: team/group/stasis_cache_usage/main/manager_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/group/stasis_cache_usage/main/manager_channels.c?view=diff&rev=393776&r1=393775&r2=393776
==============================================================================
--- team/group/stasis_cache_usage/main/manager_channels.c (original)
+++ team/group/stasis_cache_usage/main/manager_channels.c Sun Jul 7 14:30:29 2013
@@ -45,12 +45,6 @@
<parameter name="Channel">
<para>Name of the channel</para>
</parameter>
- <parameter name="Type">
- <para>Type of channel</para>
- </parameter>
- <parameter name="DNID">
- <para>Dialed number identifier</para>
- </parameter>
<parameter name="ChannelState">
<para>A numeric code for the channel's current state, related to ChannelStateDesc</para>
</parameter>
@@ -78,10 +72,6 @@
</parameter>
<parameter name="ConnectedLineName">
</parameter>
- <parameter name="EffectiveConnectedLineNum">
- </parameter>
- <parameter name="EffectiveConnectedLineName">
- </parameter>
<parameter name="AccountCode">
</parameter>
<parameter name="Context">
@@ -92,47 +82,6 @@
</parameter>
<parameter name="Uniqueid">
<para>Unique identifier for the channel</para>
- </parameter>
- <parameter name="TimeToHangup">
- <para>Absolute lifetime of the channel</para>
- </parameter>
- <parameter name="BridgeID">
- <para>Identifier of the bridge the channel is in, may be empty if not in one</para>
- </parameter>
- <parameter name="Linkedid">
- </parameter>
- <parameter name="Callid">
- <para>Call identifier for the overall call</para>
- </parameter>
- <parameter name="Application">
- <para>Application currently executing on the channel</para>
- </parameter>
- <parameter name="Data">
- <para>Data given to the currently executing channel</para>
- </parameter>
- <parameter name="Nativeformats">
- <para>Media formats the connected party is willing to send or receive</para>
- </parameter>
- <parameter name="Readformat">
- <para>Media formats that frames from the channel are received in</para>
- </parameter>
- <parameter name="Readtrans">
- <para>Translation path for media received in native formats</para>
- </parameter>
- <parameter name="Writeformat">
- <para>Media formats that frames to the channel are accepted in</para>
- </parameter>
- <parameter name="Writetrans">
- <para>Translation path for media sent to the connected party</para>
- </parameter>
- <parameter name="Callgroup">
- <para>Configured call group on the channel</para>
- </parameter>
- <parameter name="Pickupgroup">
- <para>Configured pickup group on the channel</para>
- </parameter>
- <parameter name="Seconds">
- <para>Number of seconds the channel has been active</para>
</parameter>
</syntax>
</managerEventInstance>
@@ -579,78 +528,36 @@
{
struct ast_str *out = ast_str_create(1024);
int res = 0;
- struct timeval now = ast_tvnow();
- long elapsed_seconds = 0;
if (!out) {
return NULL;
}
- if (!ast_tvzero(snapshot->creationtime)) {
- elapsed_seconds = now.tv_sec - snapshot->creationtime.tv_sec;
- }
-
res = ast_str_set(&out, 0,
"%sChannel: %s\r\n"
- "%sType: %s\r\n"
- "%sDNID: %s\r\n"
"%sChannelState: %d\r\n"
"%sChannelStateDesc: %s\r\n"
"%sCallerIDNum: %s\r\n"
"%sCallerIDName: %s\r\n"
"%sConnectedLineNum: %s\r\n"
"%sConnectedLineName: %s\r\n"
- "%sEffectiveConnectedLineNum: %s\r\n"
- "%sEffectiveConnectedLineName: %s\r\n"
"%sAccountCode: %s\r\n"
"%sContext: %s\r\n"
"%sExten: %s\r\n"
"%sPriority: %d\r\n"
- "%sUniqueid: %s\r\n"
- "%sTimeToHangup: %ld\r\n"
- "%sBridgeID: %s\r\n"
- "%sLinkedid: %s\r\n"
- "%sCallid: %s\r\n"
- "%sApplication: %s\r\n"
- "%sData: %s\r\n"
- "%sNativeformats: %s\r\n"
- "%sReadformat: %s\r\n"
- "%sReadtrans: %s\r\n"
- "%sWriteformat: %s\r\n"
- "%sWritetrans: %s\r\n"
- "%sCallgroup: %llu\r\n"
- "%sPickupgroup: %llu\r\n"
- "%sSeconds: %ld\r\n",
+ "%sUniqueid: %s\r\n",
prefix, snapshot->name,
- prefix, snapshot->type,
- prefix, snapshot->caller_dnid,
prefix, snapshot->state,
prefix, ast_state2str(snapshot->state),
prefix, S_OR(snapshot->caller_number, "<unknown>"),
prefix, S_OR(snapshot->caller_name, "<unknown>"),
prefix, S_OR(snapshot->connected_number, "<unknown>"),
prefix, S_OR(snapshot->connected_name, "<unknown>"),
- prefix, S_OR(snapshot->effective_number, "<unknown>"),
- prefix, S_OR(snapshot->effective_name, "<unknown>"),
prefix, snapshot->accountcode,
prefix, snapshot->context,
prefix, snapshot->exten,
prefix, snapshot->priority,
- prefix, snapshot->uniqueid,
- prefix, snapshot->hanguptime.tv_sec,
- prefix, snapshot->bridgeid,
- prefix, snapshot->linkedid,
- prefix, snapshot->callid,
- prefix, snapshot->appl,
- prefix, snapshot->data,
- prefix, snapshot->nativeformats,
- prefix, snapshot->readformat,
- prefix, snapshot->readtrans,
- prefix, snapshot->writeformat,
- prefix, snapshot->writetrans,
- prefix, snapshot->callgroup,
- prefix, snapshot->pickupgroup,
- prefix, (long) elapsed_seconds);
+ prefix, snapshot->uniqueid);
if (!res) {
return NULL;
More information about the asterisk-commits
mailing list