summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsua-lib/pjsua_core.c
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2008-07-17 14:54:03 +0000
committerNanang Izzuddin <nanang@teluu.com>2008-07-17 14:54:03 +0000
commit322986cdc4140ab97c1eb0a1a2500e28b66398b6 (patch)
treea24d744d6c8ac7021fb7f6c5a8651fd7bb06149d /pjsip/src/pjsua-lib/pjsua_core.c
parentb51b8659c27905c821d70db79d90daa2e7553b3d (diff)
Added ability to dump extended statistics (RTCP XR) in pjsua.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2152 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_core.c')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_core.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_core.c b/pjsip/src/pjsua-lib/pjsua_core.c
index d871b6fc..dbc917be 100644
--- a/pjsip/src/pjsua-lib/pjsua_core.c
+++ b/pjsip/src/pjsua-lib/pjsua_core.c
@@ -2067,7 +2067,6 @@ PJ_DEF(void) pjsua_dump(pj_bool_t detail)
{
unsigned old_decor;
unsigned i;
- char buf[1024];
PJ_LOG(3,(THIS_FILE, "Start dumping application states:"));
@@ -2102,7 +2101,9 @@ PJ_DEF(void) pjsua_dump(pj_bool_t detail)
pjsip_tsx_layer_dump(detail);
pjsip_ua_dump(detail);
-
+// Dumping complete call states may require a 'large' buffer
+// (about 3KB per call session, including RTCP XR).
+#if 0
/* Dump all invite sessions: */
PJ_LOG(3,(THIS_FILE, "Dumping invite sessions:"));
@@ -2115,11 +2116,43 @@ PJ_DEF(void) pjsua_dump(pj_bool_t detail)
for (i=0; i<pjsua_var.ua_cfg.max_calls; ++i) {
if (pjsua_call_is_active(i)) {
+ /* Tricky logging, since call states log string tends to be
+ * longer than PJ_LOG_MAX_SIZE.
+ */
+ char buf[1024 * 3];
+ unsigned call_dump_len;
+ unsigned part_len;
+ unsigned part_idx;
+ unsigned log_decor;
+
pjsua_call_dump(i, detail, buf, sizeof(buf), " ");
- PJ_LOG(3,(THIS_FILE, "%s", buf));
+ call_dump_len = strlen(buf);
+
+ log_decor = pj_log_get_decor();
+ pj_log_set_decor(log_decor & ~(PJ_LOG_HAS_NEWLINE |
+ PJ_LOG_HAS_CR));
+ PJ_LOG(3,(THIS_FILE, "\n"));
+ pj_log_set_decor(0);
+
+ part_idx = 0;
+ part_len = PJ_LOG_MAX_SIZE-80;
+ while (part_idx < call_dump_len) {
+ char p_orig, *p;
+
+ p = &buf[part_idx];
+ if (part_idx + part_len > call_dump_len)
+ part_len = call_dump_len - part_idx;
+ p_orig = p[part_len];
+ p[part_len] = '\0';
+ PJ_LOG(3,(THIS_FILE, "%s", p));
+ p[part_len] = p_orig;
+ part_idx += part_len;
+ }
+ pj_log_set_decor(log_decor);
}
}
}
+#endif
/* Dump presence status */
pjsua_pres_dump(detail);