Changeset 1026
- Timestamp:
- Mar 1, 2007 6:39:37 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
r995 r1026 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 … … 1611 1620 /* Update remote target (again) when receiving 2xx response messages 1612 1621 * that's defined as target refresh. 1622 * 1623 * Also upon receiving 2xx response, recheck again the route set. 1624 * This is for compatibility with RFC 2543, as described in Section 1625 * 13.2.2.4 of RFC 3261: 1626 1627 If the dialog identifier in the 2xx response matches the dialog 1628 identifier of an existing dialog, the dialog MUST be transitioned to 1629 the "confirmed" state, and the route set for the dialog MUST be 1630 recomputed based on the 2xx response using the procedures of Section 1631 12.2.1.2. 1632 1633 Note that the only piece of state that is recomputed is the route 1634 set. Other pieces of state such as the highest sequence numbers 1635 (remote and local) sent within the dialog are not recomputed. The 1636 route set only is recomputed for backwards compatibility. RFC 1637 2543 did not mandate mirroring of the Record-Route header field in 1638 a 1xx, only 2xx. 1613 1639 */ 1614 1640 if (pjsip_method_creates_dialog(&rdata->msg_info.cseq->method) && … … 1623 1649 dlg->target = dlg->remote.contact->uri; 1624 1650 } 1651 1652 if (!routeset_updated) { 1653 dlg_update_routeset(dlg, rdata->msg_info.msg); 1654 routeset_updated = PJ_TRUE; 1655 } 1625 1656 } 1626 1657
Note: See TracChangeset
for help on using the changeset viewer.