Changeset 2271


Ignore:
Timestamp:
Sep 11, 2008 8:00:47 AM (11 years ago)
Author:
bennylp
Message:

Ticket #620: PRACK is sent to the wrong UAS when 100rel is used and the dialog forks (thanks Ruud Klaver for the report)

Location:
pjproject/trunk/pjsip/src
Files:
2 edited

Legend:

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

    r2039 r2271  
    418418    pj_status_t status; 
    419419 
    420     dd = (dlg_data*) inv->dlg->mod_data[mod_100rel.mod.id]; 
    421     PJ_ASSERT_RETURN(dd != NULL, PJSIP_ENOTINITIALIZED); 
    422  
    423420    tsx = pjsip_rdata_get_tsx(rdata); 
    424421    pj_assert(tsx != NULL); 
    425422 
    426423    msg = rdata->msg_info.msg; 
     424 
     425    dd = (dlg_data*) inv->dlg->mod_data[mod_100rel.mod.id]; 
     426    if (dd == NULL) { 
     427        /* UAC sends us PRACK while we didn't send reliable provisional  
     428         * response. Respond with 400 (?)  
     429         */ 
     430        const pj_str_t reason = pj_str("Unexpected PRACK"); 
     431 
     432        status = pjsip_dlg_create_response(inv->dlg, rdata, 400,  
     433                                           &reason, &tdata); 
     434        if (status == PJ_SUCCESS) { 
     435            status = pjsip_dlg_send_response(inv->dlg, tsx, tdata); 
     436        } 
     437        return PJSIP_ENOTINITIALIZED; 
     438    } 
    427439 
    428440    /* Always reply with 200/OK for PRACK */ 
  • pjproject/trunk/pjsip/src/pjsip/sip_dialog.c

    r2194 r2271  
    16971697     * The workaround for this is to take the To tag received in the 
    16981698     * 2xx response and set it as remote tag. 
     1699     * 
     1700     * New update: 
     1701     * We also need to update the dialog for 1xx responses, to handle the 
     1702     * case when 100rel is used, otherwise PRACK will be sent to the  
     1703     * wrong target. 
    16991704     */ 
    17001705    if ((dlg->state == PJSIP_DIALOG_STATE_NULL &&  
     
    17051710        (dlg->role==PJSIP_ROLE_UAC && 
    17061711         !dlg->uac_has_2xx && 
    1707          res_code/100 == 2 && 
     1712         res_code/100 <= 2 && 
    17081713         pjsip_method_creates_dialog(&rdata->msg_info.cseq->method) && 
    17091714         pj_strcmp(&dlg->remote.info->tag, &rdata->msg_info.to->tag))) 
Note: See TracChangeset for help on using the changeset viewer.