Changeset 4269


Ignore:
Timestamp:
Sep 28, 2012 10:07:22 AM (12 years ago)
Author:
nanang
Message:

Re #1587: Respond to call replace request with the last provisional response sent in the replaced call.

File:
1 edited

Legend:

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

    r4268 r4269  
    812812    pjsip_inv_session *replaced_inv; 
    813813    struct pjsua_call *replaced_call; 
    814     pjsip_tx_data *tdata; 
    815     pj_status_t status; 
     814    pjsip_tx_data *tdata = NULL; 
     815    pj_status_t status = PJ_SUCCESS; 
    816816 
    817817    /* Get the invite session in the dialog */ 
     
    829829        replaced_call->inv->role != PJSIP_ROLE_UAC) 
    830830    { 
    831         /* Replaced call is not in confirmed state yet and we are not 
    832          * the call initiator, should not answer with 200 response here. 
    833          */ 
     831        if (replaced_call->last_code > 100 && replaced_call->last_code < 200) 
     832        { 
     833            pjsip_status_code code = replaced_call->last_code; 
     834            pj_str_t *text = &replaced_call->last_text; 
     835 
     836            PJ_LOG(4,(THIS_FILE, "Answering replacement call %d with %d/%.*s", 
     837                                 call->index, code, text->slen, text->ptr)); 
     838 
     839            /* Answer the new call with last response in the replaced call */ 
     840            status = pjsip_inv_answer(call->inv, code, text, NULL, &tdata); 
     841        } 
    834842    } else { 
    835843        PJ_LOG(4,(THIS_FILE, "Answering replacement call %d with 200/OK", 
     
    840848    } 
    841849 
    842     if (status == PJ_SUCCESS) 
     850    if (status == PJ_SUCCESS && tdata) 
    843851        status = pjsip_inv_send_msg(call->inv, tdata); 
    844852 
Note: See TracChangeset for help on using the changeset viewer.