Changeset 3570


Ignore:
Timestamp:
May 19, 2011 4:36:01 AM (13 years ago)
Author:
bennylp
Message:

Fixed #1259: Option to use of 100rel in UAS if UAC supports it (thanks Marcus Froeschl for the suggestion)

Location:
pjproject/branches/1.x
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x/pjsip-apps/src/pjsua/pjsua_app.c

    r3553 r3570  
    881881 
    882882        case OPT_100REL: /** 100rel */ 
    883             cur_acc->require_100rel = PJ_TRUE; 
    884             cfg->cfg.require_100rel = PJ_TRUE; 
     883            cur_acc->require_100rel = PJSUA_100REL_MANDATORY; 
     884            cfg->cfg.require_100rel = PJSUA_100REL_MANDATORY; 
    885885            break; 
    886886 
  • pjproject/branches/1.x/pjsip/include/pjsua-lib/pjsua.h

    r3553 r3570  
    955955 
    956956/** 
     957 * This constants controls the use of 100rel extension. 
     958 */ 
     959typedef enum pjsua_100rel_use 
     960{ 
     961    /** 
     962     * Not used. For UAC, support for 100rel will be indicated in Supported 
     963     * header so that peer can opt to use it if it wants to. As UAS, this 
     964     * option will NOT cause 100rel to be used even if UAC indicates that 
     965     * it supports this feature. 
     966     */ 
     967    PJSUA_100REL_NOT_USED, 
     968 
     969    /** 
     970     * Mandatory. UAC will place 100rel in Require header, and UAS will 
     971     * reject incoming calls unless it has 100rel in Supported header. 
     972     */ 
     973    PJSUA_100REL_MANDATORY, 
     974 
     975    /** 
     976     * Optional. Similar to PJSUA_100REL_NOT_USED, except that as UAS, this 
     977     * option will cause 100rel to be used if UAC indicates that it supports it. 
     978     */ 
     979    PJSUA_100REL_OPTIONAL 
     980 
     981} pjsua_100rel_use; 
     982 
     983 
     984/** 
    957985 * This structure describes the settings to control the API and 
    958986 * user agent behavior, and can be specified when calling #pjsua_init(). 
     
    10901118 
    10911119    /** 
    1092      * Specify whether support for reliable provisional response (100rel and 
    1093      * PRACK) should be required by default. Note that this setting can be 
     1120     * Specify how the support for reliable provisional response (100rel/ 
     1121     * PRACK) should be used by default. Note that this setting can be 
    10941122     * further customized in account configuration (#pjsua_acc_config). 
    10951123     * 
    1096      * Default: PJ_FALSE 
    1097      */ 
    1098     pj_bool_t      require_100rel; 
     1124     * Default: PJSUA_100REL_NOT_USED 
     1125     */ 
     1126    pjsua_100rel_use require_100rel; 
    10991127 
    11001128    /** 
     
    22232251 
    22242252    /** 
    2225      * Specify whether support for reliable provisional response (100rel and 
    2226      * PRACK) should be required for all sessions of this account. 
    2227      * 
    2228      * Default: PJ_FALSE 
    2229      */ 
    2230     pj_bool_t       require_100rel; 
     2253     * Specify how support for reliable provisional response (100rel/ 
     2254     * PRACK) should be used for all sessions in this account. See the 
     2255     * documentation of pjsua_100rel_use enumeration for more info. 
     2256     * 
     2257     * Default: The default value is taken from the value of 
     2258     *          require_100rel in pjsua_config. 
     2259     */ 
     2260    pjsua_100rel_use require_100rel; 
    22312261 
    22322262    /** 
  • pjproject/branches/1.x/pjsip/src/pjsua-lib/pjsua_call.c

    r3553 r3570  
    500500    /* Create the INVITE session: */ 
    501501    options |= PJSIP_INV_SUPPORT_100REL; 
    502     if (acc->cfg.require_100rel) 
     502    if (acc->cfg.require_100rel == PJSUA_100REL_MANDATORY) 
    503503        options |= PJSIP_INV_REQUIRE_100REL; 
    504504    if (acc->cfg.use_timer != PJSUA_SIP_TIMER_INACTIVE) { 
     
    849849    options |= PJSIP_INV_SUPPORT_100REL; 
    850850    options |= PJSIP_INV_SUPPORT_TIMER; 
    851     if (pjsua_var.acc[acc_id].cfg.require_100rel) 
     851    if (pjsua_var.acc[acc_id].cfg.require_100rel == PJSUA_100REL_MANDATORY) 
    852852        options |= PJSIP_INV_REQUIRE_100REL; 
    853853    if (pjsua_var.media_cfg.enable_ice) 
     
    930930    { 
    931931        options &= ~(PJSIP_INV_SUPPORT_TIMER); 
     932    } 
     933 
     934    /* If 100rel is optional and UAC supports it, use it. */ 
     935    if ((options & PJSIP_INV_REQUIRE_100REL)==0 && 
     936        pjsua_var.acc[acc_id].cfg.require_100rel == PJSUA_100REL_OPTIONAL) 
     937    { 
     938        const pj_str_t token = { "100rel", 6}; 
     939        pjsip_dialog_cap_status cap_status; 
     940 
     941        cap_status = pjsip_dlg_remote_has_cap(dlg, PJSIP_H_SUPPORTED, NULL, 
     942                                              &token); 
     943        if (cap_status == PJSIP_DIALOG_CAP_SUPPORTED) 
     944            options |= PJSIP_INV_REQUIRE_100REL; 
    932945    } 
    933946 
Note: See TracChangeset for help on using the changeset viewer.