Ignore:
Timestamp:
Jun 22, 2010 6:02:13 AM (14 years ago)
Author:
bennylp
Message:

Fixed #1095 (New option to control the Route headers in REGISTER request). Details:

  • added new account config setting: reg_use_proxy. This contains bitmask values to indicate whether outbound proxies and account proxies are to be added in the REGISTER request. Default value is to add both.
  • added new pjsua cmdline option to control this: --reg-use-proxy
  • miscellaneous minor fixes in other pjsua cmdline arguments
File:
1 edited

Legend:

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

    r3213 r3216  
    6565    pjsua_var.nat_status = PJ_EPENDING; 
    6666    pj_list_init(&pjsua_var.stun_res); 
     67    pj_list_init(&pjsua_var.outbound_proxy); 
    6768 
    6869    pjsua_config_default(&pjsua_var.ua_cfg); 
     
    180181    cfg->reg_retry_interval = PJSUA_REG_RETRY_INTERVAL; 
    181182    cfg->contact_rewrite_method = PJSUA_CONTACT_REWRITE_METHOD; 
     183    cfg->reg_use_proxy = PJSUA_REG_USE_OUTBOUND_PROXY | 
     184                         PJSUA_REG_USE_ACC_PROXY; 
    182185} 
    183186 
     
    666669    const pj_str_t       STR_OPTIONS = { "OPTIONS", 7 }; 
    667670    pjsip_ua_init_param  ua_init_param; 
     671    unsigned i; 
    668672    pj_status_t status; 
    669673 
     
    784788    } 
    785789 
     790    /* Parse outbound proxies */ 
     791    for (i=0; i<ua_cfg->outbound_proxy_cnt; ++i) { 
     792        pj_str_t tmp; 
     793        pj_str_t hname = { "Route", 5}; 
     794        pjsip_route_hdr *r; 
     795 
     796        pj_strdup_with_null(pjsua_var.pool, &tmp, &ua_cfg->outbound_proxy[i]); 
     797 
     798        r = (pjsip_route_hdr*) 
     799            pjsip_parse_hdr(pjsua_var.pool, &hname, tmp.ptr, 
     800                            (unsigned)tmp.slen, NULL); 
     801        if (r == NULL) { 
     802            pjsua_perror(THIS_FILE, "Invalid outbound proxy URI", 
     803                         PJSIP_EINVALIDURI); 
     804            return PJSIP_EINVALIDURI; 
     805        } 
     806 
     807        if (pjsua_var.ua_cfg.force_lr) { 
     808            pjsip_sip_uri *sip_url; 
     809            if (!PJSIP_URI_SCHEME_IS_SIP(r->name_addr.uri) && 
     810                !PJSIP_URI_SCHEME_IS_SIP(r->name_addr.uri)) 
     811            { 
     812                return PJSIP_EINVALIDSCHEME; 
     813            } 
     814            sip_url = (pjsip_sip_uri*)r->name_addr.uri; 
     815            sip_url->lr_param = 1; 
     816        } 
     817 
     818        pj_list_push_back(&pjsua_var.outbound_proxy, r); 
     819    } 
    786820     
    787821 
Note: See TracChangeset for help on using the changeset viewer.