Changeset 2301 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
- Timestamp:
- Sep 20, 2008 12:16:56 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.