Ignore:
Timestamp:
Nov 5, 2007 11:14:18 PM (16 years ago)
Author:
bennylp
Message:

Update ticket #408: although route set must not be updated on subsequent requests, dialog MUST recompute the route set upon receiving 2xx response if the route set was previously computed from 1xx response

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_dialog.c

    r1537 r1550  
    643643        r = r->next; 
    644644    } 
    645     dlg->route_set_frozen = PJ_TRUE; 
     645    //dlg->route_set_frozen = PJ_TRUE; 
    646646 
    647647    /* Clone client authentication session. */ 
     
    15391539 
    15401540/* Update route-set from incoming message */ 
    1541 static void dlg_update_routeset(pjsip_dialog *dlg, const pjsip_msg *msg) 
     1541static void dlg_update_routeset(pjsip_dialog *dlg, const pjsip_rx_data *rdata) 
    15421542{ 
    15431543    const pjsip_hdr *hdr, *end_hdr; 
    1544  
    1545     /* Ignore if route set has been set */ 
     1544    pj_int32_t msg_cseq; 
     1545    const pjsip_msg *msg; 
     1546 
     1547    msg = rdata->msg_info.msg; 
     1548    msg_cseq = rdata->msg_info.cseq->cseq; 
     1549 
     1550    /* Ignore if route set has been frozen */ 
    15461551    if (dlg->route_set_frozen) 
    15471552        return; 
    15481553 
     1554    /* Only update route set if this message belongs to the same 
     1555     * transaction as the initial transaction that establishes dialog. 
     1556     */ 
     1557    if (dlg->role == PJSIP_ROLE_UAC) { 
     1558 
     1559        /* Ignore subsequent request from remote */ 
     1560        if (msg->type != PJSIP_RESPONSE_MSG) 
     1561            return; 
     1562 
     1563        /* Ignore subsequent responses with higher CSeq than initial CSeq */ 
     1564        if (msg_cseq != dlg->local.first_cseq) 
     1565            return; 
     1566 
     1567    } else { 
     1568 
     1569        /* For callee dialog, route set should have been set by initial 
     1570         * request and it will have been rejected by dlg->route_set_frozen 
     1571         * check above. 
     1572         */ 
     1573        pj_assert(!"Should not happen"); 
     1574 
     1575    } 
     1576 
     1577    /* Based on the checks above, we should only get response message here */ 
     1578    pj_assert(msg->type == PJSIP_RESPONSE_MSG); 
     1579 
     1580    /* Reset route set */ 
    15491581    pj_list_init(&dlg->route_set); 
    15501582 
     1583    /* Update route set */ 
    15511584    end_hdr = &msg->hdr; 
    15521585    for (hdr=msg->hdr.prev; hdr!=end_hdr; hdr=hdr->prev) { 
     
    15581591        } 
    15591592    } 
    1560     dlg->route_set_frozen = PJ_TRUE; 
    1561 } 
     1593 
     1594    /* Freeze the route set only when the route set comes in 2xx response.  
     1595     * If it is in 1xx response, prepare to recompute the route set when  
     1596     * the 2xx response comes in. 
     1597     * 
     1598     * There is a debate whether route set should be frozen when the dialog 
     1599     * is established with reliable provisional response, but I think 
     1600     * it is safer to not freeze the route set (thus recompute the route set 
     1601     * upon receiving 2xx response). Also RFC 3261 says so in 13.2.2.4. 
     1602     */ 
     1603    if (PJSIP_IS_STATUS_IN_CLASS(msg->line.status.code, 200)) { 
     1604        dlg->route_set_frozen = PJ_TRUE; 
     1605    } 
     1606} 
     1607 
    15621608 
    15631609/* This function is called by user agent upon receiving incoming response 
     
    16191665         * route set for future requests in this dialog. 
    16201666         */ 
    1621         dlg_update_routeset(dlg, rdata->msg_info.msg); 
     1667        dlg_update_routeset(dlg, rdata); 
    16221668 
    16231669        /* The remote target MUST be set to the URI from the Contact header  
     
    16791725        } 
    16801726 
    1681         dlg_update_routeset(dlg, rdata->msg_info.msg); 
     1727        dlg_update_routeset(dlg, rdata); 
    16821728    } 
    16831729 
Note: See TracChangeset for help on using the changeset viewer.