Ignore:
Timestamp:
Feb 10, 2006 2:04:05 PM (18 years ago)
Author:
bennylp
Message:

Added more logging, and fixed bug when ACK is responded!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c

    r171 r175  
    131131 
    132132    if (inv->state == PJSIP_INV_STATE_DISCONNECTED) 
    133         pjsip_dlg_dec_session(inv->dlg); 
     133        pjsip_dlg_dec_session(inv->dlg, &mod_inv.mod); 
    134134} 
    135135 
     
    142142    pjsip_tx_data *tdata; 
    143143    pj_status_t status; 
     144 
     145    PJ_LOG(5,(inv->obj_name, "Received %s, sending ACK", 
     146              pjsip_rx_data_get_info(rdata))); 
    144147 
    145148    status = pjsip_dlg_create_request(inv->dlg, &pjsip_ack_method,  
     
    371374    inv->options = options; 
    372375 
     376    /* Object name will use the same dialog pointer. */ 
     377    pj_snprintf(inv->obj_name, PJ_MAX_OBJ_NAME, "inv%p", dlg); 
     378 
    373379    /* Create negotiator if local_sdp is specified. */ 
    374380    if (local_sdp) { 
     
    385391 
    386392    /* Increment dialog session */ 
    387     pjsip_dlg_inc_session(dlg); 
     393    pjsip_dlg_inc_session(dlg, &mod_inv.mod); 
    388394 
    389395    /* Done */ 
    390396    *p_inv = inv; 
     397 
     398    PJ_LOG(5,(inv->obj_name, "UAC invite session created for dialog %s", 
     399              dlg->obj_name)); 
     400 
    391401    return PJ_SUCCESS; 
    392402} 
     
    760770    inv->options = options; 
    761771 
     772    /* Object name will use the same dialog pointer. */ 
     773    pj_snprintf(inv->obj_name, PJ_MAX_OBJ_NAME, "inv%p", dlg); 
     774 
    762775    /* Parse SDP in message body, if present. */ 
    763776    if (msg->body) { 
     
    795808 
    796809    /* Increment session in the dialog. */ 
    797     pjsip_dlg_inc_session(dlg); 
     810    pjsip_dlg_inc_session(dlg, &mod_inv.mod); 
    798811 
    799812    /* Save the invite transaction. */ 
     
    808821    /* Done */ 
    809822    *p_inv = inv; 
     823 
     824    PJ_LOG(5,(inv->obj_name, "UAS invite session created for dialog %s", 
     825              dlg->obj_name)); 
     826 
    810827    return PJ_SUCCESS; 
    811828} 
     
    912929 
    913930    status = pjmedia_sdp_neg_negotiate(inv->pool, inv->neg, 0); 
     931 
     932    PJ_LOG(5,(inv->obj_name, "SDP negotiation done, status=%d", status)); 
    914933 
    915934    if (mod_inv.cb.on_media_update) 
     
    9821001        /* This is an offer. */ 
    9831002 
     1003        PJ_LOG(5,(inv->obj_name, "Got SDP offer in %s",  
     1004                  pjsip_rx_data_get_info(rdata))); 
     1005 
    9841006        if (inv->neg == NULL) { 
    9851007            status=pjmedia_sdp_neg_create_w_remote_offer(inv->pool, NULL,  
     
    10091031         * Process and negotiate remote answer. 
    10101032         */ 
     1033 
     1034        PJ_LOG(5,(inv->obj_name, "Got SDP answer in %s",  
     1035                  pjsip_rx_data_get_info(rdata))); 
    10111036 
    10121037        status = pjmedia_sdp_neg_set_remote_answer(inv->pool, inv->neg, sdp); 
     
    12601285    /* Verify arguments. */ 
    12611286    PJ_ASSERT_RETURN(inv && tdata, PJ_EINVAL); 
     1287 
     1288    PJ_LOG(5,(inv->obj_name, "Sending %s",  
     1289              pjsip_tx_data_get_info(tdata))); 
    12621290 
    12631291    if (tdata->msg->type == PJSIP_REQUEST_MSG) { 
     
    15821610            break; 
    15831611        } 
     1612 
     1613    } else if (inv->role == PJSIP_ROLE_UAC && 
     1614               tsx->role == PJSIP_ROLE_UAC && 
     1615               tsx->method.id == PJSIP_CANCEL_METHOD) 
     1616    { 
     1617        /* 
     1618         * Handle case when outgoing CANCEL is answered with 481 (Call/ 
     1619         * Transaction Does Not Exist), 408, or when it's timed out. In these 
     1620         * cases, disconnect session (i.e. dialog usage only). 
     1621         */ 
     1622        if (tsx->status_code == PJSIP_SC_CALL_TSX_DOES_NOT_EXIST || 
     1623            tsx->status_code == PJSIP_SC_REQUEST_TIMEOUT || 
     1624            tsx->status_code == PJSIP_SC_TSX_TIMEOUT || 
     1625            PJSIP_SC_TSX_TRANSPORT_ERROR) 
     1626        { 
     1627            inv_set_state(inv, PJSIP_INV_STATE_DISCONNECTED, e); 
     1628        } 
    15841629    } 
    15851630} 
     
    17381783        inv_respond_incoming_cancel(inv, tsx, e->body.tsx_state.src.rdata); 
    17391784 
     1785    } else if (inv->role == PJSIP_ROLE_UAC && 
     1786               tsx->role == PJSIP_ROLE_UAC && 
     1787               tsx->method.id == PJSIP_CANCEL_METHOD) 
     1788    { 
     1789        /* 
     1790         * Handle case when outgoing CANCEL is answered with 481 (Call/ 
     1791         * Transaction Does Not Exist), 408, or when it's timed out. In these 
     1792         * cases, disconnect session (i.e. dialog usage only). 
     1793         */ 
     1794        if (tsx->status_code == PJSIP_SC_CALL_TSX_DOES_NOT_EXIST || 
     1795            tsx->status_code == PJSIP_SC_REQUEST_TIMEOUT || 
     1796            tsx->status_code == PJSIP_SC_TSX_TIMEOUT || 
     1797            PJSIP_SC_TSX_TRANSPORT_ERROR) 
     1798        { 
     1799            inv_set_state(inv, PJSIP_INV_STATE_DISCONNECTED, e); 
     1800        } 
    17401801    } 
    17411802} 
Note: See TracChangeset for help on using the changeset viewer.