Ignore:
Timestamp:
Apr 2, 2007 8:43:06 PM (17 years ago)
Author:
bennylp
Message:

Added pjsua_dump(), and fix STUN DNS SRV resolution error in pjsua

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r1134 r1135  
    744744        if (pjsua_var.ua_cfg.stun_domain.slen) { 
    745745            pj_str_t res_type; 
     746            pj_status_t status; 
    746747 
    747748            /* Fail if resolver is not configured */ 
     
    753754            } 
    754755            res_type = pj_str("_stun._udp"); 
    755             pjsua_var.stun_status =  
     756            status =  
    756757                pj_dns_srv_resolve(&pjsua_var.ua_cfg.stun_domain, &res_type, 
    757758                                   3478, pjsua_var.pool, pjsua_var.resolver, 
    758                                    0, NULL, stun_dns_srv_resolver_cb); 
    759             if (pjsua_var.stun_status != PJ_SUCCESS) { 
     759                                   0, NULL, &stun_dns_srv_resolver_cb); 
     760            if (status != PJ_SUCCESS) { 
    760761                pjsua_perror(THIS_FILE, "Error starting DNS SRV resolution",  
    761762                             pjsua_var.stun_status); 
     763                pjsua_var.stun_status = status; 
    762764                return pjsua_var.stun_status; 
     765            } else { 
     766                pjsua_var.stun_status = PJ_EPENDING; 
    763767            } 
    764768        } 
     
    16911695    return p ? 0 : -1; 
    16921696} 
     1697 
     1698 
     1699/* 
     1700 * This is a utility function to dump the stack states to log, using 
     1701 * verbosity level 3. 
     1702 */ 
     1703PJ_DEF(void) pjsua_dump(pj_bool_t detail) 
     1704{ 
     1705    unsigned old_decor; 
     1706    unsigned i; 
     1707    char buf[1024]; 
     1708 
     1709    PJ_LOG(3,(THIS_FILE, "Start dumping application states:")); 
     1710 
     1711    old_decor = pj_log_get_decor(); 
     1712    pj_log_set_decor(old_decor & (PJ_LOG_HAS_NEWLINE | PJ_LOG_HAS_CR)); 
     1713 
     1714    if (detail) 
     1715        pj_dump_config(); 
     1716 
     1717    pjsip_endpt_dump(pjsua_get_pjsip_endpt(), detail); 
     1718 
     1719    pjmedia_endpt_dump(pjsua_get_pjmedia_endpt()); 
     1720 
     1721    PJ_LOG(3,(THIS_FILE, "Dumping media transports:")); 
     1722    for (i=0; i<pjsua_var.ua_cfg.max_calls; ++i) { 
     1723        pjsua_call *call = &pjsua_var.calls[i]; 
     1724        pjmedia_sock_info skinfo; 
     1725 
     1726        pjmedia_transport_get_info(call->med_tp, &skinfo); 
     1727 
     1728        PJ_LOG(3,(THIS_FILE, " %s: %s:%d", 
     1729                  (pjsua_var.media_cfg.enable_ice ? "ICE" : "UDP"), 
     1730                  pj_inet_ntoa(skinfo.rtp_addr_name.sin_addr), 
     1731                  (int)pj_ntohs(skinfo.rtp_addr_name.sin_port))); 
     1732    } 
     1733 
     1734    pjsip_tsx_layer_dump(detail); 
     1735    pjsip_ua_dump(detail); 
     1736 
     1737 
     1738    /* Dump all invite sessions: */ 
     1739    PJ_LOG(3,(THIS_FILE, "Dumping invite sessions:")); 
     1740 
     1741    if (pjsua_call_get_count() == 0) { 
     1742 
     1743        PJ_LOG(3,(THIS_FILE, "  - no sessions -")); 
     1744 
     1745    } else { 
     1746        unsigned i; 
     1747 
     1748        for (i=0; i<pjsua_var.ua_cfg.max_calls; ++i) { 
     1749            if (pjsua_call_is_active(i)) { 
     1750                pjsua_call_dump(i, detail, buf, sizeof(buf), "  "); 
     1751                PJ_LOG(3,(THIS_FILE, "%s", buf)); 
     1752            } 
     1753        } 
     1754    } 
     1755 
     1756    /* Dump presence status */ 
     1757    pjsua_pres_dump(detail); 
     1758 
     1759    pj_log_set_decor(old_decor); 
     1760    PJ_LOG(3,(THIS_FILE, "Dump complete")); 
     1761} 
     1762 
Note: See TracChangeset for help on using the changeset viewer.