- Timestamp:
- Sep 20, 2008 12:16:56 PM (16 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r2262 r2301 278 278 puts (" --norefersub Suppress event subscription when transfering calls"); 279 279 puts (" --use-compact-form Minimize SIP message size"); 280 puts (" --no-force-lr Allow strict-route to be used (i.e. do not force lr)"); 280 281 281 282 puts (""); … … 482 483 OPT_STDOUT_NO_BUF, 483 484 #endif 484 OPT_AUTO_UPDATE_NAT,OPT_USE_COMPACT_FORM,OPT_DIS_CODEC 485 OPT_AUTO_UPDATE_NAT,OPT_USE_COMPACT_FORM,OPT_DIS_CODEC, 486 OPT_NO_FORCE_LR 485 487 }; 486 488 struct pj_getopt_option long_options[] = { … … 514 516 { "auto-update-nat", 1, 0, OPT_AUTO_UPDATE_NAT}, 515 517 { "use-compact-form", 0, 0, OPT_USE_COMPACT_FORM}, 518 { "no-force-lr",0, 0, OPT_NO_FORCE_LR}, 516 519 { "realm", 1, 0, OPT_REALM}, 517 520 { "username", 1, 0, OPT_USERNAME}, … … 838 841 break; 839 842 843 case OPT_NO_FORCE_LR: 844 cfg->cfg.force_lr = PJ_FALSE; 845 break; 846 840 847 case OPT_NEXT_ACCOUNT: /* Add more account. */ 841 848 cfg->acc_cnt++; … … 1799 1806 { 1800 1807 pj_strcat2(&cfg, "--use-compact-form\n"); 1808 } 1809 1810 if (config->cfg.force_lr) { 1811 pj_strcat2(&cfg, "--no-force-lr\n"); 1801 1812 } 1802 1813 -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r2259 r2301 1116 1116 1117 1117 /** 1118 * Force loose-route to be used in all route/proxy URIs (outbound_proxy 1119 * and account's proxy settings). When this setting is enabled, the 1120 * library will check all the route/proxy URIs specified in the settings 1121 * and append ";lr" parameter to the URI if the parameter is not present. 1122 * 1123 * Default: 1 1124 */ 1125 pj_bool_t force_lr; 1126 1127 /** 1118 1128 * Number of outbound proxies in the \a outbound_proxy array. 1119 1129 */ -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
r2262 r2301 343 343 #endif 344 344 345 /** 346 * Normalize route URI (check for ";lr" and append one if it doesn't 347 * exist and pjsua_config.force_lr is set. 348 */ 349 pj_status_t normalize_route_uri(pj_pool_t *pool, pj_str_t *uri); 345 350 346 351 /** -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r2278 r2301 257 257 { 258 258 pjsua_acc *acc; 259 unsigned i d;259 unsigned i, id; 260 260 pj_status_t status; 261 261 … … 294 294 { 295 295 pjsua_var.acc[id].cfg.reg_timeout = PJSUA_REG_INTERVAL; 296 } 297 298 /* Check the route URI's and force loose route if required */ 299 for (i=0; i<acc->cfg.proxy_cnt; ++i) { 300 status = normalize_route_uri(acc->pool, &acc->cfg.proxy[i]); 301 if (status != PJ_SUCCESS) 302 return status; 296 303 } 297 304 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
r2293 r2301 140 140 /* Copy config */ 141 141 pjsua_config_dup(pjsua_var.pool, &pjsua_var.ua_cfg, cfg); 142 143 /* Check the route URI's and force loose route if required */ 144 for (i=0; i<pjsua_var.ua_cfg.outbound_proxy_cnt; ++i) { 145 status = normalize_route_uri(pjsua_var.pool, 146 &pjsua_var.ua_cfg.outbound_proxy[i]); 147 if (status != PJ_SUCCESS) 148 return status; 149 } 142 150 143 151 /* Initialize invite session callback. */ -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r2186 r2301 92 92 cfg->thread_cnt = 1; 93 93 cfg->nat_type_in_sdp = 1; 94 cfg->force_lr = PJ_TRUE; 94 95 #if defined(PJMEDIA_HAS_SRTP) && (PJMEDIA_HAS_SRTP != 0) 95 96 cfg->use_srtp = PJSUA_DEFAULT_USE_SRTP; … … 2077 2078 2078 2079 2080 /** 2081 * Normalize route URI (check for ";lr" and append one if it doesn't 2082 * exist and pjsua_config.force_lr is set. 2083 */ 2084 pj_status_t normalize_route_uri(pj_pool_t *pool, pj_str_t *uri) 2085 { 2086 pj_str_t tmp_uri; 2087 pj_pool_t *tmp_pool; 2088 pjsip_uri *uri_obj; 2089 pjsip_sip_uri *sip_uri; 2090 2091 tmp_pool = pjsua_pool_create("tmplr%p", 512, 512); 2092 if (!tmp_pool) 2093 return PJ_ENOMEM; 2094 2095 pj_strdup_with_null(tmp_pool, &tmp_uri, uri); 2096 2097 uri_obj = pjsip_parse_uri(tmp_pool, tmp_uri.ptr, tmp_uri.slen, 0); 2098 if (!uri_obj) { 2099 PJ_LOG(1,(THIS_FILE, "Invalid route URI: %.*s", 2100 (int)uri->slen, uri->ptr)); 2101 pj_pool_release(tmp_pool); 2102 return PJSIP_EINVALIDURI; 2103 } 2104 2105 if (!PJSIP_URI_SCHEME_IS_SIP(uri_obj) && 2106 !PJSIP_URI_SCHEME_IS_SIP(uri_obj)) 2107 { 2108 PJ_LOG(1,(THIS_FILE, "Route URI must be SIP URI: %.*s", 2109 (int)uri->slen, uri->ptr)); 2110 pj_pool_release(tmp_pool); 2111 return PJSIP_EINVALIDSCHEME; 2112 } 2113 2114 sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri(uri_obj); 2115 2116 /* Done if force_lr is disabled or if lr parameter is present */ 2117 if (!pjsua_var.ua_cfg.force_lr || sip_uri->lr_param) { 2118 pj_pool_release(tmp_pool); 2119 return PJ_SUCCESS; 2120 } 2121 2122 /* Set lr param */ 2123 sip_uri->lr_param = 1; 2124 2125 /* Print the URI */ 2126 tmp_uri.ptr = (char*) pj_pool_alloc(tmp_pool, PJSIP_MAX_URL_SIZE); 2127 tmp_uri.slen = pjsip_uri_print(PJSIP_URI_IN_ROUTING_HDR, uri_obj, 2128 tmp_uri.ptr, PJSIP_MAX_URL_SIZE); 2129 if (tmp_uri.slen < 1) { 2130 PJ_LOG(1,(THIS_FILE, "Route URI is too long: %.*s", 2131 (int)uri->slen, uri->ptr)); 2132 pj_pool_release(tmp_pool); 2133 return PJSIP_EURITOOLONG; 2134 } 2135 2136 /* Clone the URI */ 2137 pj_strdup_with_null(pool, uri, &tmp_uri); 2138 2139 return PJ_SUCCESS; 2140 } 2141 2079 2142 /* 2080 2143 * This is a utility function to dump the stack states to log, using
Note: See TracChangeset
for help on using the changeset viewer.