Skip to content

Commit

Permalink
chan_pjsip: Add 'pjsip show channelstats'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gtjoseph authored and jcolp committed Mar 29, 2016
1 parent e595f02 commit c7eb18d
Show file tree
Hide file tree
Showing 6 changed files with 533 additions and 262 deletions.
8 changes: 8 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@
===
==============================================================================

------------------------------------------------------------------------------
--- Functionality changes from Asterisk 13.8.0 to Asterisk 13.9.0 ------------
------------------------------------------------------------------------------

chan_pjsip
------------------
* Added 'pjsip show channelstats' CLI command.

------------------------------------------------------------------------------
--- Functionality changes from Asterisk 13.7.0 to Asterisk 13.8.0 ------------
------------------------------------------------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions channels/chan_pjsip.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())) {
Expand All @@ -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);
Expand Down

0 comments on commit c7eb18d

Please sign in to comment.