Ignore:
Timestamp:
Jun 6, 2006 6:40:40 PM (18 years ago)
Author:
bennylp
Message:

Another huge chunks of modifications in PJSUA API, too many things to mention!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_im.c

    r482 r492  
    186186    pj_str_t from, to; 
    187187    pjsip_accept_hdr *accept_hdr; 
     188    pjsip_contact_hdr *contact_hdr; 
    188189    pjsip_msg *msg; 
    189190    pj_status_t status; 
     
    222223                                  NULL, NULL, NULL); 
    223224 
    224     /* Build the From text. */ 
     225    /* For the source URI, we use Contact header if present, since 
     226     * Contact header contains the port number information. If this is 
     227     * not available, then use From header. 
     228     */ 
    225229    from.ptr = pj_pool_alloc(rdata->tp_info.pool, PJSIP_MAX_URL_SIZE); 
    226     from.slen = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR,  
    227                                 rdata->msg_info.from->uri, 
    228                                 from.ptr, PJSIP_MAX_URL_SIZE); 
     230    contact_hdr = pjsip_msg_find_hdr(rdata->msg_info.msg, 
     231                                     PJSIP_H_CONTACT, NULL); 
     232    if (contact_hdr) { 
     233        from.slen = pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR, 
     234                                    contact_hdr->uri,  
     235                                    from.ptr, PJSIP_MAX_URL_SIZE); 
     236    } else { 
     237        from.slen = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR,  
     238                                    rdata->msg_info.from->uri, 
     239                                    from.ptr, PJSIP_MAX_URL_SIZE); 
     240    } 
     241 
    229242    if (from.slen < 1) 
    230243        from = pj_str("<--URI is too long-->"); 
     
    337350                                    pj_bool_t is_typing) 
    338351{ 
     352    const pj_str_t STR_CONTACT = { "Contact", 7 }; 
    339353    pjsip_tx_data *tdata; 
    340354    pj_status_t status; 
     
    351365 
    352366 
     367    /* Add accept header. */ 
     368    pjsip_msg_add_hdr( tdata->msg,  
     369                       (pjsip_hdr*)pjsua_im_create_accept(tdata->pool)); 
     370 
     371 
     372    /* Add contact. */ 
     373    pjsip_msg_add_hdr( tdata->msg, (pjsip_hdr*) 
     374        pjsip_generic_string_hdr_create(tdata->pool,  
     375                                        &STR_CONTACT, 
     376                                        &pjsua.config.acc_config[acc_index].contact)); 
     377 
     378 
    353379    /* Create "application/im-iscomposing+xml" msg body. */ 
    354380    tdata->msg->body = pjsip_iscomposing_create_body( tdata->pool, is_typing, 
Note: See TracChangeset for help on using the changeset viewer.