- Timestamp:
- Mar 1, 2007 6:41:36 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/pjproject-0.5-stable/pjsip/src/pjsip/sip_dialog.c
r994 r1027 1516 1516 } 1517 1517 1518 /* Update route-set from incoming message */ 1519 static void dlg_update_routeset(pjsip_dialog *dlg, const pjsip_msg *msg) 1520 { 1521 const pjsip_hdr *hdr, *end_hdr; 1522 1523 pj_list_init(&dlg->route_set); 1524 1525 end_hdr = &msg->hdr; 1526 for (hdr=msg->hdr.prev; hdr!=end_hdr; hdr=hdr->prev) { 1527 if (hdr->type == PJSIP_H_RECORD_ROUTE) { 1528 pjsip_route_hdr *r; 1529 r = pjsip_hdr_clone(dlg->pool, hdr); 1530 pjsip_routing_hdr_set_route(r); 1531 pj_list_push_back(&dlg->route_set, r); 1532 } 1533 } 1534 } 1535 1518 1536 /* This function is called by user agent upon receiving incoming response 1519 1537 * message. … … 1522 1540 { 1523 1541 unsigned i; 1542 pj_bool_t routeset_updated = PJ_FALSE; 1524 1543 int res_code; 1525 1544 … … 1559 1578 pj_strcmp(&dlg->remote.info->tag, &rdata->msg_info.to->tag))) 1560 1579 { 1561 pjsip_hdr *hdr, *end_hdr;1562 1580 pjsip_contact_hdr *contact; 1563 1581 … … 1575 1593 * route set for future requests in this dialog. 1576 1594 */ 1577 pj_list_init(&dlg->route_set); 1578 1579 end_hdr = &rdata->msg_info.msg->hdr; 1580 for (hdr=rdata->msg_info.msg->hdr.prev; hdr!=end_hdr; hdr=hdr->prev) { 1581 if (hdr->type == PJSIP_H_RECORD_ROUTE) { 1582 pjsip_route_hdr *r; 1583 r = pjsip_hdr_clone(dlg->pool, hdr); 1584 pjsip_routing_hdr_set_route(r); 1585 pj_list_push_back(&dlg->route_set, r); 1586 } 1587 } 1595 dlg_update_routeset(dlg, rdata->msg_info.msg); 1596 routeset_updated = PJ_TRUE; 1588 1597 1589 1598 /* The remote target MUST be set to the URI from the Contact header … … 1612 1621 /* Update remote target (again) when receiving 2xx response messages 1613 1622 * that's defined as target refresh. 1623 * 1624 * Also upon receiving 2xx response, recheck again the route set. 1625 * This is for compatibility with RFC 2543, as described in Section 1626 * 13.2.2.4 of RFC 3261: 1627 1628 If the dialog identifier in the 2xx response matches the dialog 1629 identifier of an existing dialog, the dialog MUST be transitioned to 1630 the "confirmed" state, and the route set for the dialog MUST be 1631 recomputed based on the 2xx response using the procedures of Section 1632 12.2.1.2. 1633 1634 Note that the only piece of state that is recomputed is the route 1635 set. Other pieces of state such as the highest sequence numbers 1636 (remote and local) sent within the dialog are not recomputed. The 1637 route set only is recomputed for backwards compatibility. RFC 1638 2543 did not mandate mirroring of the Record-Route header field in 1639 a 1xx, only 2xx. 1614 1640 */ 1615 1641 if (pjsip_method_creates_dialog(&rdata->msg_info.cseq->method) && … … 1624 1650 dlg->target = dlg->remote.contact->uri; 1625 1651 } 1652 1653 if (!routeset_updated) { 1654 dlg_update_routeset(dlg, rdata->msg_info.msg); 1655 routeset_updated = PJ_TRUE; 1656 } 1626 1657 } 1627 1658
Note: See TracChangeset
for help on using the changeset viewer.