From c4064727d208d61dc29721c52f450f67eb22a445 Mon Sep 17 00:00:00 2001 From: George Joseph Date: Sat, 26 Mar 2016 21:33:14 -0600 Subject: 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 --- channels/chan_pjsip.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'channels/chan_pjsip.c') diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index cd55400c3..370075d2b 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -69,6 +69,7 @@ ASTERISK_REGISTER_FILE() #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 @@ -2468,6 +2469,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())) { @@ -2494,6 +2504,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); -- cgit v1.2.3