Changeset 3222 for pjproject


Ignore:
Timestamp:
Jun 24, 2010 12:33:18 PM (14 years ago)
Author:
bennylp
Message:

Fixed #1081: Implement ICE option tag (RFC 5678)

Location:
pjproject/trunk/pjsip
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsip-ua/sip_inv.h

    r2869 r3222  
    296296    PJSIP_INV_SUPPORT_UPDATE    = 4, 
    297297 
     298    /** 
     299     * Indicate support for ICE 
     300     */ 
     301    PJSIP_INV_SUPPORT_ICE       = 8, 
     302 
     303    /** 
     304     * Require ICE support. 
     305     */ 
     306    PJSIP_INV_REQUIRE_ICE       = 16, 
     307 
    298308    /**  
    299309     * Require reliable provisional response extension.  
     
    310320     * support/want session timer. 
    311321     */ 
    312     PJSIP_INV_ALWAYS_USE_TIMER  = 128, 
     322    PJSIP_INV_ALWAYS_USE_TIMER  = 128 
    313323 
    314324}; 
  • pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h

    r3216 r3222  
    305305 
    306306#endif 
     307 
     308/** 
     309 * Controls whether PJSUA-LIB should add ICE media feature tag 
     310 * parameter (the ";+sip.ice" parameter) to Contact header if ICE 
     311 * is enabled in the config. 
     312 * 
     313 * Default: 1 
     314 */ 
     315#ifndef PJSUA_ADD_ICE_TAGS 
     316#   define PJSUA_ADD_ICE_TAGS           1 
     317#endif 
     318 
    307319 
    308320/** 
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c

    r3217 r3222  
    778778    if (*options & PJSIP_INV_REQUIRE_TIMER) 
    779779        *options |= PJSIP_INV_SUPPORT_TIMER; 
     780    if (*options & PJSIP_INV_REQUIRE_ICE) 
     781        *options |= PJSIP_INV_SUPPORT_ICE; 
    780782 
    781783    /* Get the message in rdata */ 
     
    949951        const pj_str_t STR_100REL = { "100rel", 6}; 
    950952        const pj_str_t STR_TIMER = { "timer", 5}; 
     953        const pj_str_t STR_ICE = { "ice", 3 }; 
    951954 
    952955        for (i=0; i<sup_hdr->count; ++i) { 
    953956            if (pj_stricmp(&sup_hdr->values[i], &STR_100REL)==0) 
    954957                rem_option |= PJSIP_INV_SUPPORT_100REL; 
    955             if (pj_stricmp(&sup_hdr->values[i], &STR_TIMER)==0) 
     958            else if (pj_stricmp(&sup_hdr->values[i], &STR_TIMER)==0) 
    956959                rem_option |= PJSIP_INV_SUPPORT_TIMER; 
     960            else if (pj_stricmp(&sup_hdr->values[i], &STR_ICE)==0) 
     961                rem_option |= PJSIP_INV_SUPPORT_ICE; 
    957962        } 
    958963    } 
     
    966971        const pj_str_t STR_REPLACES = { "replaces", 8 }; 
    967972        const pj_str_t STR_TIMER = { "timer", 5 }; 
     973        const pj_str_t STR_ICE = { "ice", 3 }; 
    968974        unsigned unsupp_cnt = 0; 
    969975        pj_str_t unsupp_tags[PJSIP_GENERIC_ARRAY_MAX_COUNT]; 
     
    987993                if (!supp) 
    988994                    unsupp_tags[unsupp_cnt++] = req_hdr->values[i]; 
     995            } else if ((*options & PJSIP_INV_SUPPORT_ICE) && 
     996                pj_stricmp(&req_hdr->values[i], &STR_ICE)==0) 
     997            { 
     998                rem_option |= PJSIP_INV_REQUIRE_ICE; 
    989999 
    9901000            } else if (!pjsip_endpt_has_capability(endpt, PJSIP_H_SUPPORTED, 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c

    r3216 r3222  
    237237        acc->cred[acc->cred_cnt++] = pjsua_var.ua_cfg.cred_info[i]; 
    238238    } 
     239 
     240    /* If ICE is enabled, add "+sip.ice" media feature tag in account's 
     241     * contact params. 
     242     */ 
     243#if PJSUA_ADD_ICE_TAGS 
     244    if (pjsua_var.media_cfg.enable_ice) { 
     245        unsigned new_len; 
     246        pj_str_t new_prm; 
     247 
     248        new_len = acc_cfg->contact_params.slen + 10; 
     249        new_prm.ptr = (char*)pj_pool_alloc(acc->pool, new_len); 
     250        pj_strcpy(&new_prm, &acc_cfg->contact_params); 
     251        pj_strcat2(&new_prm, ";+sip.ice"); 
     252        acc_cfg->contact_params = new_prm; 
     253    } 
     254#endif 
    239255 
    240256    status = pjsua_pres_init_acc(acc_id); 
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c

    r3219 r3222  
    841841    if (pjsua_var.acc[acc_id].cfg.require_timer) 
    842842        options |= PJSIP_INV_REQUIRE_TIMER; 
     843    if (pjsua_var.media_cfg.enable_ice) 
     844        options |= PJSIP_INV_SUPPORT_ICE; 
    843845 
    844846    status = pjsip_inv_verify_request2(rdata, &options, offer, answer, NULL, 
Note: See TracChangeset for help on using the changeset viewer.