Changeset 4068


Ignore:
Timestamp:
Apr 23, 2012 1:27:29 PM (12 years ago)
Author:
ming
Message:

Fixed #1493: Fixed bug in terminating the invite session when accepting incoming call.

File:
1 edited

Legend:

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

    r4052 r4068  
    851851on_return: 
    852852    if (status != PJ_SUCCESS) { 
    853         pjsip_tx_data *tdata; 
    854         pj_status_t status_; 
    855  
    856         status_ = pjsip_inv_end_session(call->inv, sip_err_code, NULL, &tdata); 
    857         if (status_ == PJ_SUCCESS && tdata) 
    858             status_ = pjsip_inv_send_msg(call->inv, tdata); 
     853        /* If the callback is called from pjsua_call_on_incoming(), the 
     854         * invite's state is PJSIP_INV_STATE_NULL, so the invite session 
     855         * will be terminated later, otherwise we end the session here. 
     856         */ 
     857        if (call->inv->state > PJSIP_INV_STATE_NULL) { 
     858            pjsip_tx_data *tdata; 
     859            pj_status_t status_; 
     860 
     861            status_ = pjsip_inv_end_session(call->inv, sip_err_code, NULL, 
     862                                            &tdata); 
     863            if (status_ == PJ_SUCCESS && tdata) 
     864                status_ = pjsip_inv_send_msg(call->inv, tdata); 
     865        } 
    859866 
    860867        pjsua_media_channel_deinit(call->index); 
     
    12261233        if (status != PJ_SUCCESS) { 
    12271234            sip_err_code = PJSIP_SC_NOT_ACCEPTABLE; 
     1235            /* Since the call invite's state is still PJSIP_INV_STATE_NULL, 
     1236             * the invite session was not ended in 
     1237             * on_incoming_call_med_tp_complete(), so we need to send 
     1238             * a response message and terminate the invite here. 
     1239             */ 
    12281240            pjsip_dlg_respond(dlg, rdata, sip_err_code, NULL, NULL, NULL); 
     1241            pjsip_inv_terminate(call->inv, sip_err_code, PJ_FALSE);  
     1242            call->inv = NULL;  
    12291243            goto on_return; 
    12301244        } 
     
    12321246        pjsua_perror(THIS_FILE, "Error initializing media channel", status); 
    12331247        pjsip_dlg_respond(dlg, rdata, sip_err_code, NULL, NULL, NULL); 
     1248        pjsip_inv_terminate(call->inv, sip_err_code, PJ_FALSE);  
     1249        call->inv = NULL;  
    12341250        goto on_return; 
    12351251    } 
Note: See TracChangeset for help on using the changeset viewer.