Ignore:
Timestamp:
Aug 5, 2008 8:14:39 PM (16 years ago)
Author:
bennylp
Message:

Ticket #585: Handle non-SIP URI in Contact header of incoming INVITE and SUBSCRIBE requests

File:
1 edited

Legend:

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

    r2179 r2194  
    308308{ 
    309309    pj_status_t status; 
    310     pjsip_hdr *contact_hdr; 
     310    pjsip_hdr *pos = NULL; 
     311    pjsip_contact_hdr *contact_hdr; 
    311312    pjsip_rr_hdr *rr; 
    312313    pjsip_transaction *tsx = NULL; 
     
    417418 
    418419 
    419     /* Init remote's contact from Contact header. */ 
    420     contact_hdr = (pjsip_hdr*) 
    421                   pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT,  
    422                                      NULL); 
     420    /* Init remote's contact from Contact header.  
     421     * Iterate the Contact URI until we find sip: or sips: scheme. 
     422     */ 
     423    do { 
     424        contact_hdr = (pjsip_contact_hdr*) 
     425                      pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT, 
     426                                         pos); 
     427        if (contact_hdr) { 
     428            if (!PJSIP_URI_SCHEME_IS_SIP(contact_hdr->uri) &&  
     429                !PJSIP_URI_SCHEME_IS_SIPS(contact_hdr->uri)) 
     430            { 
     431                pos = (pjsip_hdr*)contact_hdr->next; 
     432                if (pos == &rdata->msg_info.msg->hdr) 
     433                    contact_hdr = NULL; 
     434            } else { 
     435                break; 
     436            } 
     437        } 
     438    } while (contact_hdr); 
     439 
    423440    if (!contact_hdr) { 
    424441        status = PJSIP_ERRNO_FROM_SIP_STATUS(PJSIP_SC_BAD_REQUEST); 
    425442        goto on_error; 
    426443    } 
     444 
    427445    dlg->remote.contact = (pjsip_contact_hdr*)  
    428                           pjsip_hdr_clone(dlg->pool, contact_hdr); 
     446                          pjsip_hdr_clone(dlg->pool, (pjsip_hdr*)contact_hdr); 
    429447 
    430448    /* Init remote's CSeq from CSeq header */ 
Note: See TracChangeset for help on using the changeset viewer.