"show channels" command with duration - patch included
Hi, I usually find it very useful when I can retrieve a list of the currents calls along with durations. I noticed that the 'show channels' format does not include the duration (or the answered timestamp - so that one can extract it from there). So, I made a patch that includes the answered timestamp, the answered timestamp in epoch, and the duration in seconds. Of course these fields remain empty when the call hasn't been answered yet. I don't know if anyone else finds this functionality useful, so I am posting this patch here first (instead of JIRA) in order to get feedback from the users. If many of you (or the maintainers) find it interesting I can then proceed in posting it to JIRA. -- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr ------------------------------------------- Index: src/mod/applications/mod_commands/mod_commands.c =================================================================== --- src/mod/applications/mod_commands/mod_commands.c (revision 14256) +++ src/mod/applications/mod_commands/mod_commands.c (working copy) @@ -2827,10 +2827,10 @@ } } if (strchr(argv[2], '%')) { - sprintf(sql, "select * from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", argv[2], argv[2], argv[2], argv[2]); } else { - sprintf(sql, "select * from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", argv[2], argv[2], argv[2], argv[2]); } @@ -2839,10 +2839,10 @@ as = argv[4]; } } else { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); } } else if (!strcasecmp(command, "channels")) { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); if (argv[1] && !strcasecmp(argv[1],"count")) { holder.justcount = 1; if (argv[3] && !strcasecmp(argv[2], "as")) { @@ -2850,7 +2850,7 @@ } } } else if (!strcasecmp(command, "distinct_channels")) { - sprintf(sql, "select * from channels left join calls on " + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels left join calls on " "channels.uuid=calls.caller_uuid where channels.uuid not in (select callee_uuid from calls) order by created_epoch"); if (argv[2] && !strcasecmp(argv[1], "as")) { as = argv[2]; Index: src/switch_core_sqldb.c =================================================================== --- src/switch_core_sqldb.c (revision 14256) +++ src/switch_core_sqldb.c (working copy) @@ -309,9 +309,21 @@ ); break; + case SWITCH_EVENT_CHANNEL_ANSWER: + { + + sql = switch_mprintf("update channels set answered='%s',answered_epoch='%ld' where uuid='%s'", + switch_event_get_header_nil(event, "event-date-local"), + (long)switch_epoch_time_now(NULL), + switch_event_get_header_nil(event, "unique-id") + ); + + } + break; case SWITCH_EVENT_CHANNEL_STATE: { char *state = switch_event_get_header_nil(event, "channel-state-number"); + switch_channel_state_t state_i = CS_DESTROY; if (!switch_strlen_zero(state)) { @@ -492,7 +504,9 @@ " read_rate VARCHAR(255),\n" " write_codec VARCHAR(255),\n" " write_rate VARCHAR(255),\n" - " secure VARCHAR(255)\n" + " secure VARCHAR(255),\n" + " answered VARCHAR(255),\n" + " answered_epoch INTEGER\n" ");\ncreate index uuindex on channels (uuid);\n"; char create_calls_sql[] = "CREATE TABLE calls (\n"
I'm ok with the idea as long as it's thoroughly tested. If there is any more info you want to save from those events you should consider it now while we are modifying it. On Thu, Jul 16, 2009 at 9:02 AM, <freeswitch-users@lists.freeswitch.org>wrote:
Hi,
I usually find it very useful when I can retrieve a list of the currents calls along with durations. I noticed that the 'show channels' format does not include the duration (or the answered timestamp - so that one can extract it from there). So, I made a patch that includes the answered timestamp, the answered timestamp in epoch, and the duration in seconds. Of course these fields remain empty when the call hasn't been answered yet.
I don't know if anyone else finds this functionality useful, so I am posting this patch here first (instead of JIRA) in order to get feedback from the users. If many of you (or the maintainers) find it interesting I can then proceed in posting it to JIRA.
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr -------------------------------------------
Index: src/mod/applications/mod_commands/mod_commands.c =================================================================== --- src/mod/applications/mod_commands/mod_commands.c (revision 14256) +++ src/mod/applications/mod_commands/mod_commands.c (working copy) @@ -2827,10 +2827,10 @@ } } if (strchr(argv[2], '%')) { - sprintf(sql, "select * from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", argv[2], argv[2], argv[2], argv[2]); } else { - sprintf(sql, "select * from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", argv[2], argv[2], argv[2], argv[2]);
} @@ -2839,10 +2839,10 @@ as = argv[4]; } } else { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); } } else if (!strcasecmp(command, "channels")) { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); if (argv[1] && !strcasecmp(argv[1],"count")) { holder.justcount = 1; if (argv[3] && !strcasecmp(argv[2], "as")) { @@ -2850,7 +2850,7 @@ } } } else if (!strcasecmp(command, "distinct_channels")) { - sprintf(sql, "select * from channels left join calls on " + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels left join calls on " "channels.uuid=calls.caller_uuid where channels.uuid not in (select callee_uuid from calls) order by created_epoch"); if (argv[2] && !strcasecmp(argv[1], "as")) { as = argv[2]; Index: src/switch_core_sqldb.c =================================================================== --- src/switch_core_sqldb.c (revision 14256) +++ src/switch_core_sqldb.c (working copy) @@ -309,9 +309,21 @@ );
break; + case SWITCH_EVENT_CHANNEL_ANSWER: + { + + sql = switch_mprintf("update channels set answered='%s',answered_epoch='%ld' where uuid='%s'", + switch_event_get_header_nil(event, "event-date-local"), + (long)switch_epoch_time_now(NULL), + switch_event_get_header_nil(event, "unique-id") + ); + + } + break; case SWITCH_EVENT_CHANNEL_STATE: { char *state = switch_event_get_header_nil(event, "channel-state-number"); + switch_channel_state_t state_i = CS_DESTROY;
if (!switch_strlen_zero(state)) { @@ -492,7 +504,9 @@ " read_rate VARCHAR(255),\n" " write_codec VARCHAR(255),\n" " write_rate VARCHAR(255),\n" - " secure VARCHAR(255)\n" + " secure VARCHAR(255),\n" + " answered VARCHAR(255),\n" + " answered_epoch INTEGER\n" ");\ncreate index uuindex on channels (uuid);\n"; char create_calls_sql[] = "CREATE TABLE calls (\n"
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
Now that I come to think of it... It would be useful if we had the timestamp (and epoch) of the events PROGRESS and PROGRESS WITH MEDIA so that we can extract the PDD (Post Dial Delay) which is a very useful statistic. Adding the user's (for the incoming) and the gateway's (for the outbound) id would also be useful. In case these fields are empty the show channels command could ommit the (empty string). Are you planning to implement them yourselves or should I begin looking at the code? Anthony Minessale wrote:
I'm ok with the idea as long as it's thoroughly tested. If there is any more info you want to save from those events you should consider it now while we are modifying it.
On Thu, Jul 16, 2009 at 9:02 AM, <freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org>> wrote:
Hi,
I usually find it very useful when I can retrieve a list of the currents calls along with durations. I noticed that the 'show channels' format does not include the duration (or the answered timestamp - so that one can extract it from there). So, I made a patch that includes the answered timestamp, the answered timestamp in epoch, and the duration in seconds. Of course these fields remain empty when the call hasn't been answered yet.
I don't know if anyone else finds this functionality useful, so I am posting this patch here first (instead of JIRA) in order to get feedback from the users. If many of you (or the maintainers) find it interesting I can then proceed in posting it to JIRA.
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr <mailto:regs@kinetix.gr> -------------------------------------------
Index: src/mod/applications/mod_commands/mod_commands.c =================================================================== --- src/mod/applications/mod_commands/mod_commands.c (revision 14256) +++ src/mod/applications/mod_commands/mod_commands.c (working copy) @@ -2827,10 +2827,10 @@ } } if (strchr(argv[2], '%')) { - sprintf(sql, "select * from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", argv[2], argv[2], argv[2], argv[2]); } else { - sprintf(sql, "select * from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", argv[2], argv[2], argv[2], argv[2]);
} @@ -2839,10 +2839,10 @@ as = argv[4]; } } else { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); } } else if (!strcasecmp(command, "channels")) { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); if (argv[1] && !strcasecmp(argv[1],"count")) { holder.justcount = 1; if (argv[3] && !strcasecmp(argv[2], "as")) { @@ -2850,7 +2850,7 @@ } } } else if (!strcasecmp(command, "distinct_channels")) { - sprintf(sql, "select * from channels left join calls on " + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels left join calls on " "channels.uuid=calls.caller_uuid where channels.uuid not in (select callee_uuid from calls) order by created_epoch"); if (argv[2] && !strcasecmp(argv[1], "as")) { as = argv[2]; Index: src/switch_core_sqldb.c =================================================================== --- src/switch_core_sqldb.c (revision 14256) +++ src/switch_core_sqldb.c (working copy) @@ -309,9 +309,21 @@ );
break; + case SWITCH_EVENT_CHANNEL_ANSWER: + { + + sql = switch_mprintf("update channels set answered='%s',answered_epoch='%ld' where uuid='%s'", + switch_event_get_header_nil(event, "event-date-local"), + (long)switch_epoch_time_now(NULL), + switch_event_get_header_nil(event, "unique-id") + ); + + } + break; case SWITCH_EVENT_CHANNEL_STATE: { char *state = switch_event_get_header_nil(event, "channel-state-number"); + switch_channel_state_t state_i = CS_DESTROY;
if (!switch_strlen_zero(state)) { @@ -492,7 +504,9 @@ " read_rate VARCHAR(255),\n" " write_codec VARCHAR(255),\n" " write_rate VARCHAR(255),\n" - " secure VARCHAR(255)\n" + " secure VARCHAR(255),\n" + " answered VARCHAR(255),\n" + " answered_epoch INTEGER\n" ");\ncreate index uuindex on channels (uuid);\n"; char create_calls_sql[] = "CREATE TABLE calls (\n"
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
------------------------------------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr -------------------------------------------
I wasn't planning on implementing it but I was just mentioning that if you were going to do your patch, consider if there is any other info to store while the patient is on the operating table. The line we should not cross is to store all the info in the table since, really, you could be collecting those events in your application as well to store that info. But for the casual user, some more fields may be interesting. On Thu, Jul 16, 2009 at 9:37 AM, Apostolos Pantsiopoulos <regs@kinetix.gr>wrote:
Now that I come to think of it...
It would be useful if we had the timestamp (and epoch) of the events PROGRESS and PROGRESS WITH MEDIA so that we can extract the PDD (Post Dial Delay) which is a very useful statistic.
Adding the user's (for the incoming) and the gateway's (for the outbound) id would also be useful. In case these fields are empty the show channels command could ommit the (empty string).
Are you planning to implement them yourselves or should I begin looking at the code?
I'm ok with the idea as long as it's thoroughly tested. If there is any more info you want to save from those events you should consider it now while we are modifying it.
On Thu, Jul 16, 2009 at 9:02 AM, <freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org>> wrote:
Hi,
I usually find it very useful when I can retrieve a list of the currents calls along with durations. I noticed that the 'show channels' format does not include the duration (or the answered timestamp - so that one can extract it from there). So, I made a patch that includes the answered timestamp, the answered timestamp in epoch, and the duration in seconds. Of course these fields remain empty when the call hasn't been answered yet.
I don't know if anyone else finds this functionality useful, so I am posting this patch here first (instead of JIRA) in order to get feedback from the users. If many of you (or the maintainers) find it interesting I can then proceed in posting it to JIRA.
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr <mailto:regs@kinetix.gr> -------------------------------------------
Index: src/mod/applications/mod_commands/mod_commands.c =================================================================== --- src/mod/applications/mod_commands/mod_commands.c (revision
Anthony Minessale wrote: 14256)
+++ src/mod/applications/mod_commands/mod_commands.c (working
copy)
@@ -2827,10 +2827,10 @@ } } if (strchr(argv[2], '%')) { - sprintf(sql, "select * from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", argv[2], argv[2], argv[2], argv[2]); } else { - sprintf(sql, "select * from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", argv[2], argv[2], argv[2], argv[2]);
} @@ -2839,10 +2839,10 @@ as = argv[4]; } } else { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); } } else if (!strcasecmp(command, "channels")) { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); if (argv[1] && !strcasecmp(argv[1],"count")) { holder.justcount = 1; if (argv[3] && !strcasecmp(argv[2], "as")) { @@ -2850,7 +2850,7 @@ } } } else if (!strcasecmp(command, "distinct_channels")) { - sprintf(sql, "select * from channels left join calls on " + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels left join calls on " "channels.uuid=calls.caller_uuid where channels.uuid not in (select callee_uuid from calls) order by created_epoch"); if (argv[2] && !strcasecmp(argv[1], "as")) { as = argv[2]; Index: src/switch_core_sqldb.c =================================================================== --- src/switch_core_sqldb.c (revision 14256) +++ src/switch_core_sqldb.c (working copy) @@ -309,9 +309,21 @@ );
break; + case SWITCH_EVENT_CHANNEL_ANSWER: + { + + sql = switch_mprintf("update channels set answered='%s',answered_epoch='%ld' where uuid='%s'", + switch_event_get_header_nil(event, "event-date-local"), + (long)switch_epoch_time_now(NULL), + switch_event_get_header_nil(event, "unique-id") + ); + + } + break; case SWITCH_EVENT_CHANNEL_STATE: { char *state = switch_event_get_header_nil(event, "channel-state-number"); + switch_channel_state_t state_i = CS_DESTROY;
if (!switch_strlen_zero(state)) { @@ -492,7 +504,9 @@ " read_rate VARCHAR(255),\n" " write_codec VARCHAR(255),\n" " write_rate VARCHAR(255),\n" - " secure VARCHAR(255)\n" + " secure VARCHAR(255),\n" + " answered VARCHAR(255),\n" + " answered_epoch INTEGER\n" ");\ncreate index uuindex on channels
(uuid);\n";
char create_calls_sql[] = "CREATE TABLE calls (\n"
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:
http://lists.freeswitch.org/mailman/options/freeswitch-users
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> <mailto:MSN%3Aanthony_minessale@hotmail.com<MSN%253Aanthony_minessale@hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> <mailto:PAYPAL%3Aanthony.minessale@gmail.com<PAYPAL%253Aanthony.minessale@gmail.com>
IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> <mailto:sip%3A888@conference.freeswitch.org<sip%253A888@conference.freeswitch.org>
iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org<googletalk%253Aconf%252B888@conference.freeswitch.org>
pstn:213-799-1400
------------------------------------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr -------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
I wonder if it would make sense to create a separate sub-command like "show channels stats" or something. That way we could put all sorts of nifty info there without breaking the existing command. Thoughts? -MC Sent from my iPhone On Jul 16, 2009, at 7:37 AM, Apostolos Pantsiopoulos <regs@kinetix.gr> wrote:
Now that I come to think of it...
It would be useful if we had the timestamp (and epoch) of the events PROGRESS and PROGRESS WITH MEDIA so that we can extract the PDD (Post Dial Delay) which is a very useful statistic.
Adding the user's (for the incoming) and the gateway's (for the outbound) id would also be useful. In case these fields are empty the show channels command could ommit the (empty string).
Are you planning to implement them yourselves or should I begin looking at the code?
Anthony Minessale wrote:
I'm ok with the idea as long as it's thoroughly tested. If there is any more info you want to save from those events you should consider it now while we are modifying it.
On Thu, Jul 16, 2009 at 9:02 AM, <freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org>> wrote:
Hi,
I usually find it very useful when I can retrieve a list of the currents calls along with durations. I noticed that the 'show channels' format does not include the duration (or the answered timestamp - so that one can extract it from there). So, I made a patch that includes the answered timestamp, the answered timestamp in epoch, and the duration in seconds. Of course these fields remain empty when the call hasn't been answered yet.
I don't know if anyone else finds this functionality useful, so I am posting this patch here first (instead of JIRA) in order to get feedback from the users. If many of you (or the maintainers) find it interesting I can then proceed in posting it to JIRA.
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr <mailto:regs@kinetix.gr> -------------------------------------------
Index: src/mod/applications/mod_commands/mod_commands.c
=================================================================== --- src/mod/applications/mod_commands/mod_commands.c (revision 14256) +++ src/mod/applications/mod_commands/mod_commands.c (working copy) @@ -2827,10 +2827,10 @@ } } if (strchr(argv[2], '%')) { - sprintf(sql, "select * from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", argv[2], argv[2], argv[2], argv[2]); } else { - sprintf(sql, "select * from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", argv[2], argv[2], argv[2], argv[2]);
} @@ -2839,10 +2839,10 @@ as = argv[4]; } } else { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); } } else if (!strcasecmp(command, "channels")) { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); if (argv[1] && !strcasecmp(argv[1],"count")) { holder.justcount = 1; if (argv[3] && !strcasecmp(argv[2], "as")) { @@ -2850,7 +2850,7 @@ } } } else if (!strcasecmp(command, "distinct_channels")) { - sprintf(sql, "select * from channels left join calls on " + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels left join calls on " "channels.uuid=calls.caller_uuid where channels.uuid not in (select callee_uuid from calls) order by created_epoch"); if (argv[2] && !strcasecmp(argv[1], "as")) { as = argv[2]; Index: src/switch_core_sqldb.c
=================================================================== --- src/switch_core_sqldb.c (revision 14256) +++ src/switch_core_sqldb.c (working copy) @@ -309,9 +309,21 @@ );
break; + case SWITCH_EVENT_CHANNEL_ANSWER: + { + + sql = switch_mprintf("update channels set answered='%s',answered_epoch='%ld' where uuid='%s'", + switch_event_get_header_nil(event, "event-date-local"), + (long)switch_epoch_time_now(NULL), + switch_event_get_header_nil(event, "unique-id") + ); + + } + break; case SWITCH_EVENT_CHANNEL_STATE: { char *state = switch_event_get_header_nil(event, "channel-state-number"); + switch_channel_state_t state_i = CS_DESTROY;
if (!switch_strlen_zero(state)) { @@ -492,7 +504,9 @@ " read_rate VARCHAR(255),\n" " write_codec VARCHAR(255),\n" " write_rate VARCHAR(255),\n" - " secure VARCHAR(255)\n" + " secure VARCHAR(255),\n" + " answered VARCHAR(255),\n" + " answered_epoch INTEGER\n" ");\ncreate index uuindex on channels (uuid);\n"; char create_calls_sql[] = "CREATE TABLE calls (\n"
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
--- ---------------------------------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr -------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
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. Thats why we have "show channels as xml" On Thu, Jul 16, 2009 at 9:50 AM, Michael S Collins <msc@freeswitch.org>wrote:
I wonder if it would make sense to create a separate sub-command like "show channels stats" or something. That way we could put all sorts of nifty info there without breaking the existing command.
Thoughts? -MC
Sent from my iPhone
On Jul 16, 2009, at 7:37 AM, Apostolos Pantsiopoulos <regs@kinetix.gr> wrote:
Now that I come to think of it...
It would be useful if we had the timestamp (and epoch) of the events PROGRESS and PROGRESS WITH MEDIA so that we can extract the PDD (Post Dial Delay) which is a very useful statistic.
Adding the user's (for the incoming) and the gateway's (for the outbound) id would also be useful. In case these fields are empty the show channels command could ommit the (empty string).
Are you planning to implement them yourselves or should I begin looking at the code?
Anthony Minessale wrote:
I'm ok with the idea as long as it's thoroughly tested. If there is any more info you want to save from those events you should consider it now while we are modifying it.
On Thu, Jul 16, 2009 at 9:02 AM, <freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org>> wrote:
Hi,
I usually find it very useful when I can retrieve a list of the currents calls along with durations. I noticed that the 'show channels' format does not include the duration (or the answered timestamp - so that one can extract it from there). So, I made a patch that includes the answered timestamp, the answered timestamp in epoch, and the duration in seconds. Of course these fields remain empty when the call hasn't been answered yet.
I don't know if anyone else finds this functionality useful, so I am posting this patch here first (instead of JIRA) in order to get feedback from the users. If many of you (or the maintainers) find it interesting I can then proceed in posting it to JIRA.
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr <mailto:regs@kinetix.gr> -------------------------------------------
Index: src/mod/applications/mod_commands/mod_commands.c
=================================================================== --- src/mod/applications/mod_commands/mod_commands.c (revision 14256) +++ src/mod/applications/mod_commands/mod_commands.c (working copy) @@ -2827,10 +2827,10 @@ } } if (strchr(argv[2], '%')) { - sprintf(sql, "select * from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", argv[2], argv[2], argv[2], argv[2]); } else { - sprintf(sql, "select * from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", argv[2], argv[2], argv[2], argv[2]);
} @@ -2839,10 +2839,10 @@ as = argv[4]; } } else { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); } } else if (!strcasecmp(command, "channels")) { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); if (argv[1] && !strcasecmp(argv[1],"count")) { holder.justcount = 1; if (argv[3] && !strcasecmp(argv[2], "as")) { @@ -2850,7 +2850,7 @@ } } } else if (!strcasecmp(command, "distinct_channels")) { - sprintf(sql, "select * from channels left join calls on " + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels left join calls on " "channels.uuid=calls.caller_uuid where channels.uuid not in (select callee_uuid from calls) order by created_epoch"); if (argv[2] && !strcasecmp(argv[1], "as")) { as = argv[2]; Index: src/switch_core_sqldb.c
=================================================================== --- src/switch_core_sqldb.c (revision 14256) +++ src/switch_core_sqldb.c (working copy) @@ -309,9 +309,21 @@ );
break; + case SWITCH_EVENT_CHANNEL_ANSWER: + { + + sql = switch_mprintf("update channels set answered='%s',answered_epoch='%ld' where uuid='%s'", + switch_event_get_header_nil(event, "event-date-local"), + (long)switch_epoch_time_now(NULL), + switch_event_get_header_nil(event, "unique-id") + ); + + } + break; case SWITCH_EVENT_CHANNEL_STATE: { char *state = switch_event_get_header_nil(event, "channel-state-number"); + switch_channel_state_t state_i = CS_DESTROY;
if (!switch_strlen_zero(state)) { @@ -492,7 +504,9 @@ " read_rate VARCHAR(255),\n" " write_codec VARCHAR(255),\n" " write_rate VARCHAR(255),\n" - " secure VARCHAR(255)\n" + " secure VARCHAR(255),\n" + " answered VARCHAR(255),\n" + " answered_epoch INTEGER\n" ");\ncreate index uuindex on channels (uuid);\n"; char create_calls_sql[] = "CREATE TABLE calls (\n"
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> <mailto:MSN%3Aanthony_minessale@hotmail.com<MSN%253Aanthony_minessale@hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> <mailto:PAYPAL%3Aanthony.minessale@gmail.com<PAYPAL%253Aanthony.minessale@gmail.com>
IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> <mailto:sip%3A888@conference.freeswitch.org<sip%253A888@conference.freeswitch.org>
iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org<googletalk%253Aconf%252B888@conference.freeswitch.org>
pstn:213-799-1400
--- ---------------------------------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr -------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
OK I 'll start implementing the progress timestamp field. The only reason I mentioned the user/gateway id field is that FS admins gain a lot by looking at a row of "show channels" result and be able to see who is the caller and who is the callee. Anthony Minessale wrote:
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. Thats why we have "show channels as xml"
On Thu, Jul 16, 2009 at 9:50 AM, Michael S Collins <msc@freeswitch.org <mailto:msc@freeswitch.org>> wrote:
I wonder if it would make sense to create a separate sub-command like "show channels stats" or something. That way we could put all sorts of nifty info there without breaking the existing command.
Thoughts? -MC
Sent from my iPhone
On Jul 16, 2009, at 7:37 AM, Apostolos Pantsiopoulos <regs@kinetix.gr <mailto:regs@kinetix.gr>> wrote:
> Now that I come to think of it... > > It would be useful if we had the timestamp (and epoch) > of the events PROGRESS and PROGRESS WITH MEDIA so that we can extract > the PDD (Post Dial Delay) which is a very useful statistic. > > Adding the user's (for the incoming) and the gateway's (for the > outbound) id would also be useful. In case these fields are empty the > show channels command could ommit the (empty string). > > Are you planning to implement them yourselves or should I begin > looking > at the code? > > > Anthony Minessale wrote: >> I'm ok with the idea as long as it's thoroughly tested. >> If there is any more info you want to save from those events you >> should >> consider it now while we are modifying it. >> >> >> On Thu, Jul 16, 2009 at 9:02 AM, <freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org> >> <mailto:freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org>>> wrote: >> >> Hi, >> >> I usually find it very useful when I can retrieve a list of the >> currents calls along with durations. I noticed that the 'show >> channels' format does not include the duration (or the answered >> timestamp - so that one can extract it from there). So, I made a >> patch that includes the answered timestamp, the answered timestamp >> in epoch, and the duration in seconds. Of course these fields >> remain >> empty when the call hasn't been >> answered yet. >> >> I don't know if anyone else finds this functionality useful, so >> I am >> posting this patch here first (instead of JIRA) in order to get >> feedback from the users. If many of you (or the maintainers) >> find it >> interesting I can then proceed in posting it to JIRA. >> >> -- >> ------------------------------------------- >> Apostolos Pantsiopoulos >> Kinetix Tele.com R & D >> email: regs@kinetix.gr <mailto:regs@kinetix.gr> <mailto:regs@kinetix.gr <mailto:regs@kinetix.gr>> >> ------------------------------------------- >> >> Index: src/mod/applications/mod_commands/mod_commands.c >> >> =================================================================== >> --- src/mod/applications/mod_commands/mod_commands.c >> (revision 14256) >> +++ src/mod/applications/mod_commands/mod_commands.c (working >> copy) >> @@ -2827,10 +2827,10 @@ >> } >> } >> if (strchr(argv[2], '%')) { >> - sprintf(sql, "select * from >> channels >> where uuid like '%s' or name like '%s' or cid_name like '%s' or >> cid_num like '%s' order by created_epoch", >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels where uuid like '%s' or name like '%s' or cid_name like >> '%s' or cid_num like '%s' order by created_epoch", >> argv[2], argv[2], >> argv[2], argv[2]); >> } else { >> - sprintf(sql, "select * from >> channels >> where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like >> '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels where uuid like '%%%s%%' or name like '%%%s%%' or >> cid_name >> like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", >> argv[2], argv[2], >> argv[2], argv[2]); >> >> } >> @@ -2839,10 +2839,10 @@ >> as = argv[4]; >> } >> } else { >> - sprintf(sql, "select * from channels order >> by created_epoch"); >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels order by created_epoch"); >> } >> } else if (!strcasecmp(command, "channels")) { >> - sprintf(sql, "select * from channels order by >> created_epoch"); >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels order by created_epoch"); >> if (argv[1] && !strcasecmp(argv[1],"count")) { >> holder.justcount = 1; >> if (argv[3] && !strcasecmp(argv[2], "as")) { >> @@ -2850,7 +2850,7 @@ >> } >> } >> } else if (!strcasecmp(command, "distinct_channels")) { >> - sprintf(sql, "select * from channels left join >> calls >> on " >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels left join calls on " >> "channels.uuid=calls.caller_uuid >> where channels.uuid not in (select callee_uuid from calls) order >> by >> created_epoch"); >> if (argv[2] && !strcasecmp(argv[1], "as")) { >> as = argv[2]; >> Index: src/switch_core_sqldb.c >> >> =================================================================== >> --- src/switch_core_sqldb.c (revision 14256) >> +++ src/switch_core_sqldb.c (working copy) >> @@ -309,9 +309,21 @@ >> ); >> >> break; >> + case SWITCH_EVENT_CHANNEL_ANSWER: >> + { >> + >> + sql = switch_mprintf("update channels set >> answered='%s',answered_epoch='%ld' where uuid='%s'", >> + >> switch_event_get_header_nil(event, "event-date-local"), >> + >> (long)switch_epoch_time_now(NULL), >> + >> switch_event_get_header_nil(event, "unique-id") >> + ); >> + >> + } >> + break; >> case SWITCH_EVENT_CHANNEL_STATE: >> { >> char *state = >> switch_event_get_header_nil(event, "channel-state-number"); >> + >> switch_channel_state_t state_i = >> CS_DESTROY; >> >> if (!switch_strlen_zero(state)) { >> @@ -492,7 +504,9 @@ >> " read_rate VARCHAR(255),\n" >> " write_codec VARCHAR(255),\n" >> " write_rate VARCHAR(255),\n" >> - " secure VARCHAR(255)\n" >> + " secure VARCHAR(255),\n" >> + " answered VARCHAR(255),\n" >> + " answered_epoch INTEGER\n" >> ");\ncreate index uuindex on channels >> (uuid);\n"; >> char create_calls_sql[] = >> "CREATE TABLE calls (\n" >> >> _______________________________________________ >> FreeSWITCH-users mailing list >> FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> >> <mailto:FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org>> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >> http://www.freeswitch.org >> >> >> >> >> -- >> Anthony Minessale II >> >> FreeSWITCH http://www.freeswitch.org/ >> ClueCon http://www.cluecon.com/ >> Twitter: http://twitter.com/FreeSWITCH_wire >> >> AIM: anthm >> MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> >> <mailto:MSN%3Aanthony_minessale@hotmail.com <mailto:MSN%253Aanthony_minessale@hotmail.com>> >> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> >> <mailto:PAYPAL%3Aanthony.minessale@gmail.com <mailto:PAYPAL%253Aanthony.minessale@gmail.com>> >> IRC: irc.freenode.net <http://irc.freenode.net> <http://irc.freenode.net> #freeswitch >> >> FreeSWITCH Developer Conference >> sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> >> <mailto:sip%3A888@conference.freeswitch.org <mailto:sip%253A888@conference.freeswitch.org>> >> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> >> <http://iax:guest@conference.freeswitch.org/888> >> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> >> <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org <mailto:googletalk%253Aconf%252B888@conference.freeswitch.org>> >> pstn:213-799-1400 >> >> >> --- >> --------------------------------------------------------------------- >> >> _______________________________________________ >> FreeSWITCH-users mailing list >> FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >> http://www.freeswitch.org > > > -- > ------------------------------------------- > Apostolos Pantsiopoulos > Kinetix Tele.com R & D > email: regs@kinetix.gr <mailto:regs@kinetix.gr> > ------------------------------------------- > > _______________________________________________ > FreeSWITCH-users mailing list > FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users > http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
------------------------------------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr -------------------------------------------
Hi, its very useful feature for monitoring, I am doing it with XML RPC and getting the result on webpage. There is one issue which is nothing to do with that patch but in general: if we are using absolute_codec_string variable and codes are like G729,G723 then this *comma* between codec ruin the array. I think there should be other separator. - Saeed -----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Apostolos Pantsiopoulos Sent: Thursday, July 16, 2009 5:11 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] "show channels" command with duration - patch included OK I 'll start implementing the progress timestamp field. The only reason I mentioned the user/gateway id field is that FS admins gain a lot by looking at a row of "show channels" result and be able to see who is the caller and who is the callee. Anthony Minessale wrote:
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. Thats why we have "show channels as xml"
On Thu, Jul 16, 2009 at 9:50 AM, Michael S Collins <msc@freeswitch.org <mailto:msc@freeswitch.org>> wrote:
I wonder if it would make sense to create a separate sub-command like "show channels stats" or something. That way we could put all sorts of nifty info there without breaking the existing command.
Thoughts? -MC
Sent from my iPhone
On Jul 16, 2009, at 7:37 AM, Apostolos Pantsiopoulos <regs@kinetix.gr <mailto:regs@kinetix.gr>> wrote:
> Now that I come to think of it... > > It would be useful if we had the timestamp (and epoch) > of the events PROGRESS and PROGRESS WITH MEDIA so that we can extract > the PDD (Post Dial Delay) which is a very useful statistic. > > Adding the user's (for the incoming) and the gateway's (for the > outbound) id would also be useful. In case these fields are empty the > show channels command could ommit the (empty string). > > Are you planning to implement them yourselves or should I begin > looking > at the code? > > > Anthony Minessale wrote: >> I'm ok with the idea as long as it's thoroughly tested. >> If there is any more info you want to save from those events you >> should >> consider it now while we are modifying it. >> >> >> On Thu, Jul 16, 2009 at 9:02 AM, <freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org> >> <mailto:freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org>>> wrote: >> >> Hi, >> >> I usually find it very useful when I can retrieve a list of the >> currents calls along with durations. I noticed that the 'show >> channels' format does not include the duration (or the answered >> timestamp - so that one can extract it from there). So, I made a >> patch that includes the answered timestamp, the answered timestamp >> in epoch, and the duration in seconds. Of course these fields >> remain >> empty when the call hasn't been >> answered yet. >> >> I don't know if anyone else finds this functionality useful, so >> I am >> posting this patch here first (instead of JIRA) in order to get >> feedback from the users. If many of you (or the maintainers) >> find it >> interesting I can then proceed in posting it to JIRA. >> >> -- >> ------------------------------------------- >> Apostolos Pantsiopoulos >> Kinetix Tele.com R & D >> email: regs@kinetix.gr <mailto:regs@kinetix.gr> <mailto:regs@kinetix.gr <mailto:regs@kinetix.gr>> >> ------------------------------------------- >> >> Index: src/mod/applications/mod_commands/mod_commands.c >> >> =================================================================== >> --- src/mod/applications/mod_commands/mod_commands.c >> (revision 14256) >> +++ src/mod/applications/mod_commands/mod_commands.c (working >> copy) >> @@ -2827,10 +2827,10 @@ >> } >> } >> if (strchr(argv[2], '%')) { >> - sprintf(sql, "select * from >> channels >> where uuid like '%s' or name like '%s' or cid_name like '%s' or >> cid_num like '%s' order by created_epoch", >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels where uuid like '%s' or name like '%s' or cid_name like >> '%s' or cid_num like '%s' order by created_epoch", >> argv[2], argv[2], >> argv[2], argv[2]); >> } else { >> - sprintf(sql, "select * from >> channels >> where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like >> '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels where uuid like '%%%s%%' or name like '%%%s%%' or >> cid_name >> like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", >> argv[2], argv[2], >> argv[2], argv[2]); >> >> } >> @@ -2839,10 +2839,10 @@ >> as = argv[4]; >> } >> } else { >> - sprintf(sql, "select * from channels order >> by created_epoch"); >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels order by created_epoch"); >> } >> } else if (!strcasecmp(command, "channels")) { >> - sprintf(sql, "select * from channels order by >> created_epoch"); >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels order by created_epoch"); >> if (argv[1] && !strcasecmp(argv[1],"count")) { >> holder.justcount = 1; >> if (argv[3] && !strcasecmp(argv[2], "as")) { >> @@ -2850,7 +2850,7 @@ >> } >> } >> } else if (!strcasecmp(command, "distinct_channels")) { >> - sprintf(sql, "select * from channels left join >> calls >> on " >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels left join calls on " >> "channels.uuid=calls.caller_uuid >> where channels.uuid not in (select callee_uuid from calls) order >> by >> created_epoch"); >> if (argv[2] && !strcasecmp(argv[1], "as")) { >> as = argv[2]; >> Index: src/switch_core_sqldb.c >> >> =================================================================== >> --- src/switch_core_sqldb.c (revision 14256) >> +++ src/switch_core_sqldb.c (working copy) >> @@ -309,9 +309,21 @@ >> ); >> >> break; >> + case SWITCH_EVENT_CHANNEL_ANSWER: >> + { >> + >> + sql = switch_mprintf("update channels set >> answered='%s',answered_epoch='%ld' where uuid='%s'", >> + >> switch_event_get_header_nil(event, "event-date-local"), >> + >> (long)switch_epoch_time_now(NULL), >> + >> switch_event_get_header_nil(event, "unique-id") >> + ); >> + >> + } >> + break; >> case SWITCH_EVENT_CHANNEL_STATE: >> { >> char *state = >> switch_event_get_header_nil(event, "channel-state-number"); >> + >> switch_channel_state_t state_i = >> CS_DESTROY; >> >> if (!switch_strlen_zero(state)) { >> @@ -492,7 +504,9 @@ >> " read_rate VARCHAR(255),\n" >> " write_codec VARCHAR(255),\n" >> " write_rate VARCHAR(255),\n" >> - " secure VARCHAR(255)\n" >> + " secure VARCHAR(255),\n" >> + " answered VARCHAR(255),\n" >> + " answered_epoch INTEGER\n" >> ");\ncreate index uuindex on channels >> (uuid);\n"; >> char create_calls_sql[] = >> "CREATE TABLE calls (\n" >> >> _______________________________________________ >> FreeSWITCH-users mailing list >> FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> >> <mailto:FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org>> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >>
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org >> >> >> >> >> -- >> Anthony Minessale II >> >> FreeSWITCH http://www.freeswitch.org/ >> ClueCon http://www.cluecon.com/ >> Twitter: http://twitter.com/FreeSWITCH_wire >> >> AIM: anthm >> MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> >> <mailto:MSN%3Aanthony_minessale@hotmail.com <mailto:MSN%253Aanthony_minessale@hotmail.com>> >> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> >> <mailto:PAYPAL%3Aanthony.minessale@gmail.com <mailto:PAYPAL%253Aanthony.minessale@gmail.com>> >> IRC: irc.freenode.net <http://irc.freenode.net> <http://irc.freenode.net> #freeswitch >> >> FreeSWITCH Developer Conference >> sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> >> <mailto:sip%3A888@conference.freeswitch.org <mailto:sip%253A888@conference.freeswitch.org>> >> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> >> <http://iax:guest@conference.freeswitch.org/888> >> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> >> <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org <mailto:googletalk%253Aconf%252B888@conference.freeswitch.org>> >> pstn:213-799-1400 >> >> >> --- >> --------------------------------------------------------------------- >> >> _______________________________________________ >> FreeSWITCH-users mailing list >> FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >>
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org > > > -- > ------------------------------------------- > Apostolos Pantsiopoulos > Kinetix Tele.com R & D > email: regs@kinetix.gr <mailto:regs@kinetix.gr> > ------------------------------------------- > > _______________________________________________ > FreeSWITCH-users mailing list > FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
------------------------------------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr ------------------------------------------- _______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
If you want to use , within a { } block you can escape it with \, Mathieu Rene Avant-Garde Solutions Inc Office: + 1 (514) 664-1044 x100 Cell: +1 (514) 664-1044 x200 mrene@avgs.ca Am 16-Jul-09 um 11:38 AM schrieb Saeed Ahmed:
Hi,
its very useful feature for monitoring, I am doing it with XML RPC and getting the result on webpage.
There is one issue which is nothing to do with that patch but in general: if we are using absolute_codec_string variable and codes are like G729,G723 then this *comma* between codec ruin the array. I think there should be other separator.
- Saeed
-----Original Message----- From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Apostolos Pantsiopoulos Sent: Thursday, July 16, 2009 5:11 PM To: freeswitch-users@lists.freeswitch.org Subject: Re: [Freeswitch-users] "show channels" command with duration - patch included
OK I 'll start implementing the progress timestamp field.
The only reason I mentioned the user/gateway id field is that FS admins gain a lot by looking at a row of "show channels" result and be able to see who is the caller and who is the callee.
Anthony Minessale wrote:
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. Thats why we have "show channels as xml"
On Thu, Jul 16, 2009 at 9:50 AM, Michael S Collins <msc@freeswitch.org <mailto:msc@freeswitch.org>> wrote:
I wonder if it would make sense to create a separate sub-command like "show channels stats" or something. That way we could put all sorts of nifty info there without breaking the existing command.
Thoughts? -MC
Sent from my iPhone
On Jul 16, 2009, at 7:37 AM, Apostolos Pantsiopoulos <regs@kinetix.gr <mailto:regs@kinetix.gr>> wrote:
Now that I come to think of it...
It would be useful if we had the timestamp (and epoch) of the events PROGRESS and PROGRESS WITH MEDIA so that we can extract the PDD (Post Dial Delay) which is a very useful statistic.
Adding the user's (for the incoming) and the gateway's (for the outbound) id would also be useful. In case these fields are empty the show channels command could ommit the (empty string).
Are you planning to implement them yourselves or should I begin looking at the code?
Anthony Minessale wrote:
I'm ok with the idea as long as it's thoroughly tested. If there is any more info you want to save from those events you should consider it now while we are modifying it.
On Thu, Jul 16, 2009 at 9:02 AM, <freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org> <mailto:freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org>>> wrote:
Hi,
I usually find it very useful when I can retrieve a list of the currents calls along with durations. I noticed that the 'show channels' format does not include the duration (or the answered timestamp - so that one can extract it from there). So, I made a patch that includes the answered timestamp, the answered timestamp in epoch, and the duration in seconds. Of course these fields remain empty when the call hasn't been answered yet.
I don't know if anyone else finds this functionality useful, so I am posting this patch here first (instead of JIRA) in order to get feedback from the users. If many of you (or the maintainers) find it interesting I can then proceed in posting it to JIRA.
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr <mailto:regs@kinetix.gr> <mailto:regs@kinetix.gr <mailto:regs@kinetix.gr>> -------------------------------------------
Index: src/mod/applications/mod_commands/mod_commands.c
===================================================================
--- src/mod/applications/mod_commands/mod_commands.c (revision 14256) +++ src/mod/applications/mod_commands/mod_commands.c (working copy) @@ -2827,10 +2827,10 @@ } } if (strchr(argv[2], '%')) { - sprintf(sql, "select * from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch", argv[2], argv[2], argv[2], argv[2]); } else { - sprintf(sql, "select * from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", argv[2], argv[2], argv[2], argv[2]);
} @@ -2839,10 +2839,10 @@ as = argv[4]; } } else { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); } } else if (!strcasecmp(command, "channels")) { - sprintf(sql, "select * from channels order by created_epoch"); + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels order by created_epoch"); if (argv[1] && !strcasecmp(argv[1],"count")) { holder.justcount = 1; if (argv[3] && !strcasecmp(argv[2], "as")) { @@ -2850,7 +2850,7 @@ } } } else if (!strcasecmp(command, "distinct_channels")) { - sprintf(sql, "select * from channels left join calls on " + sprintf(sql, "select *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from channels left join calls on " "channels.uuid=calls.caller_uuid where channels.uuid not in (select callee_uuid from calls) order by created_epoch"); if (argv[2] && !strcasecmp(argv[1], "as")) { as = argv[2]; Index: src/switch_core_sqldb.c
===================================================================
--- src/switch_core_sqldb.c (revision 14256) +++ src/switch_core_sqldb.c (working copy) @@ -309,9 +309,21 @@ );
break; + case SWITCH_EVENT_CHANNEL_ANSWER: + { + + sql = switch_mprintf("update channels set answered='%s',answered_epoch='%ld' where uuid='%s'", + switch_event_get_header_nil(event, "event-date-local"), + (long)switch_epoch_time_now(NULL), + switch_event_get_header_nil(event, "unique-id") + ); + + } + break; case SWITCH_EVENT_CHANNEL_STATE: { char *state = switch_event_get_header_nil(event, "channel-state-number"); + switch_channel_state_t state_i = CS_DESTROY;
if (!switch_strlen_zero(state)) { @@ -492,7 +504,9 @@ " read_rate VARCHAR(255),\n" " write_codec VARCHAR(255),\n" " write_rate VARCHAR(255),\n" - " secure VARCHAR(255)\n" + " secure VARCHAR(255),\n" + " answered VARCHAR(255),\n" + " answered_epoch INTEGER\n" ");\ncreate index uuindex on channels (uuid);\n"; char create_calls_sql[] = "CREATE TABLE calls (\n"
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> <mailto:FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> <mailto:MSN%3Aanthony_minessale@hotmail.com <mailto:MSN%253Aanthony_minessale@hotmail.com>> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> <mailto:PAYPAL%3Aanthony.minessale@gmail.com <mailto:PAYPAL%253Aanthony.minessale@gmail.com>> IRC: irc.freenode.net <http://irc.freenode.net> <http://irc.freenode.net> #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> <mailto:sip%3A888@conference.freeswitch.org <mailto:sip%253A888@conference.freeswitch.org>> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> <http://iax:guest@conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org <mailto:googletalk%253Aconf%252B888@conference.freeswitch.org>> pstn:213-799-1400
---
---------------------------------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org
<mailto:FreeSWITCH-users@lists.freeswitch.org>
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr <mailto:regs@kinetix.gr> -------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
------------------------------------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr -------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
On a second thought... I am starting to agree with Michael. Nobody really collects stats about PDD from the 'show channels' command. This is usually done by using the cdrs. So, forget about the second request. The patch I sent earlier covers my needs (and I hope everybody else's too.) Apostolos Pantsiopoulos wrote:
OK I 'll start implementing the progress timestamp field.
The only reason I mentioned the user/gateway id field is that FS admins gain a lot by looking at a row of "show channels" result and be able to see who is the caller and who is the callee.
Anthony Minessale wrote:
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. Thats why we have "show channels as xml"
On Thu, Jul 16, 2009 at 9:50 AM, Michael S Collins <msc@freeswitch.org <mailto:msc@freeswitch.org>> wrote:
I wonder if it would make sense to create a separate sub-command like "show channels stats" or something. That way we could put all sorts of nifty info there without breaking the existing command.
Thoughts? -MC
Sent from my iPhone
On Jul 16, 2009, at 7:37 AM, Apostolos Pantsiopoulos <regs@kinetix.gr <mailto:regs@kinetix.gr>> wrote:
> Now that I come to think of it... > > It would be useful if we had the timestamp (and epoch) > of the events PROGRESS and PROGRESS WITH MEDIA so that we can extract > the PDD (Post Dial Delay) which is a very useful statistic. > > Adding the user's (for the incoming) and the gateway's (for the > outbound) id would also be useful. In case these fields are empty the > show channels command could ommit the (empty string). > > Are you planning to implement them yourselves or should I begin > looking > at the code? > > > Anthony Minessale wrote: >> I'm ok with the idea as long as it's thoroughly tested. >> If there is any more info you want to save from those events you >> should >> consider it now while we are modifying it. >> >> >> On Thu, Jul 16, 2009 at 9:02 AM, <freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org> >> <mailto:freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org>>> wrote: >> >> Hi, >> >> I usually find it very useful when I can retrieve a list of the >> currents calls along with durations. I noticed that the 'show >> channels' format does not include the duration (or the answered >> timestamp - so that one can extract it from there). So, I made a >> patch that includes the answered timestamp, the answered timestamp >> in epoch, and the duration in seconds. Of course these fields >> remain >> empty when the call hasn't been >> answered yet. >> >> I don't know if anyone else finds this functionality useful, so >> I am >> posting this patch here first (instead of JIRA) in order to get >> feedback from the users. If many of you (or the maintainers) >> find it >> interesting I can then proceed in posting it to JIRA. >> >> -- >> ------------------------------------------- >> Apostolos Pantsiopoulos >> Kinetix Tele.com R & D >> email: regs@kinetix.gr <mailto:regs@kinetix.gr> <mailto:regs@kinetix.gr <mailto:regs@kinetix.gr>> >> ------------------------------------------- >> >> Index: src/mod/applications/mod_commands/mod_commands.c >> >> =================================================================== >> --- src/mod/applications/mod_commands/mod_commands.c >> (revision 14256) >> +++ src/mod/applications/mod_commands/mod_commands.c (working >> copy) >> @@ -2827,10 +2827,10 @@ >> } >> } >> if (strchr(argv[2], '%')) { >> - sprintf(sql, "select * from >> channels >> where uuid like '%s' or name like '%s' or cid_name like '%s' or >> cid_num like '%s' order by created_epoch", >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels where uuid like '%s' or name like '%s' or cid_name like >> '%s' or cid_num like '%s' order by created_epoch", >> argv[2], argv[2], >> argv[2], argv[2]); >> } else { >> - sprintf(sql, "select * from >> channels >> where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like >> '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels where uuid like '%%%s%%' or name like '%%%s%%' or >> cid_name >> like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch", >> argv[2], argv[2], >> argv[2], argv[2]); >> >> } >> @@ -2839,10 +2839,10 @@ >> as = argv[4]; >> } >> } else { >> - sprintf(sql, "select * from channels order >> by created_epoch"); >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels order by created_epoch"); >> } >> } else if (!strcasecmp(command, "channels")) { >> - sprintf(sql, "select * from channels order by >> created_epoch"); >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels order by created_epoch"); >> if (argv[1] && !strcasecmp(argv[1],"count")) { >> holder.justcount = 1; >> if (argv[3] && !strcasecmp(argv[2], "as")) { >> @@ -2850,7 +2850,7 @@ >> } >> } >> } else if (!strcasecmp(command, "distinct_channels")) { >> - sprintf(sql, "select * from channels left join >> calls >> on " >> + sprintf(sql, "select >> *,strftime('%%s',DATETIME('NOW'))-answered_epoch as duration from >> channels left join calls on " >> "channels.uuid=calls.caller_uuid >> where channels.uuid not in (select callee_uuid from calls) order >> by >> created_epoch"); >> if (argv[2] && !strcasecmp(argv[1], "as")) { >> as = argv[2]; >> Index: src/switch_core_sqldb.c >> >> =================================================================== >> --- src/switch_core_sqldb.c (revision 14256) >> +++ src/switch_core_sqldb.c (working copy) >> @@ -309,9 +309,21 @@ >> ); >> >> break; >> + case SWITCH_EVENT_CHANNEL_ANSWER: >> + { >> + >> + sql = switch_mprintf("update channels set >> answered='%s',answered_epoch='%ld' where uuid='%s'", >> + >> switch_event_get_header_nil(event, "event-date-local"), >> + >> (long)switch_epoch_time_now(NULL), >> + >> switch_event_get_header_nil(event, "unique-id") >> + ); >> + >> + } >> + break; >> case SWITCH_EVENT_CHANNEL_STATE: >> { >> char *state = >> switch_event_get_header_nil(event, "channel-state-number"); >> + >> switch_channel_state_t state_i = >> CS_DESTROY; >> >> if (!switch_strlen_zero(state)) { >> @@ -492,7 +504,9 @@ >> " read_rate VARCHAR(255),\n" >> " write_codec VARCHAR(255),\n" >> " write_rate VARCHAR(255),\n" >> - " secure VARCHAR(255)\n" >> + " secure VARCHAR(255),\n" >> + " answered VARCHAR(255),\n" >> + " answered_epoch INTEGER\n" >> ");\ncreate index uuindex on channels >> (uuid);\n"; >> char create_calls_sql[] = >> "CREATE TABLE calls (\n" >> >> _______________________________________________ >> FreeSWITCH-users mailing list >> FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> >> <mailto:FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org>> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >> http://www.freeswitch.org >> >> >> >> >> -- >> Anthony Minessale II >> >> FreeSWITCH http://www.freeswitch.org/ >> ClueCon http://www.cluecon.com/ >> Twitter: http://twitter.com/FreeSWITCH_wire >> >> AIM: anthm >> MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> >> <mailto:MSN%3Aanthony_minessale@hotmail.com <mailto:MSN%253Aanthony_minessale@hotmail.com>> >> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> >> <mailto:PAYPAL%3Aanthony.minessale@gmail.com <mailto:PAYPAL%253Aanthony.minessale@gmail.com>> >> IRC: irc.freenode.net <http://irc.freenode.net> <http://irc.freenode.net> #freeswitch >> >> FreeSWITCH Developer Conference >> sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> >> <mailto:sip%3A888@conference.freeswitch.org <mailto:sip%253A888@conference.freeswitch.org>> >> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> >> <http://iax:guest@conference.freeswitch.org/888> >> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> >> <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org <mailto:googletalk%253Aconf%252B888@conference.freeswitch.org>> >> pstn:213-799-1400 >> >> >> --- >> --------------------------------------------------------------------- >> >> _______________________________________________ >> FreeSWITCH-users mailing list >> FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> >> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users >> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users >> http://www.freeswitch.org > > > -- > ------------------------------------------- > Apostolos Pantsiopoulos > Kinetix Tele.com R & D > email: regs@kinetix.gr <mailto:regs@kinetix.gr> > ------------------------------------------- > > _______________________________________________ > FreeSWITCH-users mailing list > FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> > http://lists.freeswitch.org/mailman/listinfo/freeswitch-users > UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users > http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire
AIM: anthm MSN:anthony_minessale@hotmail.com <mailto:MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com <mailto:PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net <http://irc.freenode.net> #freeswitch
FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> iax:guest@conference.freeswitch.org/888 <http://iax:guest@conference.freeswitch.org/888> googletalk:conf+888@conference.freeswitch.org <mailto:googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:213-799-1400
------------------------------------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- ------------------------------------------- Apostolos Pantsiopoulos Kinetix Tele.com R & D email: regs@kinetix.gr -------------------------------------------
Well, that's very useful for us in order to have this info in our FS Operator panel. Best regards Peter freeswitch-users@lists.freeswitch.org schrieb:
Hi,
I usually find it very useful when I can retrieve a list of the currents calls along with durations. I noticed that the 'show channels' format does not include the duration (or the answered timestamp - so that one can extract it from there). So, I made a patch that includes the answered timestamp, the answered timestamp in epoch, and the duration in seconds. Of course these fields remain empty when the call hasn't been answered yet.
I don't know if anyone else finds this functionality useful, so I am posting this patch here first (instead of JIRA) in order to get feedback from the users. If many of you (or the maintainers) find it interesting I can then proceed in posting it to JIRA.
------------------------------------------------------------------------
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (7)
-
Anthony Minessale
-
Apostolos Pantsiopoulos
-
freeswitch-users@lists.freeswitch.org
-
Mathieu Rene
-
Michael S Collins
-
Peter P GMX
-
Saeed Ahmed