it doesn&#39;t really break anything to add more fields besides the ability to read it but it&#39;s already fairly wide as it is.<br>Thats why we have &quot;show channels as xml&quot;<br><br><br><div class="gmail_quote">On Thu, Jul 16, 2009 at 9:50 AM, Michael S  Collins <span dir="ltr">&lt;<a href="mailto:msc@freeswitch.org">msc@freeswitch.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I wonder if it would make sense to create a separate sub-command like<br>
&quot;show channels stats&quot; or something. That way we could put all sorts of<br>
nifty info there without breaking the existing command.<br>
<br>
Thoughts?<br>
-MC<br>
<br>
Sent from my iPhone<br>
<br>
On Jul 16, 2009, at 7:37 AM, Apostolos Pantsiopoulos &lt;<a href="mailto:regs@kinetix.gr">regs@kinetix.gr</a>&gt;<br>
wrote:<br>
<div><div></div><div class="h5"><br>
&gt; Now that I come to think of it...<br>
&gt;<br>
&gt; It would be useful if we had the timestamp (and epoch)<br>
&gt; of the events PROGRESS and PROGRESS WITH MEDIA so that we can extract<br>
&gt; the PDD (Post Dial Delay) which is a very useful statistic.<br>
&gt;<br>
&gt; Adding the user&#39;s (for the incoming) and the gateway&#39;s (for the<br>
&gt; outbound) id would also be useful. In case these fields are empty the<br>
&gt; show channels command could ommit the (empty string).<br>
&gt;<br>
&gt; Are you planning to implement them yourselves or should I begin<br>
&gt; looking<br>
&gt; at the code?<br>
&gt;<br>
&gt;<br>
&gt; Anthony Minessale wrote:<br>
&gt;&gt; I&#39;m ok with the idea as long as it&#39;s thoroughly tested.<br>
&gt;&gt; If there is any more info you want to save from those events you<br>
&gt;&gt; should<br>
&gt;&gt; consider it now while we are modifying it.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; On Thu, Jul 16, 2009 at 9:02 AM, &lt;<a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a><br>
&gt;&gt; &lt;mailto:<a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a>&gt;&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt;    Hi,<br>
&gt;&gt;<br>
&gt;&gt;    I usually find it very useful when I can retrieve a list of the<br>
&gt;&gt;    currents calls along with durations. I noticed that the &#39;show<br>
&gt;&gt;    channels&#39; format does not include the duration (or the answered<br>
&gt;&gt;    timestamp - so that one can extract it from there). So, I made a<br>
&gt;&gt;    patch that includes the answered timestamp, the answered timestamp<br>
&gt;&gt;    in epoch, and the duration in seconds. Of course these fields<br>
&gt;&gt; remain<br>
&gt;&gt;    empty when the call hasn&#39;t been<br>
&gt;&gt;    answered yet.<br>
&gt;&gt;<br>
&gt;&gt;    I don&#39;t know if anyone else finds this functionality useful, so<br>
&gt;&gt; I am<br>
&gt;&gt;    posting this patch here first (instead of JIRA) in order to get<br>
&gt;&gt;    feedback from the users. If many of you (or the maintainers)<br>
&gt;&gt; find it<br>
&gt;&gt;    interesting I can then proceed in posting it to JIRA.<br>
&gt;&gt;<br>
&gt;&gt;    --<br>
&gt;&gt;    -------------------------------------------<br>
&gt;&gt;    Apostolos Pantsiopoulos<br>
&gt;&gt;    Kinetix Tele.com R &amp; D<br>
&gt;&gt;    email: <a href="mailto:regs@kinetix.gr">regs@kinetix.gr</a> &lt;mailto:<a href="mailto:regs@kinetix.gr">regs@kinetix.gr</a>&gt;<br>
&gt;&gt;    -------------------------------------------<br>
&gt;&gt;<br>
&gt;&gt;    Index: src/mod/applications/mod_commands/mod_commands.c<br>
&gt;&gt;<br>
&gt;&gt; ===================================================================<br>
&gt;&gt;    --- src/mod/applications/mod_commands/mod_commands.c<br>
&gt;&gt; (revision 14256)<br>
&gt;&gt;    +++ src/mod/applications/mod_commands/mod_commands.c    (working<br>
&gt;&gt; copy)<br>
&gt;&gt;    @@ -2827,10 +2827,10 @@<br>
&gt;&gt;                                   }<br>
&gt;&gt;                           }<br>
&gt;&gt;                           if (strchr(argv[2], &#39;%&#39;)) {<br>
&gt;&gt;    -                               sprintf(sql, &quot;select * from<br>
&gt;&gt; channels<br>
&gt;&gt;    where uuid like &#39;%s&#39; or name like &#39;%s&#39; or cid_name like &#39;%s&#39; or<br>
&gt;&gt;    cid_num like &#39;%s&#39; order by created_epoch&quot;,<br>
&gt;&gt;    +                               sprintf(sql, &quot;select<br>
&gt;&gt;    *,strftime(&#39;%%s&#39;,DATETIME(&#39;NOW&#39;))-answered_epoch as duration from<br>
&gt;&gt;    channels where uuid like &#39;%s&#39; or name like &#39;%s&#39; or cid_name like<br>
&gt;&gt;    &#39;%s&#39; or cid_num like &#39;%s&#39; order by created_epoch&quot;,<br>
&gt;&gt;                                                   argv[2], argv[2],<br>
&gt;&gt;    argv[2], argv[2]);<br>
&gt;&gt;                           } else {<br>
&gt;&gt;    -                               sprintf(sql, &quot;select * from<br>
&gt;&gt; channels<br>
&gt;&gt;    where uuid like &#39;%%%s%%&#39; or name like &#39;%%%s%%&#39; or cid_name like<br>
&gt;&gt;    &#39;%%%s%%&#39; or cid_num like &#39;%%%s%%&#39; order by created_epoch&quot;,<br>
&gt;&gt;    +                               sprintf(sql, &quot;select<br>
&gt;&gt;    *,strftime(&#39;%%s&#39;,DATETIME(&#39;NOW&#39;))-answered_epoch as duration from<br>
&gt;&gt;    channels where uuid like &#39;%%%s%%&#39; or name like &#39;%%%s%%&#39; or<br>
&gt;&gt; cid_name<br>
&gt;&gt;    like &#39;%%%s%%&#39; or cid_num like &#39;%%%s%%&#39; order by created_epoch&quot;,<br>
&gt;&gt;                                                   argv[2], argv[2],<br>
&gt;&gt;    argv[2], argv[2]);<br>
&gt;&gt;<br>
&gt;&gt;                           }<br>
&gt;&gt;    @@ -2839,10 +2839,10 @@<br>
&gt;&gt;                                   as = argv[4];<br>
&gt;&gt;                       }<br>
&gt;&gt;                   } else {<br>
&gt;&gt;    -                       sprintf(sql, &quot;select * from channels order<br>
&gt;&gt;    by created_epoch&quot;);<br>
&gt;&gt;    +                       sprintf(sql, &quot;select<br>
&gt;&gt;    *,strftime(&#39;%%s&#39;,DATETIME(&#39;NOW&#39;))-answered_epoch as duration from<br>
&gt;&gt;    channels order by created_epoch&quot;);<br>
&gt;&gt;                   }<br>
&gt;&gt;           } else if (!strcasecmp(command, &quot;channels&quot;)) {<br>
&gt;&gt;    -               sprintf(sql, &quot;select * from channels order by<br>
&gt;&gt;    created_epoch&quot;);<br>
&gt;&gt;    +               sprintf(sql, &quot;select<br>
&gt;&gt;    *,strftime(&#39;%%s&#39;,DATETIME(&#39;NOW&#39;))-answered_epoch as duration from<br>
&gt;&gt;    channels order by created_epoch&quot;);<br>
&gt;&gt;                   if (argv[1] &amp;&amp; !strcasecmp(argv[1],&quot;count&quot;)) {<br>
&gt;&gt;                       holder.justcount = 1;<br>
&gt;&gt;                       if (argv[3] &amp;&amp; !strcasecmp(argv[2], &quot;as&quot;)) {<br>
&gt;&gt;    @@ -2850,7 +2850,7 @@<br>
&gt;&gt;                       }<br>
&gt;&gt;                   }<br>
&gt;&gt;           } else if (!strcasecmp(command, &quot;distinct_channels&quot;)) {<br>
&gt;&gt;    -               sprintf(sql, &quot;select * from channels left join<br>
&gt;&gt; calls<br>
&gt;&gt;    on &quot;<br>
&gt;&gt;    +               sprintf(sql, &quot;select<br>
&gt;&gt;    *,strftime(&#39;%%s&#39;,DATETIME(&#39;NOW&#39;))-answered_epoch as duration from<br>
&gt;&gt;    channels left join calls on &quot;<br>
&gt;&gt;                                   &quot;channels.uuid=calls.caller_uuid<br>
&gt;&gt;    where channels.uuid not in (select callee_uuid from calls) order<br>
&gt;&gt; by<br>
&gt;&gt;    created_epoch&quot;);<br>
&gt;&gt;                   if (argv[2] &amp;&amp; !strcasecmp(argv[1], &quot;as&quot;)) {<br>
&gt;&gt;                           as = argv[2];<br>
&gt;&gt;    Index: src/switch_core_sqldb.c<br>
&gt;&gt;<br>
&gt;&gt; ===================================================================<br>
&gt;&gt;    --- src/switch_core_sqldb.c     (revision 14256)<br>
&gt;&gt;    +++ src/switch_core_sqldb.c     (working copy)<br>
&gt;&gt;    @@ -309,9 +309,21 @@<br>
&gt;&gt;                                                            );<br>
&gt;&gt;<br>
&gt;&gt;                   break;<br>
&gt;&gt;    +       case SWITCH_EVENT_CHANNEL_ANSWER:<br>
&gt;&gt;    +               {<br>
&gt;&gt;    +<br>
&gt;&gt;    +                       sql = switch_mprintf(&quot;update channels set<br>
&gt;&gt;    answered=&#39;%s&#39;,answered_epoch=&#39;%ld&#39; where uuid=&#39;%s&#39;&quot;,<br>
&gt;&gt;    +<br>
&gt;&gt;    switch_event_get_header_nil(event, &quot;event-date-local&quot;),<br>
&gt;&gt;    +<br>
&gt;&gt;     (long)switch_epoch_time_now(NULL),<br>
&gt;&gt;    +<br>
&gt;&gt;     switch_event_get_header_nil(event, &quot;unique-id&quot;)<br>
&gt;&gt;    +                                                         );<br>
&gt;&gt;    +<br>
&gt;&gt;    +               }<br>
&gt;&gt;    +               break;<br>
&gt;&gt;           case SWITCH_EVENT_CHANNEL_STATE:<br>
&gt;&gt;                   {<br>
&gt;&gt;                           char *state =<br>
&gt;&gt;    switch_event_get_header_nil(event, &quot;channel-state-number&quot;);<br>
&gt;&gt;    +<br>
&gt;&gt;                           switch_channel_state_t state_i =<br>
&gt;&gt; CS_DESTROY;<br>
&gt;&gt;<br>
&gt;&gt;                           if (!switch_strlen_zero(state)) {<br>
&gt;&gt;    @@ -492,7 +504,9 @@<br>
&gt;&gt;                           &quot;   read_rate  VARCHAR(255),\n&quot;<br>
&gt;&gt;                           &quot;   write_codec  VARCHAR(255),\n&quot;<br>
&gt;&gt;                           &quot;   write_rate  VARCHAR(255),\n&quot;<br>
&gt;&gt;    -                       &quot;   secure VARCHAR(255)\n&quot;<br>
&gt;&gt;    +                       &quot;   secure VARCHAR(255),\n&quot;<br>
&gt;&gt;    +                       &quot;   answered  VARCHAR(255),\n&quot;<br>
&gt;&gt;    +                        &quot;   answered_epoch  INTEGER\n&quot;<br>
&gt;&gt;                           &quot;);\ncreate index uuindex on channels<br>
&gt;&gt; (uuid);\n&quot;;<br>
&gt;&gt;                   char create_calls_sql[] =<br>
&gt;&gt;                           &quot;CREATE TABLE calls (\n&quot;<br>
&gt;&gt;<br>
&gt;&gt;    _______________________________________________<br>
&gt;&gt;    FreeSWITCH-users mailing list<br>
&gt;&gt;    <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt;&gt;    &lt;mailto:<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a>&gt;<br>
&gt;&gt;    <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt;&gt;    UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt;&gt;    <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Anthony Minessale II<br>
&gt;&gt;<br>
&gt;&gt; FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>
&gt;&gt; ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>
&gt;&gt; Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br>
&gt;&gt;<br>
&gt;&gt; AIM: anthm<br>
&gt;&gt; <a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>
&gt;&gt; &lt;mailto:<a href="mailto:MSN%253Aanthony_minessale@hotmail.com">MSN%3Aanthony_minessale@hotmail.com</a>&gt;<br>
&gt;&gt; GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
&gt;&gt; &lt;mailto:<a href="mailto:PAYPAL%253Aanthony.minessale@gmail.com">PAYPAL%3Aanthony.minessale@gmail.com</a>&gt;<br>
&gt;&gt; IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> &lt;<a href="http://irc.freenode.net" target="_blank">http://irc.freenode.net</a>&gt; #freeswitch<br>
&gt;&gt;<br>
&gt;&gt; FreeSWITCH Developer Conference<br>
&gt;&gt; <a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br>
&gt;&gt; &lt;mailto:<a href="mailto:sip%253A888@conference.freeswitch.org">sip%3A888@conference.freeswitch.org</a>&gt;<br>
&gt;&gt; <a href="http://iax:guest@conference.freeswitch.org/888" target="_blank">iax:guest@conference.freeswitch.org/888</a><br>
&gt;&gt; &lt;<a href="http://iax:guest@conference.freeswitch.org/888" target="_blank">http://iax:guest@conference.freeswitch.org/888</a>&gt;<br>
&gt;&gt; <a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
&gt;&gt; &lt;mailto:<a href="mailto:googletalk%253Aconf%252B888@conference.freeswitch.org">googletalk%3Aconf%2B888@conference.freeswitch.org</a>&gt;<br>
&gt;&gt; pstn:213-799-1400<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; ---<br>
&gt;&gt; ---------------------------------------------------------------------<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; FreeSWITCH-users mailing list<br>
&gt;&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt;&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt;&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt;&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; -------------------------------------------<br>
&gt; Apostolos Pantsiopoulos<br>
&gt; Kinetix Tele.com R &amp; D<br>
&gt; email: <a href="mailto:regs@kinetix.gr">regs@kinetix.gr</a><br>
&gt; -------------------------------------------<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; FreeSWITCH-users mailing list<br>
&gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
&gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
&gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
&gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br>
_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="http://iax:guest@conference.freeswitch.org/888">iax:guest@conference.freeswitch.org/888</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>pstn:213-799-1400<br>