Ignore:
Timestamp:
Aug 5, 2009 6:41:23 PM (15 years ago)
Author:
nanang
Message:

Ticket #930:

  • Updated semantic of contact param in functions pjsip_dlg_create_uac(), pjsip_dlg_create_uas(), pjsip_endpt_create_request() and also variable pjsua_acc.contact to be Contact header value (was Contact URI).
  • Updated docs related to above modifications.
  • Fixed pjsua_im_send() in generating contact header, it should use pjsua_acc.contact instead, if it is set.
File:
1 edited

Legend:

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

    r2394 r2855  
    4444pj_bool_t pjsip_include_allow_hdr_in_dlg = PJSIP_INCLUDE_ALLOW_HDR_IN_DLG; 
    4545 
     46/* Contact header string */ 
     47static const pj_str_t HCONTACT = { "Contact", 7 }; 
    4648 
    4749PJ_DEF(pj_bool_t) pjsip_method_creates_dialog(const pjsip_method *m) 
     
    211213 
    212214    /* Init local contact. */ 
    213     dlg->local.contact = pjsip_contact_hdr_create(dlg->pool); 
    214215    pj_strdup_with_null(dlg->pool, &tmp,  
    215216                        local_contact ? local_contact : local_uri); 
    216     dlg->local.contact->uri = pjsip_parse_uri(dlg->pool, tmp.ptr, tmp.slen, 
    217                                               PJSIP_PARSE_URI_AS_NAMEADDR); 
    218     if (!dlg->local.contact->uri) { 
     217    dlg->local.contact = pjsip_parse_hdr(dlg->pool, &HCONTACT, tmp.ptr,  
     218                                         tmp.slen, NULL); 
     219    if (!dlg->local.contact) { 
    219220        status = PJSIP_EINVALIDURI; 
    220221        goto on_error; 
     
    391392        pj_str_t tmp; 
    392393 
    393         dlg->local.contact = pjsip_contact_hdr_create(dlg->pool); 
    394394        pj_strdup_with_null(dlg->pool, &tmp, contact); 
    395         dlg->local.contact->uri = pjsip_parse_uri(dlg->pool, tmp.ptr, tmp.slen, 
    396                                                   PJSIP_PARSE_URI_AS_NAMEADDR); 
    397         if (!dlg->local.contact->uri) { 
     395        dlg->local.contact = pjsip_parse_hdr(dlg->pool, &HCONTACT, tmp.ptr,  
     396                                             tmp.slen, NULL); 
     397        if (!dlg->local.contact) { 
    398398            status = PJSIP_EINVALIDURI; 
    399399            goto on_error; 
     
    12261226            st_code==485)  
    12271227        { 
    1228             pj_str_t hcontact = { "Contact", 7 }; 
    1229  
    12301228            /* Add contact header only if one is not present. */ 
    12311229            if (pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL) == 0 && 
    1232                 pjsip_msg_find_hdr_by_name(tdata->msg, &hcontact, NULL) == 0)  
     1230                pjsip_msg_find_hdr_by_name(tdata->msg, &HCONTACT, NULL) == 0)  
    12331231            { 
    12341232                hdr = (pjsip_hdr*) pjsip_hdr_clone(tdata->pool,  
Note: See TracChangeset for help on using the changeset viewer.