res_pjsip_history: Add a module that provides PJSIP history for debugging

This patch adds a new module, res_pjsip_history, that provides a slightly
better way of debugging SIP message traffic on a busy Asterisk system. The
existing mechanisms all rely on passively dumping a SIP message to the CLI.
While this is perfectly fine for logging purposes and well controlled
environments, on many installations, the amount of SIP messages Asterisk
receives will quickly swamp the CLI. This makes it difficult to view/capture
those messages that you want to diagnose in real time.

This patch provides another way of handling this. When enabled, the module
will store SIP message traffic in memory. This traffic can then be queried
at leisure.

In order to make the querying useful, a CLI command has been implemented,
'pjsip show history', that supports a basic expression syntax similar to
SQL or other query languages. A small number of useful fields have been
added in this initial patch; additional fields can easily be added in
later improvements. Those fields are:
 - number: The entry index in the history
 - timestamp: The time the message was recieved
 - addr: The source/destination address of the message
 - sip.msg.request.method: The request method
 - sip.msg.call-id: The Call-ID header

Note - this is a resurrection of the module initially proposed on Review Board
here: https://reviewboard.asterisk.org/r/4053/

Change-Id: I39bd74ce998e99ad5ebc0aab3e84df3a150f8e36
This commit is contained in:
Matt Jordan
2015-12-13 13:09:42 -06:00
parent 410c5ee0fc
commit 9cdf3ec19d
2 changed files with 1377 additions and 0 deletions

25
CHANGES
View File

@@ -201,6 +201,31 @@ Queue
* Added field ReasonPause on QueueMemberStatus if set when paused, the reason
the queue member was paused.
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 13.7.0 to Asterisk 13.8.0 ------------
------------------------------------------------------------------------------
res_pjsip_history
------------------
* A new module, res_pjsip_history, has been added that provides SIP history
viewing/filtering from the CLI. The module is intended to be used on systems
with busy SIP traffic, where existing forms of viewing SIP messages - such
as the res_pjsip_logger - may be inadequate. The module provides two new
CLI commands:
- 'pjsip set history {on|off|clear}' - this enables/disables SIP history
capturing, as well as clears an existing history capture. Note that SIP
packets captured are stored in memory until cleared. As a result, the
history capture should only be used for debugging/viewing purposes, and
should *NOT* be left permanently enabled on a system.
- 'pjsip show history' - displays the captured SIP history. When invoked
with no options, the entire captured history is displayed. Two options
are available:
-- 'entry <num>' - display a detailed view of a single SIP message in
the history
-- 'where ...' - filter the history based on some expression. For more
information on filtering, view the current CLI help for the
'pjsip show history' command.
------------------------------------------------------------------------------
--- Functionality changes from Asterisk 13.6.0 to Asterisk 13.7.0 ------------
------------------------------------------------------------------------------

1352
res/res_pjsip_history.c Normal file

File diff suppressed because it is too large Load Diff