summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2017-01-25 05:50:43 -0700
committerGeorge Joseph <gjoseph@digium.com>2017-01-27 15:09:54 -0600
commit140e453afcf0535455993b40a0b3a48525b45577 (patch)
tree3dd601b369ea4395c3c2b05fdc4f08c2dec1948b /channels/chan_sip.c
parentcb113eb0c0d0dce7c9a2709e76e07a353efa7d1d (diff)
debug_utilities: Add ast_logescalator
The escalator works by creating a set of startup commands in cli.conf that set up logger channels and issue the debug commands for the subsystems specified. If asterisk is running when it is executed, the same commands will be issued to the running instance. The original cli.conf is saved before any changes are made and can be restored by executing '$prog --reset'. The log output will be stored in... $astlogdir/message.$uniqueid $astlogdir/debug.$uniqueid $astlogdir/dtmf.$uniqueid $astlogdir/fax.$uniqueid $astlogdir/security.$uniqueid $astlogdir/pjsip_history.$uniqueid $astlogdir/sip_history.$uniqueid Some minor tweaks were made to chan_sip, and res_pjsip_history so their history output could be send to a log channel as packets are captured. A minor tweak was also made to manager so events are output to verbose when "manager set debug on" is issued. Change-Id: I799f8e5013b86dc5282961b27383d134bf09e543
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 7e11b2420..709d5ab45 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -609,6 +609,8 @@ ASTERISK_REGISTER_FILE()
</managerEvent>
***/
+static int log_level = -1;
+
static int min_expiry = DEFAULT_MIN_EXPIRY; /*!< Minimum accepted registration time */
static int max_expiry = DEFAULT_MAX_EXPIRY; /*!< Maximum accepted registration time */
static int default_expiry = DEFAULT_DEFAULT_EXPIRY;
@@ -3939,6 +3941,9 @@ static __attribute__((format(printf, 2, 0))) void append_history_va(struct sip_p
}
AST_LIST_INSERT_TAIL(p->history, hist, list);
p->history_entries++;
+ if (log_level != -1) {
+ ast_log_dynamic_level(log_level, "%s\n", buf);
+ }
}
/*! \brief Append to SIP dialog history with arg list */
@@ -35190,6 +35195,10 @@ static int load_module(void)
struct sip_peer *bogus_peer;
ast_verbose("SIP channel loading...\n");
+ log_level = ast_logger_register_level("SIP_HISTORY");
+ if (log_level < 0) {
+ ast_log(LOG_WARNING, "Unable to register history log level\n");
+ }
if (STASIS_MESSAGE_TYPE_INIT(session_timeout_type)) {
unload_module();
@@ -35590,6 +35599,9 @@ static int unload_module(void)
sip_cfg.caps = NULL;
STASIS_MESSAGE_TYPE_CLEANUP(session_timeout_type);
+ if (log_level != -1) {
+ ast_logger_unregister_level("SIP_HISTORY");
+ }
return 0;
}