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