summaryrefslogtreecommitdiff
path: root/res/res_pjsip
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2014-01-31 23:15:47 +0000
committerKevin Harwell <kharwell@digium.com>2014-01-31 23:15:47 +0000
commit10e38fb10cb07b0eb60375cc2a8cd46da86b7c5b (patch)
tree38e54ecc0d4dd32e5d2fcdd6b28be23a4b6ddf5d /res/res_pjsip
parentf5bb5b3e8c48d130b06f43eba380f15568706775 (diff)
res_pjsip: Config option to enable PJSIP logger at load time.
Added a "debug" configuration option for res_pjsip that when set to "yes" enables SIP messages to be logged. It is specified under the "system" type. Also added an alembic script to add the option to realtime. (closes issue ASTERISK-23038) Reported by: Rusty Newton Review: https://reviewboard.asterisk.org/r/3148/ ........ Merged revisions 407036 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@407037 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip')
-rw-r--r--res/res_pjsip/config_global.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/res/res_pjsip/config_global.c b/res/res_pjsip/config_global.c
index 1ae3e1577..0f4350d80 100644
--- a/res/res_pjsip/config_global.c
+++ b/res/res_pjsip/config_global.c
@@ -37,6 +37,8 @@ struct global_config {
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(useragent);
AST_STRING_FIELD(default_outbound_endpoint);
+ /*! Debug logging yes|no|host */
+ AST_STRING_FIELD(debug);
);
/* Value to put in Max-Forwards header */
unsigned int max_forwards;
@@ -53,7 +55,7 @@ static void *global_alloc(const char *name)
{
struct global_config *cfg = ast_sorcery_generic_alloc(sizeof(*cfg), global_destructor);
- if (!cfg || ast_string_field_init(cfg, 64)) {
+ if (!cfg || ast_string_field_init(cfg, 80)) {
return NULL;
}
@@ -97,6 +99,21 @@ char *ast_sip_global_default_outbound_endpoint(void)
return ast_strdup(cfg->default_outbound_endpoint);
}
+char *ast_sip_get_debug(void)
+{
+ char *res;
+ struct global_config *cfg = get_global_cfg();
+
+ if (!cfg) {
+ return 0;
+ }
+
+ res = ast_strdup(cfg->debug);
+ ao2_ref(cfg, -1);
+
+ return res;
+}
+
int ast_sip_initialize_sorcery_global(struct ast_sorcery *sorcery)
{
snprintf(default_useragent, sizeof(default_useragent), "%s %s", DEFAULT_USERAGENT_PREFIX, ast_get_version());
@@ -114,6 +131,8 @@ int ast_sip_initialize_sorcery_global(struct ast_sorcery *sorcery)
OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, useragent));
ast_sorcery_object_field_register(sorcery, "global", "default_outbound_endpoint", DEFAULT_OUTBOUND_ENDPOINT,
OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, default_outbound_endpoint));
+ ast_sorcery_object_field_register(sorcery, "global", "debug", "no",
+ OPT_STRINGFIELD_T, 0, STRFLDSET(struct global_config, debug));
return 0;
}