Changeset 4268


Ignore:
Timestamp:
Sep 28, 2012 8:56:08 AM (8 years ago)
Author:
nanang
Message:

Re #1587:

  • Don't answer call replace request with 200 if the replaced call hasn't reach confirmed state and has UAS role.
  • Only apply accept_replace_in_early_state when call is in early state.
Location:
pjproject/trunk/pjsip/src
Files:
2 edited

Legend:

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

    r4267 r4268  
    306306     * Exist) response to the new INVITE. 
    307307     */ 
    308     if (inv->state <= PJSIP_INV_STATE_EARLY && inv->role != PJSIP_ROLE_UAC && 
    309         pjsip_cfg()->endpt.accept_replace_in_early_state == PJ_FALSE) 
     308    if (inv->state <= PJSIP_INV_STATE_EARLY && inv->role != PJSIP_ROLE_UAC) 
    310309    { 
    311         code = PJSIP_SC_CALL_TSX_DOES_NOT_EXIST; 
    312         warn_text = "Found early INVITE session but not initiated by this UA"; 
    313         goto on_return; 
     310        /* Really return 481 only if call haven't reached early state or 
     311         * accept-replace-in-early-state (ticket #1587) is not allowed. 
     312         */ 
     313        if (inv->state != PJSIP_INV_STATE_EARLY || 
     314            pjsip_cfg()->endpt.accept_replace_in_early_state == PJ_FALSE) 
     315        { 
     316            code = PJSIP_SC_CALL_TSX_DOES_NOT_EXIST; 
     317            warn_text = "Found early INVITE session but not initiated by " 
     318                        "this UA"; 
     319            goto on_return; 
     320        } 
    314321    } 
    315322 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r4244 r4268  
    826826                                             call->index); 
    827827 
    828     PJ_LOG(4,(THIS_FILE, "Answering replacement call %d with 200/OK", 
    829                          call->index)); 
    830  
    831     /* Answer the new call with 200 response */ 
    832     status = pjsip_inv_answer(call->inv, 200, NULL, NULL, &tdata); 
     828    if (replaced_call->inv->state <= PJSIP_INV_STATE_EARLY && 
     829        replaced_call->inv->role != PJSIP_ROLE_UAC) 
     830    { 
     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         */ 
     834    } else { 
     835        PJ_LOG(4,(THIS_FILE, "Answering replacement call %d with 200/OK", 
     836                             call->index)); 
     837 
     838        /* Answer the new call with 200 response */ 
     839        status = pjsip_inv_answer(call->inv, 200, NULL, NULL, &tdata); 
     840    } 
     841 
    833842    if (status == PJ_SUCCESS) 
    834843        status = pjsip_inv_send_msg(call->inv, tdata); 
Note: See TracChangeset for help on using the changeset viewer.