Ignore:
Timestamp:
Apr 9, 2006 4:46:05 PM (18 years ago)
Author:
bennylp
Message:

Added call duration in pjsua

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r376 r398  
    193193    } 
    194194 
     195    /* Mark call start time. */ 
     196    pj_gettimeofday(&pjsua.calls[call_index].start_time); 
     197 
     198    /* Reset first response time */ 
     199    pjsua.calls[call_index].res_time.sec = 0; 
     200 
    195201    /* Create outgoing dialog: */ 
    196  
    197202    status = pjsip_dlg_create_uac( pjsip_ua_instance(),  
    198203                                   &pjsua.acc[acc_index].local_uri, 
     
    359364    } 
    360365 
     366    /* Mark call start time. */ 
     367    pj_gettimeofday(&pjsua.calls[call_index].start_time); 
     368 
     369    /* Reset first response time */ 
     370    pjsua.calls[call_index].res_time.sec = 0; 
    361371 
    362372    /* Get media capability from media endpoint: */ 
     
    498508    pjsua_call *call = inv->dlg->mod_data[pjsua.mod.id]; 
    499509 
     510    if (!call) 
     511        return; 
     512 
     513    /* Get call times */ 
     514    switch (inv->state) { 
     515        case PJSIP_INV_STATE_EARLY: 
     516        case PJSIP_INV_STATE_CONNECTING: 
     517            if (call->res_time.sec == 0) 
     518                pj_gettimeofday(&call->res_time); 
     519            break; 
     520        case PJSIP_INV_STATE_CONFIRMED: 
     521            pj_gettimeofday(&call->conn_time); 
     522            break; 
     523        case PJSIP_INV_STATE_DISCONNECTED: 
     524            pj_gettimeofday(&call->dis_time); 
     525            break; 
     526    } 
     527 
    500528    /* If this is an outgoing INVITE that was created because of 
    501529     * REFER/transfer, send NOTIFY to transferer. 
    502530     */ 
    503     if (call && call->xfer_sub && e->type==PJSIP_EVENT_TSX_STATE)  { 
     531    if (call->xfer_sub && e->type==PJSIP_EVENT_TSX_STATE)  { 
    504532        int st_code = -1; 
    505533        pjsip_evsub_state ev_state = PJSIP_EVSUB_STATE_ACTIVE; 
Note: See TracChangeset for help on using the changeset viewer.