Changeset 1550
- Timestamp:
- Nov 5, 2007 11:14:18 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
r1537 r1550 643 643 r = r->next; 644 644 } 645 dlg->route_set_frozen = PJ_TRUE;645 //dlg->route_set_frozen = PJ_TRUE; 646 646 647 647 /* Clone client authentication session. */ … … 1539 1539 1540 1540 /* Update route-set from incoming message */ 1541 static void dlg_update_routeset(pjsip_dialog *dlg, const pjsip_ msg *msg)1541 static void dlg_update_routeset(pjsip_dialog *dlg, const pjsip_rx_data *rdata) 1542 1542 { 1543 1543 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 */ 1546 1551 if (dlg->route_set_frozen) 1547 1552 return; 1548 1553 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 */ 1549 1581 pj_list_init(&dlg->route_set); 1550 1582 1583 /* Update route set */ 1551 1584 end_hdr = &msg->hdr; 1552 1585 for (hdr=msg->hdr.prev; hdr!=end_hdr; hdr=hdr->prev) { … … 1558 1591 } 1559 1592 } 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 1562 1608 1563 1609 /* This function is called by user agent upon receiving incoming response … … 1619 1665 * route set for future requests in this dialog. 1620 1666 */ 1621 dlg_update_routeset(dlg, rdata ->msg_info.msg);1667 dlg_update_routeset(dlg, rdata); 1622 1668 1623 1669 /* The remote target MUST be set to the URI from the Contact header … … 1679 1725 } 1680 1726 1681 dlg_update_routeset(dlg, rdata ->msg_info.msg);1727 dlg_update_routeset(dlg, rdata); 1682 1728 } 1683 1729
Note: See TracChangeset
for help on using the changeset viewer.