Ignore:
Timestamp:
Oct 25, 2011 8:51:02 AM (13 years ago)
Author:
ming
Message:

Fixed #1398: TURN initialization failure scenario

File:
1 edited

Legend:

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

    r3841 r3849  
    465465 
    466466on_error: 
     467    if (inv == NULL && call_id != -1 && pjsua_var.ua_cfg.cb.on_call_state) 
     468        (*pjsua_var.ua_cfg.cb.on_call_state)(call_id, NULL); 
     469 
    467470    if (dlg) { 
    468471        /* This may destroy the dialog */ 
     
    14021405{ 
    14031406    pjsua_call *call; 
     1407    pjsip_dialog *dlg; 
    14041408    unsigned mi; 
    14051409 
     
    14151419 
    14161420    call = &pjsua_var.calls[call_id]; 
    1417  
    1418     if (!call->inv) { 
     1421    dlg = (call->inv ? call->inv->dlg : call->async_call.dlg); 
     1422    if (!dlg) { 
    14191423        PJSUA_UNLOCK(); 
    14201424        return PJSIP_ESESSIONTERMINATED; 
     
    14231427    /* id and role */ 
    14241428    info->id = call_id; 
    1425     info->role = call->inv->role; 
     1429    info->role = dlg->role; 
    14261430    info->acc_id = call->acc_id; 
    14271431 
    14281432    /* local info */ 
    14291433    info->local_info.ptr = info->buf_.local_info; 
    1430     pj_strncpy(&info->local_info, &call->inv->dlg->local.info_str, 
     1434    pj_strncpy(&info->local_info, &dlg->local.info_str, 
    14311435               sizeof(info->buf_.local_info)); 
    14321436 
     
    14341438    info->local_contact.ptr = info->buf_.local_contact; 
    14351439    info->local_contact.slen = pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR, 
    1436                                                call->inv->dlg->local.contact->uri, 
     1440                                               dlg->local.contact->uri, 
    14371441                                               info->local_contact.ptr, 
    14381442                                               sizeof(info->buf_.local_contact)); 
     
    14401444    /* remote info */ 
    14411445    info->remote_info.ptr = info->buf_.remote_info; 
    1442     pj_strncpy(&info->remote_info, &call->inv->dlg->remote.info_str, 
     1446    pj_strncpy(&info->remote_info, &dlg->remote.info_str, 
    14431447               sizeof(info->buf_.remote_info)); 
    14441448 
    14451449    /* remote contact */ 
    1446     if (call->inv->dlg->remote.contact) { 
     1450    if (dlg->remote.contact) { 
    14471451        int len; 
    14481452        info->remote_contact.ptr = info->buf_.remote_contact; 
    14491453        len = pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR, 
    1450                               call->inv->dlg->remote.contact->uri, 
     1454                              dlg->remote.contact->uri, 
    14511455                              info->remote_contact.ptr, 
    14521456                              sizeof(info->buf_.remote_contact)); 
     
    14591463    /* call id */ 
    14601464    info->call_id.ptr = info->buf_.call_id; 
    1461     pj_strncpy(&info->call_id, &call->inv->dlg->call_id->id, 
     1465    pj_strncpy(&info->call_id, &dlg->call_id->id, 
    14621466               sizeof(info->buf_.call_id)); 
    14631467 
    14641468    /* state, state_text */ 
    1465     info->state = call->inv->state; 
     1469    info->state = (call->inv? call->inv->state: PJSIP_INV_STATE_DISCONNECTED); 
    14661470    info->state_text = pj_str((char*)pjsip_inv_state_name(info->state)); 
    14671471 
    14681472    /* If call is disconnected, set the last_status from the cause code */ 
    1469     if (call->inv->state >= PJSIP_INV_STATE_DISCONNECTED) { 
     1473    if (call->inv && call->inv->state >= PJSIP_INV_STATE_DISCONNECTED) { 
    14701474        /* last_status, last_status_text */ 
    14711475        info->last_status = call->inv->cause; 
Note: See TracChangeset for help on using the changeset viewer.