Changeset 2130 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
- Timestamp:
- Jul 13, 2008 12:24:55 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r2039 r2130 109 109 110 110 name_addr = (pjsip_name_addr*) 111 pjsip_parse_uri( pjsua_var.pool, acc_cfg->id.ptr,111 pjsip_parse_uri(acc->pool, acc_cfg->id.ptr, 112 112 acc_cfg->id.slen, 113 113 PJSIP_PARSE_URI_AS_NAMEADDR); … … 137 137 pjsip_uri *reg_uri; 138 138 139 reg_uri = pjsip_parse_uri( pjsua_var.pool, acc_cfg->reg_uri.ptr,139 reg_uri = pjsip_parse_uri(acc->pool, acc_cfg->reg_uri.ptr, 140 140 acc_cfg->reg_uri.slen, 0); 141 141 if (reg_uri == NULL) { … … 188 188 pj_str_t tmp; 189 189 190 pj_strdup_with_null( pjsua_var.pool, &tmp,190 pj_strdup_with_null(acc->pool, &tmp, 191 191 &pjsua_var.ua_cfg.outbound_proxy[i]); 192 192 r = (pjsip_route_hdr*) 193 pjsip_parse_hdr( pjsua_var.pool, &hname, tmp.ptr, tmp.slen, NULL);193 pjsip_parse_hdr(acc->pool, &hname, tmp.ptr, tmp.slen, NULL); 194 194 if (r == NULL) { 195 195 pjsua_perror(THIS_FILE, "Invalid outbound proxy URI", … … 205 205 pj_str_t tmp; 206 206 207 pj_strdup_with_null( pjsua_var.pool, &tmp, &acc_cfg->proxy[i]);207 pj_strdup_with_null(acc->pool, &tmp, &acc_cfg->proxy[i]); 208 208 r = (pjsip_route_hdr*) 209 pjsip_parse_hdr( pjsua_var.pool, &hname, tmp.ptr, tmp.slen, NULL);209 pjsip_parse_hdr(acc->pool, &hname, tmp.ptr, tmp.slen, NULL); 210 210 if (r == NULL) { 211 211 pjsua_perror(THIS_FILE, "Invalid URI in account route set", … … 257 257 pjsua_acc_id *p_acc_id) 258 258 { 259 pjsua_acc *acc; 259 260 unsigned id; 260 261 pj_status_t status; … … 278 279 {PJSUA_UNLOCK(); return PJ_EBUG;}); 279 280 281 acc = &pjsua_var.acc[id]; 282 283 /* Create pool for this account. */ 284 if (acc->pool) 285 pj_pool_reset(acc->pool); 286 else 287 acc->pool = pjsua_pool_create("acc%p", 512, 256); 288 280 289 /* Copy config */ 281 pjsua_acc_config_dup( pjsua_var.pool, &pjsua_var.acc[id].cfg, cfg);290 pjsua_acc_config_dup(acc->pool, &pjsua_var.acc[id].cfg, cfg); 282 291 283 292 /* Normalize registration timeout */ … … 291 300 if (status != PJ_SUCCESS) { 292 301 pjsua_perror(THIS_FILE, "Error adding account", status); 302 pj_pool_release(acc->pool); 303 acc->pool = NULL; 293 304 PJSUA_UNLOCK(); 294 305 return status; … … 400 411 pjsua_pres_delete_acc(acc_id); 401 412 413 /* Release account pool */ 414 if (pjsua_var.acc[acc_id].pool) { 415 pj_pool_release(pjsua_var.acc[acc_id].pool); 416 pjsua_var.acc[acc_id].pool = NULL; 417 } 418 402 419 /* Invalidate */ 403 420 pjsua_var.acc[acc_id].valid = PJ_FALSE; … … 472 489 PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, PJ_EINVALIDOP); 473 490 491 PJSUA_LOCK(); 474 492 pjsua_var.acc[acc_id].online_status = is_online; 475 pjrpid_element_dup(pjsua_var.pool, &pjsua_var.acc[acc_id].rpid, pr); 493 pjrpid_element_dup(pjsua_var.acc[acc_id].pool, &pjsua_var.acc[acc_id].rpid, pr); 494 PJSUA_UNLOCK(); 495 476 496 pjsua_pres_update_acc(acc_id, PJ_TRUE); 477 497 return PJ_SUCCESS; … … 595 615 return PJ_FALSE; 596 616 } 597 pj_strdup2( pjsua_var.pool, &acc->contact, tmp);617 pj_strdup2(acc->pool, &acc->contact, tmp); 598 618 } 599 619 … … 703 723 /* Then append the Service-Route URIs */ 704 724 for (i=0; i<uri_cnt; ++i) { 705 hr = pjsip_route_hdr_create( pjsua_var.pool);706 hr->name_addr.uri = (pjsip_uri*)pjsip_uri_clone( pjsua_var.pool, uri[i]);725 hr = pjsip_route_hdr_create(acc->pool); 726 hr->name_addr.uri = (pjsip_uri*)pjsip_uri_clone(acc->pool, uri[i]); 707 727 pj_list_push_back(&acc->route_set, hr); 708 728 } … … 983 1003 } 984 1004 985 pj_strdup_with_null( pjsua_var.pool, &acc->contact, &tmp_contact);1005 pj_strdup_with_null(acc->pool, &acc->contact, &tmp_contact); 986 1006 } 987 1007 … … 1268 1288 pjsip_uri *uri; 1269 1289 pjsip_sip_uri *sip_uri; 1290 pj_pool_t *tmp_pool; 1270 1291 unsigned i; 1271 1292 1272 1293 PJSUA_LOCK(); 1273 1294 1274 PJ_TODO(dont_use_pjsua_pool);1275 1276 pj_strdup_with_null( pjsua_var.pool, &tmp, url);1277 1278 uri = pjsip_parse_uri( pjsua_var.pool, tmp.ptr, tmp.slen, 0);1295 tmp_pool = pjsua_pool_create("tmpacc10", 256, 256); 1296 1297 pj_strdup_with_null(tmp_pool, &tmp, url); 1298 1299 uri = pjsip_parse_uri(tmp_pool, tmp.ptr, tmp.slen, 0); 1279 1300 if (!uri) { 1301 pj_pool_release(tmp_pool); 1280 1302 PJSUA_UNLOCK(); 1281 1303 return pjsua_var.default_acc; … … 1295 1317 if (i != PJ_ARRAY_SIZE(pjsua_var.acc)) { 1296 1318 /* Found rather matching account */ 1319 pj_pool_release(tmp_pool); 1297 1320 PJSUA_UNLOCK(); 1298 return 0;1321 return i; 1299 1322 } 1300 1323 1301 1324 /* Not found, use default account */ 1325 pj_pool_release(tmp_pool); 1302 1326 PJSUA_UNLOCK(); 1303 1327 return pjsua_var.default_acc; … … 1312 1336 pjsua_var.acc[acc_id].srv_port == sip_uri->port) 1313 1337 { 1338 pj_pool_release(tmp_pool); 1314 1339 PJSUA_UNLOCK(); 1315 1340 return acc_id; … … 1322 1347 if (pj_stricmp(&pjsua_var.acc[acc_id].srv_domain, &sip_uri->host)==0) 1323 1348 { 1349 pj_pool_release(tmp_pool); 1324 1350 PJSUA_UNLOCK(); 1325 1351 return acc_id; … … 1329 1355 1330 1356 /* Still no match, just use default account */ 1357 pj_pool_release(tmp_pool); 1331 1358 PJSUA_UNLOCK(); 1332 1359 return pjsua_var.default_acc;
Note: See TracChangeset
for help on using the changeset viewer.