chan_pjsip: Add 'pjsip show channelstats'

Added the ability to show channel statistics to chan_pjsip (cli_functions.c)

Moved the existing 'pjsip show channel(s)' functionality from
pjsip_configuration to cli_functions.c.  The stats needed chan_pjsip's
private header so it made sense to move the existing channel commands as well.

Now using stasis_cache_dump to get the channel snapshots rather than retrieving
all endpoints, then getting each one's channel snapshots.  Much more efficient.

Change-Id: I03b114522126d27434030b285bf6d531ddd79869
This commit is contained in:
George Joseph
2016-03-26 21:33:14 -06:00
committed by Joshua Colp
parent e595f02f83
commit c7eb18d865
6 changed files with 533 additions and 262 deletions

View File

@@ -69,6 +69,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "pjsip/include/chan_pjsip.h"
#include "pjsip/include/dialplan_functions.h"
#include "pjsip/include/cli_functions.h"
AST_THREADSTORAGE(uniqueid_threadbuf);
#define UNIQUEID_BUFSIZE 256
@@ -2419,6 +2420,15 @@ static int load_module(void)
goto end;
}
if (pjsip_channel_cli_register()) {
ast_log(LOG_ERROR, "Unable to register PJSIP Channel CLI\n");
ast_sip_session_unregister_supplement(&chan_pjsip_ack_supplement);
ast_sip_session_unregister_supplement(&pbx_start_supplement);
ast_sip_session_unregister_supplement(&chan_pjsip_supplement);
ast_sip_session_unregister_supplement(&call_pickup_supplement);
goto end;
}
/* since endpoints are loaded before the channel driver their device
states get set to 'invalid', so they need to be updated */
if ((endpoints = ast_sip_get_endpoints())) {
@@ -2445,6 +2455,8 @@ static int unload_module(void)
ao2_cleanup(pjsip_uids_onhold);
pjsip_uids_onhold = NULL;
pjsip_channel_cli_unregister();
ast_sip_session_unregister_supplement(&chan_pjsip_supplement);
ast_sip_session_unregister_supplement(&pbx_start_supplement);
ast_sip_session_unregister_supplement(&chan_pjsip_ack_supplement);