Changeset 2152 for pjproject/trunk
- Timestamp:
- Jul 17, 2008 2:54:03 PM (16 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/include/pjmedia/session.h
r2039 r2152 280 280 pjmedia_rtcp_stat *stat); 281 281 282 283 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0) 284 /** 285 * Get extended session statistics. The extended statistic shows reports 286 * from RTCP XR, such as per interval statistics summary (packet count, 287 * packet lost, jitter, etc), VoIP metrics (delay, quality, etc) 288 * 289 * @param session The media session. 290 * @param index Stream index. 291 * @param stat_xr Stream extended statistics. 292 * 293 * @return PJ_SUCCESS on success. 294 */ 295 PJ_DECL(pj_status_t) pjmedia_session_get_stream_stat_xr( 296 pjmedia_session *session, 297 unsigned index, 298 pjmedia_rtcp_xr_stat *stat_xr); 299 #endif 300 301 282 302 /** 283 303 * Dial DTMF digit to the stream, using RFC 2833 mechanism. -
pjproject/trunk/pjmedia/src/pjmedia/session.c
r2077 r2152 822 822 823 823 /* 824 * Get extended statistics 825 */ 826 PJ_DEF(pj_status_t) pjmedia_session_get_stream_stat_xr( 827 pjmedia_session *session, 828 unsigned index, 829 pjmedia_rtcp_xr_stat *stat_xr) 830 { 831 PJ_ASSERT_RETURN(session && stat_xr && index < session->stream_cnt, 832 PJ_EINVAL); 833 834 return pjmedia_stream_get_stat_xr(session->stream[index], stat_xr); 835 } 836 837 838 /* 824 839 * Dial DTMF digit to the stream, using RFC 2833 mechanism. 825 840 */ -
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r2130 r2152 128 128 static pj_str_t uri_arg; 129 129 130 static char some_buf[ 2048];130 static char some_buf[1024 * 3]; 131 131 132 132 #ifdef STEREO_DEMO … … 1763 1763 } 1764 1764 1765 /* 1766 * Print log of call states. Since call states may be too long for logger, 1767 * printing it is a bit tricky, it should be printed part by part as long 1768 * as the logger can accept. 1769 */ 1770 static void log_call_dump(int call_id) { 1771 unsigned call_dump_len; 1772 unsigned part_len; 1773 unsigned part_idx; 1774 unsigned log_decor; 1775 1776 pjsua_call_dump(call_id, PJ_TRUE, some_buf, 1777 sizeof(some_buf), " "); 1778 call_dump_len = strlen(some_buf); 1779 1780 log_decor = pj_log_get_decor(); 1781 pj_log_set_decor(log_decor & ~(PJ_LOG_HAS_NEWLINE | PJ_LOG_HAS_CR)); 1782 PJ_LOG(3,(THIS_FILE, "\n")); 1783 pj_log_set_decor(0); 1784 1785 part_idx = 0; 1786 part_len = PJ_LOG_MAX_SIZE-80; 1787 while (part_idx < call_dump_len) { 1788 char p_orig, *p; 1789 1790 p = &some_buf[part_idx]; 1791 if (part_idx + part_len > call_dump_len) 1792 part_len = call_dump_len - part_idx; 1793 p_orig = p[part_len]; 1794 p[part_len] = '\0'; 1795 PJ_LOG(3,(THIS_FILE, "%s", p)); 1796 p[part_len] = p_orig; 1797 part_idx += part_len; 1798 } 1799 pj_log_set_decor(log_decor); 1800 } 1765 1801 1766 1802 /***************************************************************************** … … 1963 1999 /* Dump media state upon disconnected */ 1964 2000 if (1) { 1965 pjsua_call_dump(call_id, PJ_TRUE, some_buf,1966 sizeof(some_buf), " ");1967 2001 PJ_LOG(5,(THIS_FILE, 1968 "Call %d disconnected, dumping media stats\n%s", 1969 call_id, some_buf)); 2002 "Call %d disconnected, dumping media stats..", 2003 call_id)); 2004 log_call_dump(call_id); 1970 2005 } 1971 2006 … … 3720 3755 3721 3756 if (current_call != PJSUA_INVALID_ID) { 3722 pjsua_call_dump(current_call, PJ_TRUE, some_buf, 3723 sizeof(some_buf), " "); 3724 PJ_LOG(3,(THIS_FILE, "\n%s", some_buf)); 3757 log_call_dump(current_call); 3725 3758 } else { 3726 3759 PJ_LOG(3,(THIS_FILE, "No current call")); -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r2130 r2152 2185 2185 *p++ = '\n'; 2186 2186 *p = '\0'; 2187 2188 #if defined(PJMEDIA_HAS_RTCP_XR) && (PJMEDIA_HAS_RTCP_XR != 0) 2189 # define SAMPLES_TO_USEC(usec, samples, clock_rate) \ 2190 do { \ 2191 if (samples <= 4294) \ 2192 usec = samples * 1000000 / clock_rate; \ 2193 else { \ 2194 usec = samples * 1000 / clock_rate; \ 2195 usec *= 1000; \ 2196 } \ 2197 } while(0) 2198 2199 # define PRINT_VOIP_MTC_VAL(s, v) \ 2200 if (v == 127) \ 2201 sprintf(s, "(na)"); \ 2202 else \ 2203 sprintf(s, "%d", v) 2204 2205 # define VALIDATE_PRINT_BUF() \ 2206 if (len < 1 || len > end-p) { *p = '\0'; return; } \ 2207 p += len; *p++ = '\n'; *p = '\0' 2208 2209 2210 do { 2211 char loss[16], dup[16]; 2212 char jitter[80]; 2213 char toh[80]; 2214 char plc[16], jba[16], jbr[16]; 2215 char signal_lvl[16], noise_lvl[16], rerl[16]; 2216 char r_factor[16], ext_r_factor[16], mos_lq[16], mos_cq[16]; 2217 pjmedia_rtcp_xr_stat xr_stat; 2218 unsigned clock_rate; 2219 2220 if (pjmedia_session_get_stream_stat_xr(session, i, &xr_stat) != 2221 PJ_SUCCESS) 2222 { 2223 break; 2224 } 2225 2226 clock_rate = info.stream_info[i].fmt.clock_rate; 2227 2228 len = pj_ansi_snprintf(p, end-p, "\n%s Extended reports:", indent); 2229 VALIDATE_PRINT_BUF(); 2230 2231 /* Statistics Summary */ 2232 len = pj_ansi_snprintf(p, end-p, "%s Statistics Summary", indent); 2233 VALIDATE_PRINT_BUF(); 2234 2235 if (xr_stat.rx.stat_sum.l) 2236 sprintf(loss, "%d", xr_stat.rx.stat_sum.lost); 2237 else 2238 sprintf(loss, "(na)"); 2239 2240 if (xr_stat.rx.stat_sum.d) 2241 sprintf(dup, "%d", xr_stat.rx.stat_sum.dup); 2242 else 2243 sprintf(dup, "(na)"); 2244 2245 if (xr_stat.rx.stat_sum.j) { 2246 unsigned jmin, jmax, jmean, jdev; 2247 2248 SAMPLES_TO_USEC(jmin, xr_stat.rx.stat_sum.jitter.min, 2249 clock_rate); 2250 SAMPLES_TO_USEC(jmax, xr_stat.rx.stat_sum.jitter.max, 2251 clock_rate); 2252 SAMPLES_TO_USEC(jmean, xr_stat.rx.stat_sum.jitter.mean, 2253 clock_rate); 2254 SAMPLES_TO_USEC(jdev, 2255 pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.jitter), 2256 clock_rate); 2257 sprintf(jitter, "%7.3f %7.3f %7.3f %7.3f", 2258 jmin/1000.0, jmean/1000.0, jmax/1000.0, jdev/1000.0); 2259 } else 2260 sprintf(jitter, "(report not available)"); 2261 2262 if (xr_stat.rx.stat_sum.t) { 2263 sprintf(toh, "%11d %11d %11d %11d", 2264 xr_stat.rx.stat_sum.toh.min, 2265 xr_stat.rx.stat_sum.toh.mean, 2266 xr_stat.rx.stat_sum.toh.max, 2267 pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.toh)); 2268 } else 2269 sprintf(toh, "(report not available)"); 2270 2271 if (xr_stat.rx.stat_sum.update.sec == 0) 2272 strcpy(last_update, "never"); 2273 else { 2274 pj_gettimeofday(&now); 2275 PJ_TIME_VAL_SUB(now, xr_stat.rx.stat_sum.update); 2276 sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago", 2277 now.sec / 3600, 2278 (now.sec % 3600) / 60, 2279 now.sec % 60, 2280 now.msec); 2281 } 2282 2283 len = pj_ansi_snprintf(p, end-p, 2284 "%s RX last update: %s\n" 2285 "%s begin seq=%d, end seq=%d\n" 2286 "%s pkt loss=%s, dup=%s\n" 2287 "%s (msec) min avg max dev\n" 2288 "%s jitter : %s\n" 2289 "%s toh : %s", 2290 indent, last_update, 2291 indent, 2292 xr_stat.rx.stat_sum.begin_seq, xr_stat.rx.stat_sum.end_seq, 2293 indent, loss, dup, 2294 indent, 2295 indent, jitter, 2296 indent, toh 2297 ); 2298 VALIDATE_PRINT_BUF(); 2299 2300 if (xr_stat.tx.stat_sum.l) 2301 sprintf(loss, "%d", xr_stat.tx.stat_sum.lost); 2302 else 2303 sprintf(loss, "(na)"); 2304 2305 if (xr_stat.tx.stat_sum.d) 2306 sprintf(dup, "%d", xr_stat.tx.stat_sum.dup); 2307 else 2308 sprintf(dup, "(na)"); 2309 2310 if (xr_stat.tx.stat_sum.j) { 2311 unsigned jmin, jmax, jmean, jdev; 2312 2313 SAMPLES_TO_USEC(jmin, xr_stat.tx.stat_sum.jitter.min, 2314 clock_rate); 2315 SAMPLES_TO_USEC(jmax, xr_stat.tx.stat_sum.jitter.max, 2316 clock_rate); 2317 SAMPLES_TO_USEC(jmean, xr_stat.tx.stat_sum.jitter.mean, 2318 clock_rate); 2319 SAMPLES_TO_USEC(jdev, 2320 pj_math_stat_get_stddev(&xr_stat.tx.stat_sum.jitter), 2321 clock_rate); 2322 sprintf(jitter, "%7.3f %7.3f %7.3f %7.3f", 2323 jmin/1000.0, jmean/1000.0, jmax/1000.0, jdev/1000.0); 2324 } else 2325 sprintf(jitter, "(report not available)"); 2326 2327 if (xr_stat.tx.stat_sum.t) { 2328 sprintf(toh, "%11d %11d %11d %11d", 2329 xr_stat.tx.stat_sum.toh.min, 2330 xr_stat.tx.stat_sum.toh.mean, 2331 xr_stat.tx.stat_sum.toh.max, 2332 pj_math_stat_get_stddev(&xr_stat.rx.stat_sum.toh)); 2333 } else 2334 sprintf(toh, "(report not available)"); 2335 2336 if (xr_stat.tx.stat_sum.update.sec == 0) 2337 strcpy(last_update, "never"); 2338 else { 2339 pj_gettimeofday(&now); 2340 PJ_TIME_VAL_SUB(now, xr_stat.tx.stat_sum.update); 2341 sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago", 2342 now.sec / 3600, 2343 (now.sec % 3600) / 60, 2344 now.sec % 60, 2345 now.msec); 2346 } 2347 2348 len = pj_ansi_snprintf(p, end-p, 2349 "%s TX last update: %s\n" 2350 "%s begin seq=%d, end seq=%d\n" 2351 "%s pkt loss=%s, dup=%s\n" 2352 "%s (msec) min avg max dev\n" 2353 "%s jitter : %s\n" 2354 "%s toh : %s", 2355 indent, last_update, 2356 indent, 2357 xr_stat.tx.stat_sum.begin_seq, xr_stat.tx.stat_sum.end_seq, 2358 indent, loss, dup, 2359 indent, 2360 indent, jitter, 2361 indent, toh 2362 ); 2363 VALIDATE_PRINT_BUF(); 2364 2365 2366 /* VoIP Metrics */ 2367 len = pj_ansi_snprintf(p, end-p, "%s VoIP Metrics", indent); 2368 VALIDATE_PRINT_BUF(); 2369 2370 PRINT_VOIP_MTC_VAL(signal_lvl, xr_stat.rx.voip_mtc.signal_lvl); 2371 PRINT_VOIP_MTC_VAL(noise_lvl, xr_stat.rx.voip_mtc.noise_lvl); 2372 PRINT_VOIP_MTC_VAL(rerl, xr_stat.rx.voip_mtc.rerl); 2373 PRINT_VOIP_MTC_VAL(r_factor, xr_stat.rx.voip_mtc.r_factor); 2374 PRINT_VOIP_MTC_VAL(ext_r_factor, xr_stat.rx.voip_mtc.ext_r_factor); 2375 PRINT_VOIP_MTC_VAL(mos_lq, xr_stat.rx.voip_mtc.mos_lq); 2376 PRINT_VOIP_MTC_VAL(mos_cq, xr_stat.rx.voip_mtc.mos_cq); 2377 2378 switch ((xr_stat.rx.voip_mtc.rx_config>>6) & 3) { 2379 case PJMEDIA_RTCP_XR_PLC_DIS: 2380 sprintf(plc, "DISABLED"); 2381 break; 2382 case PJMEDIA_RTCP_XR_PLC_ENH: 2383 sprintf(plc, "ENHANCED"); 2384 break; 2385 case PJMEDIA_RTCP_XR_PLC_STD: 2386 sprintf(plc, "STANDARD"); 2387 break; 2388 case PJMEDIA_RTCP_XR_PLC_UNK: 2389 default: 2390 sprintf(plc, "UNKNOWN"); 2391 break; 2392 } 2393 2394 switch ((xr_stat.rx.voip_mtc.rx_config>>4) & 3) { 2395 case PJMEDIA_RTCP_XR_JB_FIXED: 2396 sprintf(jba, "FIXED"); 2397 break; 2398 case PJMEDIA_RTCP_XR_JB_ADAPTIVE: 2399 sprintf(jba, "ADAPTIVE"); 2400 break; 2401 default: 2402 sprintf(jba, "UNKNOWN"); 2403 break; 2404 } 2405 2406 sprintf(jbr, "%d", xr_stat.rx.voip_mtc.rx_config & 0x0F); 2407 2408 if (xr_stat.rx.voip_mtc.update.sec == 0) 2409 strcpy(last_update, "never"); 2410 else { 2411 pj_gettimeofday(&now); 2412 PJ_TIME_VAL_SUB(now, xr_stat.rx.voip_mtc.update); 2413 sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago", 2414 now.sec / 3600, 2415 (now.sec % 3600) / 60, 2416 now.sec % 60, 2417 now.msec); 2418 } 2419 2420 len = pj_ansi_snprintf(p, end-p, 2421 "%s RX last update: %s\n" 2422 "%s packets : loss rate=%d (%.2f%%), discard rate=%d (%.2f%%)\n" 2423 "%s burst : density=%d (%.2f%%), duration=%d%s\n" 2424 "%s gap : density=%d (%.2f%%), duration=%d%s\n" 2425 "%s delay : round trip=%d%s, end system=%d%s\n" 2426 "%s level : signal=%s%s, noise=%s%s, RERL=%s%s\n" 2427 "%s quality : R factor=%s, ext R factor=%s\n" 2428 "%s MOS LQ=%s, MOS CQ=%s\n" 2429 "%s config : PLC=%s, JB=%s, JB rate=%s, Gmin=%d\n" 2430 "%s JB delay : cur=%d%s, max=%d%s, abs max=%d%s", 2431 indent, 2432 last_update, 2433 /* packets */ 2434 indent, 2435 xr_stat.rx.voip_mtc.loss_rate, xr_stat.rx.voip_mtc.loss_rate*100.0/256, 2436 xr_stat.rx.voip_mtc.discard_rate, xr_stat.rx.voip_mtc.discard_rate*100.0/256, 2437 /* burst */ 2438 indent, 2439 xr_stat.rx.voip_mtc.burst_den, xr_stat.rx.voip_mtc.burst_den*100.0/256, 2440 xr_stat.rx.voip_mtc.burst_dur, "ms", 2441 /* gap */ 2442 indent, 2443 xr_stat.rx.voip_mtc.gap_den, xr_stat.rx.voip_mtc.gap_den*100.0/256, 2444 xr_stat.rx.voip_mtc.gap_dur, "ms", 2445 /* delay */ 2446 indent, 2447 xr_stat.rx.voip_mtc.rnd_trip_delay, "ms", 2448 xr_stat.rx.voip_mtc.end_sys_delay, "ms", 2449 /* level */ 2450 indent, 2451 signal_lvl, "dB", 2452 noise_lvl, "dB", 2453 rerl, "", 2454 /* quality */ 2455 indent, 2456 r_factor, ext_r_factor, 2457 indent, 2458 mos_lq, mos_cq, 2459 /* config */ 2460 indent, 2461 plc, jba, jbr, xr_stat.rx.voip_mtc.gmin, 2462 /* JB delay */ 2463 indent, 2464 xr_stat.rx.voip_mtc.jb_nom, "ms", 2465 xr_stat.rx.voip_mtc.jb_max, "ms", 2466 xr_stat.rx.voip_mtc.jb_abs_max, "ms" 2467 ); 2468 VALIDATE_PRINT_BUF(); 2469 2470 PRINT_VOIP_MTC_VAL(signal_lvl, xr_stat.tx.voip_mtc.signal_lvl); 2471 PRINT_VOIP_MTC_VAL(noise_lvl, xr_stat.tx.voip_mtc.noise_lvl); 2472 PRINT_VOIP_MTC_VAL(rerl, xr_stat.tx.voip_mtc.rerl); 2473 PRINT_VOIP_MTC_VAL(r_factor, xr_stat.tx.voip_mtc.r_factor); 2474 PRINT_VOIP_MTC_VAL(ext_r_factor, xr_stat.tx.voip_mtc.ext_r_factor); 2475 PRINT_VOIP_MTC_VAL(mos_lq, xr_stat.tx.voip_mtc.mos_lq); 2476 PRINT_VOIP_MTC_VAL(mos_cq, xr_stat.tx.voip_mtc.mos_cq); 2477 2478 switch ((xr_stat.tx.voip_mtc.rx_config>>6) & 3) { 2479 case PJMEDIA_RTCP_XR_PLC_DIS: 2480 sprintf(plc, "DISABLED"); 2481 break; 2482 case PJMEDIA_RTCP_XR_PLC_ENH: 2483 sprintf(plc, "ENHANCED"); 2484 break; 2485 case PJMEDIA_RTCP_XR_PLC_STD: 2486 sprintf(plc, "STANDARD"); 2487 break; 2488 case PJMEDIA_RTCP_XR_PLC_UNK: 2489 default: 2490 sprintf(plc, "unknown"); 2491 break; 2492 } 2493 2494 switch ((xr_stat.tx.voip_mtc.rx_config>>4) & 3) { 2495 case PJMEDIA_RTCP_XR_JB_FIXED: 2496 sprintf(jba, "FIXED"); 2497 break; 2498 case PJMEDIA_RTCP_XR_JB_ADAPTIVE: 2499 sprintf(jba, "ADAPTIVE"); 2500 break; 2501 default: 2502 sprintf(jba, "unknown"); 2503 break; 2504 } 2505 2506 sprintf(jbr, "%d", xr_stat.tx.voip_mtc.rx_config & 0x0F); 2507 2508 if (xr_stat.tx.voip_mtc.update.sec == 0) 2509 strcpy(last_update, "never"); 2510 else { 2511 pj_gettimeofday(&now); 2512 PJ_TIME_VAL_SUB(now, xr_stat.tx.voip_mtc.update); 2513 sprintf(last_update, "%02ldh:%02ldm:%02ld.%03lds ago", 2514 now.sec / 3600, 2515 (now.sec % 3600) / 60, 2516 now.sec % 60, 2517 now.msec); 2518 } 2519 2520 len = pj_ansi_snprintf(p, end-p, 2521 "%s TX last update: %s\n" 2522 "%s packets : loss rate=%d (%.2f%%), discard rate=%d (%.2f%%)\n" 2523 "%s burst : density=%d (%.2f%%), duration=%d%s\n" 2524 "%s gap : density=%d (%.2f%%), duration=%d%s\n" 2525 "%s delay : round trip=%d%s, end system=%d%s\n" 2526 "%s level : signal=%s%s, noise=%s%s, RERL=%s%s\n" 2527 "%s quality : R factor=%s, ext R factor=%s\n" 2528 "%s MOS LQ=%s, MOS CQ=%s\n" 2529 "%s config : PLC=%s, JB=%s, JB rate=%s, Gmin=%d\n" 2530 "%s JB delay : cur=%d%s, max=%d%s, abs max=%d%s", 2531 indent, 2532 last_update, 2533 /* pakcets */ 2534 indent, 2535 xr_stat.tx.voip_mtc.loss_rate, xr_stat.tx.voip_mtc.loss_rate*100.0/256, 2536 xr_stat.tx.voip_mtc.discard_rate, xr_stat.tx.voip_mtc.discard_rate*100.0/256, 2537 /* burst */ 2538 indent, 2539 xr_stat.tx.voip_mtc.burst_den, xr_stat.tx.voip_mtc.burst_den*100.0/256, 2540 xr_stat.tx.voip_mtc.burst_dur, "ms", 2541 /* gap */ 2542 indent, 2543 xr_stat.tx.voip_mtc.gap_den, xr_stat.tx.voip_mtc.gap_den*100.0/256, 2544 xr_stat.tx.voip_mtc.gap_dur, "ms", 2545 /* delay */ 2546 indent, 2547 xr_stat.tx.voip_mtc.rnd_trip_delay, "ms", 2548 xr_stat.tx.voip_mtc.end_sys_delay, "ms", 2549 /* level */ 2550 indent, 2551 signal_lvl, "dB", 2552 noise_lvl, "dB", 2553 rerl, "", 2554 /* quality */ 2555 indent, 2556 r_factor, ext_r_factor, 2557 indent, 2558 mos_lq, mos_cq, 2559 /* config */ 2560 indent, 2561 plc, jba, jbr, xr_stat.tx.voip_mtc.gmin, 2562 /* JB delay */ 2563 indent, 2564 xr_stat.tx.voip_mtc.jb_nom, "ms", 2565 xr_stat.tx.voip_mtc.jb_max, "ms", 2566 xr_stat.tx.voip_mtc.jb_abs_max, "ms" 2567 ); 2568 VALIDATE_PRINT_BUF(); 2569 2570 2571 /* RTT delay (by receiver side) */ 2572 len = pj_ansi_snprintf(p, end-p, 2573 "%s RTT (from recv) min avg max last dev", 2574 indent); 2575 VALIDATE_PRINT_BUF(); 2576 len = pj_ansi_snprintf(p, end-p, 2577 "%s RTT msec : %7.3f %7.3f %7.3f %7.3f %7.3f", 2578 indent, 2579 xr_stat.rtt.min / 1000.0, 2580 xr_stat.rtt.mean / 1000.0, 2581 xr_stat.rtt.max / 1000.0, 2582 xr_stat.rtt.last / 1000.0, 2583 pj_math_stat_get_stddev(&xr_stat.rtt) / 1000.0 2584 ); 2585 VALIDATE_PRINT_BUF(); 2586 } while(0); 2587 #endif 2588 2187 2589 } 2188 2590 } -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r2134 r2152 2068 2068 unsigned old_decor; 2069 2069 unsigned i; 2070 char buf[1024];2071 2070 2072 2071 PJ_LOG(3,(THIS_FILE, "Start dumping application states:")); … … 2103 2102 pjsip_ua_dump(detail); 2104 2103 2105 2104 // Dumping complete call states may require a 'large' buffer 2105 // (about 3KB per call session, including RTCP XR). 2106 #if 0 2106 2107 /* Dump all invite sessions: */ 2107 2108 PJ_LOG(3,(THIS_FILE, "Dumping invite sessions:")); … … 2116 2117 for (i=0; i<pjsua_var.ua_cfg.max_calls; ++i) { 2117 2118 if (pjsua_call_is_active(i)) { 2119 /* Tricky logging, since call states log string tends to be 2120 * longer than PJ_LOG_MAX_SIZE. 2121 */ 2122 char buf[1024 * 3]; 2123 unsigned call_dump_len; 2124 unsigned part_len; 2125 unsigned part_idx; 2126 unsigned log_decor; 2127 2118 2128 pjsua_call_dump(i, detail, buf, sizeof(buf), " "); 2119 PJ_LOG(3,(THIS_FILE, "%s", buf)); 2129 call_dump_len = strlen(buf); 2130 2131 log_decor = pj_log_get_decor(); 2132 pj_log_set_decor(log_decor & ~(PJ_LOG_HAS_NEWLINE | 2133 PJ_LOG_HAS_CR)); 2134 PJ_LOG(3,(THIS_FILE, "\n")); 2135 pj_log_set_decor(0); 2136 2137 part_idx = 0; 2138 part_len = PJ_LOG_MAX_SIZE-80; 2139 while (part_idx < call_dump_len) { 2140 char p_orig, *p; 2141 2142 p = &buf[part_idx]; 2143 if (part_idx + part_len > call_dump_len) 2144 part_len = call_dump_len - part_idx; 2145 p_orig = p[part_len]; 2146 p[part_len] = '\0'; 2147 PJ_LOG(3,(THIS_FILE, "%s", p)); 2148 p[part_len] = p_orig; 2149 part_idx += part_len; 2150 } 2151 pj_log_set_decor(log_decor); 2120 2152 } 2121 2153 } 2122 2154 } 2155 #endif 2123 2156 2124 2157 /* Dump presence status */
Note: See TracChangeset
for help on using the changeset viewer.