Changeset 574


Ignore:
Timestamp:
Jul 2, 2006 2:22:35 PM (18 years ago)
Author:
bennylp
Message:

Disconnect call when failed to start media when sending 200/OK response in pjsua, also pjsua should not try to force terminate dialog after sending 500 response

File:
1 edited

Legend:

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

    r568 r574  
    410410                                      PJSIP_SC_BUSY_HERE, NULL, 
    411411                                      NULL, NULL); 
     412        PJ_LOG(2,(THIS_FILE,  
     413                  "Unable to accept incoming call (too many calls)")); 
    412414        return PJ_TRUE; 
    413415    } 
     
    459461    status = pjsip_inv_create_uas( dlg, rdata, answer, 0, &inv); 
    460462    if (status != PJ_SUCCESS) { 
    461         pjsip_dlg_respond(dlg, rdata, 500, NULL, NULL, NULL); 
     463        pjsip_hdr hdr_list; 
     464        pjsip_warning_hdr *w; 
     465 
     466        w = pjsip_warning_hdr_create_from_status(dlg->pool,  
     467                                                 pjsip_endpt_name(pjsua_var.endpt), 
     468                                                 status); 
     469        pj_list_init(&hdr_list); 
     470        pj_list_push_back(&hdr_list, w); 
     471 
     472        pjsip_dlg_respond(dlg, rdata, 500, NULL, &hdr_list, NULL); 
     473 
     474        /* Can't terminate dialog because transaction is in progress. 
    462475        pjsip_dlg_terminate(dlg); 
     476         */ 
    463477        return PJ_TRUE; 
    464478    } 
     
    17021716 
    17031717/* 
     1718 * Disconnect call upon error. 
     1719 */ 
     1720static void call_disconnect( pjsip_inv_session *inv,  
     1721                             int code ) 
     1722{ 
     1723    pjsip_tx_data *tdata; 
     1724    pj_status_t status; 
     1725 
     1726    status = pjsip_inv_end_session(inv, code, NULL, &tdata); 
     1727    if (status == PJ_SUCCESS) 
     1728        pjsip_inv_send_msg(inv, tdata); 
     1729} 
     1730 
     1731/* 
    17041732 * Callback to be called when SDP offer/answer negotiation has just completed 
    17051733 * in the session. This function will start/update media if negotiation 
     
    17791807        pjsua_perror(THIS_FILE, "Unable to create media session",  
    17801808                     status); 
    1781         //call_disconnect(inv, PJSIP_SC_UNSUPPORTED_MEDIA_TYPE); 
     1809        call_disconnect(inv, PJSIP_SC_UNSUPPORTED_MEDIA_TYPE); 
    17821810        PJSUA_UNLOCK(); 
    17831811        return; 
Note: See TracChangeset for help on using the changeset viewer.