Changeset 4580 for pjproject/trunk
- Timestamp:
- Aug 6, 2013 8:02:24 AM (11 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r4525 r4580 1280 1280 pjsua_transport_config tcp_cfg; 1281 1281 unsigned i; 1282 pj_pool_t *tmp_pool; 1282 1283 pj_status_t status; 1283 1284 … … 1289 1290 /* Create pool for application */ 1290 1291 app_config.pool = pjsua_pool_create("pjsua-app", 1000, 1000); 1292 tmp_pool = pjsua_pool_create("tmp-pjsua", 1000, 1000);; 1291 1293 1292 1294 /* Init CLI & its FE settings */ … … 1300 1302 /** Parse args **/ 1301 1303 status = load_config(app_cfg.argc, app_cfg.argv, &uri_arg); 1302 if (status != PJ_SUCCESS) 1304 if (status != PJ_SUCCESS) { 1305 pj_pool_release(tmp_pool); 1303 1306 return status; 1307 } 1304 1308 1305 1309 /* Initialize application callbacks */ … … 1340 1344 status = pjsua_init(&app_config.cfg, &app_config.log_cfg, 1341 1345 &app_config.media_cfg); 1342 if (status != PJ_SUCCESS) 1346 if (status != PJ_SUCCESS) { 1347 pj_pool_release(tmp_pool); 1343 1348 return status; 1349 } 1344 1350 1345 1351 /* Initialize our module to handle otherwise unhandled request */ … … 1588 1594 if (PJMEDIA_HAS_VIDEO) { 1589 1595 pjsua_acc_config acc_cfg; 1590 pjsua_acc_get_config(aid, &acc_cfg);1596 pjsua_acc_get_config(aid, tmp_pool, &acc_cfg); 1591 1597 app_config_init_video(&acc_cfg); 1592 1598 pjsua_acc_modify(aid, &acc_cfg); … … 1627 1633 if (PJMEDIA_HAS_VIDEO) { 1628 1634 pjsua_acc_config acc_cfg; 1629 pjsua_acc_get_config(aid, &acc_cfg);1635 pjsua_acc_get_config(aid, tmp_pool, &acc_cfg); 1630 1636 app_config_init_video(&acc_cfg); 1631 1637 if (app_config.ipv6) … … 1661 1667 if (PJMEDIA_HAS_VIDEO) { 1662 1668 pjsua_acc_config acc_cfg; 1663 pjsua_acc_get_config(aid, &acc_cfg);1669 pjsua_acc_get_config(aid, tmp_pool, &acc_cfg); 1664 1670 app_config_init_video(&acc_cfg); 1665 1671 pjsua_acc_modify(aid, &acc_cfg); … … 1686 1692 if (PJMEDIA_HAS_VIDEO) { 1687 1693 pjsua_acc_config acc_cfg; 1688 pjsua_acc_get_config(aid, &acc_cfg);1694 pjsua_acc_get_config(aid, tmp_pool, &acc_cfg); 1689 1695 app_config_init_video(&acc_cfg); 1690 1696 if (app_config.ipv6) … … 1721 1727 if (PJMEDIA_HAS_VIDEO) { 1722 1728 pjsua_acc_config acc_cfg; 1723 pjsua_acc_get_config(acc_id, &acc_cfg);1729 pjsua_acc_get_config(acc_id, tmp_pool, &acc_cfg); 1724 1730 app_config_init_video(&acc_cfg); 1725 1731 pjsua_acc_modify(acc_id, &acc_cfg); … … 1745 1751 if (PJMEDIA_HAS_VIDEO) { 1746 1752 pjsua_acc_config acc_cfg; 1747 pjsua_acc_get_config(aid, &acc_cfg);1753 pjsua_acc_get_config(aid, tmp_pool, &acc_cfg); 1748 1754 app_config_init_video(&acc_cfg); 1749 1755 if (app_config.ipv6) … … 1830 1836 call_opt.vid_cnt = app_config.vid.vid_cnt; 1831 1837 1838 pj_pool_release(tmp_pool); 1832 1839 return PJ_SUCCESS; 1833 1840 1834 1841 on_error: 1842 pj_pool_release(tmp_pool); 1835 1843 app_destroy(); 1836 1844 return status; -
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_cli.c
r4537 r4580 2109 2109 { 2110 2110 pjsua_acc_config acc_cfg; 2111 pj_pool_t *pool = pjsua_pool_create("tmp-pjsua", 1000, 1000); 2111 2112 2112 pjsua_acc_get_config(current_acc, &acc_cfg);2113 pjsua_acc_get_config(current_acc, pool, &acc_cfg); 2113 2114 app_config_show_video(current_acc, &acc_cfg); 2115 pj_pool_release(pool); 2114 2116 return PJ_SUCCESS; 2115 2117 } … … 2119 2121 pjsua_acc_config acc_cfg; 2120 2122 pj_cli_cmd_id cmd_id = pj_cli_get_cmd_id(cval->cmd); 2123 pj_pool_t *pool = pjsua_pool_create("tmp-pjsua", 1000, 1000); 2121 2124 2122 2125 CHECK_PJSUA_RUNNING(); 2123 2126 2124 pjsua_acc_get_config(current_acc, &acc_cfg);2127 pjsua_acc_get_config(current_acc, pool, &acc_cfg); 2125 2128 2126 2129 switch(cmd_id) { … … 2149 2152 } 2150 2153 modify_video_account(&acc_cfg); 2154 pj_pool_release(pool); 2151 2155 return PJ_SUCCESS; 2152 2156 } -
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app_legacy.c
r4537 r4580 313 313 pjsua_acc_config acc_cfg; 314 314 pj_bool_t changed = PJ_FALSE; 315 316 pjsua_acc_get_config(current_acc, &acc_cfg); 315 pj_pool_t *tmp_pool = pjsua_pool_create("tmp-pjsua", 1000, 1000); 316 317 pjsua_acc_get_config(current_acc, tmp_pool, &acc_cfg); 317 318 318 319 if (argc == 3 && strcmp(argv[2], "show")==0) { … … 335 336 changed = PJ_TRUE; 336 337 } else { 338 pj_pool_release(tmp_pool); 337 339 goto on_error; 338 340 } … … 344 346 current_acc)); 345 347 } 348 pj_pool_release(tmp_pool); 346 349 347 350 } else if (strcmp(argv[1], "call")==0) { -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r4555 r4580 3590 3590 * 3591 3591 * @param acc_id The account ID. 3592 * @param pool Pool to duplicate the config. 3592 3593 * @param acc_cfg Structure to receive the settings. 3593 3594 * … … 3595 3596 */ 3596 3597 PJ_DECL(pj_status_t) pjsua_acc_get_config(pjsua_acc_id acc_id, 3598 pj_pool_t *pool, 3597 3599 pjsua_acc_config *acc_cfg); 3598 3600 -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
r4579 r4580 686 686 /* Get config */ 687 687 PJ_DEF(pj_status_t) pjsua_acc_get_config(pjsua_acc_id acc_id, 688 pj_pool_t *pool, 688 689 pjsua_acc_config *acc_cfg) 689 690 { 690 691 PJ_ASSERT_RETURN(acc_id>=0 && acc_id<(int)PJ_ARRAY_SIZE(pjsua_var.acc) 691 692 && pjsua_var.acc[acc_id].valid, PJ_EINVAL); 692 pj_memcpy(acc_cfg, &pjsua_var.acc[acc_id].cfg, sizeof(*acc_cfg)); 693 //this now would not work due to corrupt header list 694 //pj_memcpy(acc_cfg, &pjsua_var.acc[acc_id].cfg, sizeof(*acc_cfg)); 695 pjsua_acc_config_dup(pool, acc_cfg, &pjsua_var.acc[acc_id].cfg); 693 696 return PJ_SUCCESS; 697 } 698 699 /* Compare two SIP headers. Return zero if equal */ 700 static int pjsip_hdr_cmp(const pjsip_hdr *h1, const pjsip_hdr *h2) 701 { 702 char buf1[PJSIP_MAX_URL_SIZE]; 703 char buf2[PJSIP_MAX_URL_SIZE]; 704 pj_str_t p1, p2; 705 706 p1.ptr = buf1; 707 p1.slen = 0; 708 p2.ptr = buf2; 709 p2.slen = 0; 710 711 p1.slen = pjsip_hdr_print_on((void*)h1, buf1, sizeof(buf1)); 712 if (p1.slen < 0) 713 p1.slen = 0; 714 p2.slen = pjsip_hdr_print_on((void*)h2, buf2, sizeof(buf2)); 715 if (p2.slen < 0) 716 p2.slen = 0; 717 718 return pj_strcmp(&p1, &p2); 719 } 720 721 /* Update SIP header list from another list. Return PJ_TRUE if 722 * the list has been updated */ 723 static pj_bool_t update_hdr_list(pj_pool_t *pool, pjsip_hdr *dst, 724 const pjsip_hdr *src) 725 { 726 pjsip_hdr *dst_i; 727 const pjsip_hdr *src_i; 728 pj_bool_t changed = PJ_FALSE; 729 730 /* Remove header that's no longer needed */ 731 for (dst_i = dst->next; dst_i != dst; ) { 732 for (src_i = src->next; src_i != src; src_i = src_i->next) { 733 if (pjsip_hdr_cmp(dst_i, src_i) == 0) 734 break; 735 } 736 if (src_i == src) { 737 pjsip_hdr *next = dst_i->next; 738 pj_list_erase(dst_i); 739 changed = PJ_TRUE; 740 dst_i = next; 741 } else { 742 dst_i = dst_i->next; 743 } 744 } 745 746 /* Add new header */ 747 for (src_i = src->next; src_i != src; src_i = src_i->next) { 748 for (dst_i = dst->next; dst_i != dst; dst_i = dst_i->next) { 749 if (pjsip_hdr_cmp(dst_i, src_i) == 0) 750 break; 751 } 752 if (dst_i == dst) { 753 dst_i = pjsip_hdr_clone(pool, src_i); 754 pj_list_push_back(dst, dst_i); 755 changed = PJ_TRUE; 756 } 757 } 758 759 return changed; 694 760 } 695 761 … … 778 844 reg_sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri(reg_uri); 779 845 } 846 847 /* REGISTER header list */ 848 if (update_hdr_list(acc->pool, &acc->cfg.reg_hdr_list, &cfg->reg_hdr_list)) { 849 update_reg = PJ_TRUE; 850 unreg_first = PJ_TRUE; 851 } 852 853 /* SUBSCRIBE header list */ 854 update_hdr_list(acc->pool, &acc->cfg.sub_hdr_list, &cfg->sub_hdr_list); 780 855 781 856 /* Global outbound proxy */
Note: See TracChangeset
for help on using the changeset viewer.