Ignore:
Timestamp:
Jul 28, 2008 6:57:36 PM (16 years ago)
Author:
bennylp
Message:

Ticket #580: Incoming target refresh request does not update the Contact header (thanks Joel Dodson for the report)

File:
1 edited

Legend:

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

    r2039 r2179  
    15011501    } 
    15021502 
     1503    /* Update the target URI if this is a target refresh request. 
     1504     * We have passed the basic checking for the request, I think we 
     1505     * should update the target URI regardless of whether the request 
     1506     * is accepted or not (e.g. when re-INVITE is answered with 488, 
     1507     * we would still need to update the target URI, otherwise our 
     1508     * target URI would be wrong, wouldn't it). 
     1509     */ 
     1510    if (pjsip_method_creates_dialog(&rdata->msg_info.cseq->method)) { 
     1511        pjsip_contact_hdr *contact; 
     1512 
     1513        contact = (pjsip_contact_hdr*) 
     1514                  pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT,  
     1515                                     NULL); 
     1516        if (contact && (dlg->remote.contact==NULL || 
     1517                        pjsip_uri_cmp(PJSIP_URI_IN_REQ_URI,  
     1518                                      dlg->remote.contact->uri,  
     1519                                      contact->uri))) 
     1520        { 
     1521            dlg->remote.contact = (pjsip_contact_hdr*)  
     1522                                  pjsip_hdr_clone(dlg->pool, contact); 
     1523            dlg->target = dlg->remote.contact->uri; 
     1524        } 
     1525    } 
     1526 
    15031527    /* Report the request to dialog usages. */ 
    15041528    for (i=0; i<dlg->usage_cnt; ++i) { 
     
    16901714                  pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT,  
    16911715                                     NULL); 
    1692         if (contact) { 
     1716        if (contact && (dlg->remote.contact==NULL || 
     1717                        pjsip_uri_cmp(PJSIP_URI_IN_REQ_URI,  
     1718                                      dlg->remote.contact->uri,  
     1719                                      contact->uri))) 
     1720        { 
    16931721            dlg->remote.contact = (pjsip_contact_hdr*)  
    16941722                                  pjsip_hdr_clone(dlg->pool, contact); 
     
    17361764                                                          PJSIP_H_CONTACT,  
    17371765                                                          NULL); 
    1738         if (contact) { 
     1766        if (contact && (dlg->remote.contact==NULL || 
     1767                        pjsip_uri_cmp(PJSIP_URI_IN_REQ_URI,  
     1768                                      dlg->remote.contact->uri,  
     1769                                      contact->uri))) 
     1770        { 
    17391771            dlg->remote.contact = (pjsip_contact_hdr*)  
    17401772                                  pjsip_hdr_clone(dlg->pool, contact); 
Note: See TracChangeset for help on using the changeset viewer.