From 0bda7ac4e953db4a1c6dc1fff1d2c0959ee81ebb Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Sat, 25 Nov 2006 14:50:25 +0000 Subject: Print media statistic when call is disconnected in pjsua, to assist tracing media problems git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@831 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsua-lib/pjsua_call.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'pjsip/src/pjsua-lib') diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c index d5530570..679bc6fd 100644 --- a/pjsip/src/pjsua-lib/pjsua_call.c +++ b/pjsip/src/pjsua-lib/pjsua_call.c @@ -90,6 +90,10 @@ static void reset_call(pjsua_call_id id) call->conf_slot = PJSUA_INVALID_ID; call->last_text.ptr = call->last_text_buf_; call->last_text.slen = 0; + call->conn_time.sec = 0; + call->conn_time.msec = 0; + call->res_time.sec = 0; + call->res_time.msec = 0; } @@ -1776,7 +1780,7 @@ PJ_DEF(pj_status_t) pjsua_call_dump( pjsua_call_id call_id, *p++ = '\n'; /* Calculate call duration */ - if (call->inv->state >= PJSIP_INV_STATE_CONFIRMED) { + if (call->conn_time.sec != 0) { pj_gettimeofday(&duration); PJ_TIME_VAL_SUB(duration, call->conn_time); con_delay = call->conn_time; @@ -1787,7 +1791,7 @@ PJ_DEF(pj_status_t) pjsua_call_dump( pjsua_call_id call_id, } /* Calculate first response delay */ - if (call->inv->state >= PJSIP_INV_STATE_EARLY) { + if (call->res_time.sec != 0) { res_delay = call->res_time; PJ_TIME_VAL_SUB(res_delay, call->start_time); } else { @@ -1976,6 +1980,10 @@ static void pjsua_call_on_state_changed(pjsip_inv_session *inv, /* Free call */ call->inv = NULL; --pjsua_var.call_cnt; + + /* Reset call */ + reset_call(call->index); + } PJSUA_UNLOCK(); -- cgit v1.2.3