Changeset 3753 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
- Timestamp:
- Sep 18, 2011 2:59:56 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
r3553 r3753 390 390 PJ_ETOOMANY); 391 391 392 PJ_LOG(4,(THIS_FILE, "Adding buddy: %.*s", 393 (int)cfg->uri.slen, cfg->uri.ptr)); 394 pj_log_push_indent(); 395 392 396 PJSUA_LOCK(); 393 397 … … 403 407 /* This shouldn't happen */ 404 408 pj_assert(!"index < PJ_ARRAY_SIZE(pjsua_var.buddy)"); 409 pj_log_pop_indent(); 405 410 return PJ_ETOOMANY; 406 411 } … … 432 437 buddy->pool = NULL; 433 438 PJSUA_UNLOCK(); 439 pj_log_pop_indent(); 434 440 return PJSIP_EINVALIDURI; 435 441 } … … 440 446 buddy->pool = NULL; 441 447 PJSUA_UNLOCK(); 448 pj_log_pop_indent(); 442 449 return PJSIP_EINVALIDSCHEME; 443 450 } … … 470 477 PJSUA_UNLOCK(); 471 478 479 PJ_LOG(4,(THIS_FILE, "Buddy %d added.", index)); 480 472 481 pjsua_buddy_subscribe_pres(index, cfg->subscribe); 473 482 483 pj_log_pop_indent(); 474 484 return PJ_SUCCESS; 475 485 } … … 495 505 if (status != PJ_SUCCESS) 496 506 return status; 507 508 PJ_LOG(4,(THIS_FILE, "Buddy %d: deleting..", buddy_id)); 509 pj_log_push_indent(); 497 510 498 511 /* Unsubscribe presence */ … … 519 532 520 533 unlock_buddy(&lck); 534 pj_log_pop_indent(); 521 535 return PJ_SUCCESS; 522 536 } … … 538 552 return status; 539 553 554 PJ_LOG(4,(THIS_FILE, "Buddy %d: unsubscribing presence..", buddy_id)); 555 pj_log_push_indent(); 556 540 557 lck.buddy->monitor = subscribe; 541 558 … … 543 560 544 561 unlock_buddy(&lck); 562 pj_log_pop_indent(); 545 563 return PJ_SUCCESS; 546 564 } … … 560 578 if (status != PJ_SUCCESS) 561 579 return status; 580 581 PJ_LOG(4,(THIS_FILE, "Buddy %d: updating presence..", buddy_id)); 582 pj_log_push_indent(); 562 583 563 584 /* Is this an unsubscribe request? */ … … 565 586 unsubscribe_buddy_presence(buddy_id); 566 587 unlock_buddy(&lck); 588 pj_log_pop_indent(); 567 589 return PJ_SUCCESS; 568 590 } … … 571 593 if (lck.buddy->sub) { 572 594 unlock_buddy(&lck); 595 pj_log_pop_indent(); 573 596 return PJ_SUCCESS; 574 597 } … … 578 601 579 602 unlock_buddy(&lck); 580 603 pj_log_pop_indent(); 581 604 return PJ_SUCCESS; 582 605 } … … 746 769 PJ_LOG(4,(THIS_FILE, "Server subscription to %s is %s", 747 770 uapres->remote, pjsip_evsub_get_state_name(sub))); 771 pj_log_push_indent(); 748 772 749 773 state = pjsip_evsub_get_state(sub); … … 762 786 pj_list_erase(uapres); 763 787 } 788 pj_log_pop_indent(); 764 789 } 765 790 … … 807 832 PJ_LOG(4,(THIS_FILE, "Creating server subscription, using account %d", 808 833 acc_id)); 834 pj_log_push_indent(); 809 835 810 836 /* Create suitable Contact header */ … … 820 846 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 400, NULL, 821 847 NULL, NULL); 848 pj_log_pop_indent(); 822 849 return PJ_TRUE; 823 850 } … … 834 861 pjsip_endpt_respond_stateless(pjsua_var.endpt, rdata, 400, NULL, 835 862 NULL, NULL); 863 pj_log_pop_indent(); 836 864 return PJ_TRUE; 837 865 } … … 865 893 866 894 PJSUA_UNLOCK(); 895 pj_log_pop_indent(); 867 896 return PJ_TRUE; 868 897 } … … 935 964 pjsip_pres_terminate(sub, PJ_FALSE); 936 965 PJSUA_UNLOCK(); 966 pj_log_pop_indent(); 937 967 return PJ_FALSE; 938 968 } … … 953 983 pjsip_pres_terminate(sub, PJ_FALSE); 954 984 PJSUA_UNLOCK(); 985 pj_log_pop_indent(); 955 986 return PJ_TRUE; 956 987 } … … 964 995 pjsip_pres_terminate(sub, PJ_FALSE); 965 996 PJSUA_UNLOCK(); 997 pj_log_pop_indent(); 966 998 return PJ_FALSE; 967 999 } … … 976 1008 977 1009 PJSUA_UNLOCK(); 978 1010 pj_log_pop_indent(); 979 1011 return PJ_TRUE; 980 1012 } … … 1007 1039 PJ_ASSERT_RETURN(pjsua_var.acc[acc_id].valid, PJ_EINVALIDOP); 1008 1040 1041 PJ_LOG(4,(THIS_FILE, "Acc %d: sending NOTIFY for srv_pres=0x%p..", 1042 acc_id, (int)(long)srv_pres)); 1043 pj_log_push_indent(); 1044 1009 1045 PJSUA_LOCK(); 1010 1046 … … 1015 1051 /* Subscription has been terminated */ 1016 1052 PJSUA_UNLOCK(); 1053 pj_log_pop_indent(); 1017 1054 return PJ_EINVALIDOP; 1018 1055 } … … 1056 1093 pjsip_pres_terminate(srv_pres->sub, PJ_FALSE); 1057 1094 PJSUA_UNLOCK(); 1095 pj_log_pop_indent(); 1058 1096 return status; 1059 1097 } … … 1072 1110 1073 1111 PJSUA_UNLOCK(); 1074 1112 pj_log_pop_indent(); 1075 1113 return PJ_SUCCESS; 1076 1114 } … … 1132 1170 pj_status_t status; 1133 1171 1172 PJ_LOG(5,(THIS_FILE, "Acc %d: sending %sPUBLISH..", 1173 acc_id, (active ? "" : "un-"))); 1174 pj_log_push_indent(); 1134 1175 1135 1176 /* Create PUBLISH request */ … … 1200 1241 1201 1242 acc->publish_state = acc->online_status; 1243 pj_log_pop_indent(); 1202 1244 return PJ_SUCCESS; 1203 1245 … … 1207 1249 acc->publish_sess = NULL; 1208 1250 } 1251 pj_log_pop_indent(); 1209 1252 return status; 1210 1253 } … … 1455 1498 pjsua_var.buddy[buddy->index].uri.ptr, 1456 1499 pjsip_evsub_get_state_name(sub))); 1500 pj_log_push_indent(); 1457 1501 1458 1502 if (pjsip_evsub_get_state(sub) == PJSIP_EVSUB_STATE_TERMINATED) { … … 1574 1618 pjsip_evsub_set_mod_data(sub, pjsua_var.mod.id, NULL); 1575 1619 } 1620 1621 pj_log_pop_indent(); 1576 1622 } 1577 1623 } … … 1685 1731 acc = &pjsua_var.acc[acc_id]; 1686 1732 1687 PJ_LOG(4,(THIS_FILE, "Using account %d for buddy %d subscription", 1688 acc_id, buddy_id)); 1733 PJ_LOG(4,(THIS_FILE, "Buddy %d: subscribing presence,using account %d..", 1734 buddy_id, acc_id)); 1735 pj_log_push_indent(); 1689 1736 1690 1737 /* Generate suitable Contact header unless one is already set in … … 1702 1749 status); 1703 1750 pj_pool_release(tmp_pool); 1751 pj_log_pop_indent(); 1704 1752 return; 1705 1753 } … … 1716 1764 status); 1717 1765 if (tmp_pool) pj_pool_release(tmp_pool); 1766 pj_log_pop_indent(); 1718 1767 return; 1719 1768 } … … 1735 1784 if (buddy->dlg) pjsip_dlg_dec_lock(buddy->dlg); 1736 1785 if (tmp_pool) pj_pool_release(tmp_pool); 1786 pj_log_pop_indent(); 1737 1787 return; 1738 1788 } … … 1774 1824 status); 1775 1825 if (tmp_pool) pj_pool_release(tmp_pool); 1826 pj_log_pop_indent(); 1776 1827 return; 1777 1828 } … … 1789 1840 status); 1790 1841 if (tmp_pool) pj_pool_release(tmp_pool); 1842 pj_log_pop_indent(); 1791 1843 return; 1792 1844 } … … 1794 1846 pjsip_dlg_dec_lock(buddy->dlg); 1795 1847 if (tmp_pool) pj_pool_release(tmp_pool); 1848 pj_log_pop_indent(); 1796 1849 } 1797 1850 … … 1813 1866 return; 1814 1867 } 1868 1869 PJ_LOG(5,(THIS_FILE, "Buddy %d: unsubscribing..", buddy_id)); 1870 pj_log_push_indent(); 1815 1871 1816 1872 status = pjsip_pres_initiate( buddy->sub, 0, &tdata); … … 1826 1882 status); 1827 1883 } 1884 1885 pj_log_pop_indent(); 1828 1886 } 1829 1887 … … 1915 1973 mwi_info.rdata = rdata; 1916 1974 1975 PJ_LOG(4,(THIS_FILE, "MWI got NOTIFY..")); 1976 pj_log_push_indent(); 1977 1917 1978 /* Call callback */ 1918 1979 if (pjsua_var.ua_cfg.cb.on_mwi_info) { 1919 1980 (*pjsua_var.ua_cfg.cb.on_mwi_info)(acc->index, &mwi_info); 1920 1981 } 1982 1983 pj_log_pop_indent(); 1921 1984 } 1922 1985 … … 1973 2036 1974 2037 } 2038 2039 PJ_LOG(4,(THIS_FILE, "Starting MWI subscription..")); 2040 pj_log_push_indent(); 1975 2041 1976 2042 /* Generate suitable Contact header unless one is already set in … … 1987 2053 status); 1988 2054 pj_pool_release(tmp_pool); 2055 pj_log_pop_indent(); 1989 2056 return; 1990 2057 } … … 2000 2067 pjsua_perror(THIS_FILE, "Unable to create dialog", status); 2001 2068 if (tmp_pool) pj_pool_release(tmp_pool); 2069 pj_log_pop_indent(); 2002 2070 return; 2003 2071 } … … 2015 2083 if (tmp_pool) pj_pool_release(tmp_pool); 2016 2084 if (acc->mwi_dlg) pjsip_dlg_dec_lock(acc->mwi_dlg); 2085 pj_log_pop_indent(); 2017 2086 return; 2018 2087 } … … 2055 2124 status); 2056 2125 if (tmp_pool) pj_pool_release(tmp_pool); 2126 pj_log_pop_indent(); 2057 2127 return; 2058 2128 } … … 2071 2141 status); 2072 2142 if (tmp_pool) pj_pool_release(tmp_pool); 2143 pj_log_pop_indent(); 2073 2144 return; 2074 2145 } … … 2077 2148 if (tmp_pool) pj_pool_release(tmp_pool); 2078 2149 2150 pj_log_pop_indent(); 2079 2151 } 2080 2152 … … 2106 2178 } 2107 2179 2180 PJ_LOG(4,(THIS_FILE, "Got unsolicited NOTIFY from %s:%d..", 2181 rdata->pkt_info.src_name, rdata->pkt_info.src_port)); 2182 pj_log_push_indent(); 2183 2108 2184 /* Got unsolicited MWI request, respond with 200/OK first */ 2109 2185 pjsip_endpt_respond(pjsua_get_pjsip_endpt(), NULL, rdata, 200, NULL, … … 2124 2200 } 2125 2201 2126 2202 pj_log_pop_indent(); 2127 2203 return PJ_TRUE; 2128 2204 } … … 2254 2330 2255 2331 PJ_LOG(4,(THIS_FILE, "Shutting down presence..")); 2332 pj_log_push_indent(); 2256 2333 2257 2334 if (pjsua_var.pres_timer.id != 0) { … … 2276 2353 pjsua_pres_update_acc(i, PJ_FALSE); 2277 2354 } 2278 } 2355 2356 pj_log_pop_indent(); 2357 }
Note: See TracChangeset
for help on using the changeset viewer.