Changeset 3106 for pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
- Timestamp:
- Feb 24, 2010 5:43:34 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
r3093 r3106 2789 2789 2790 2790 /* 2791 * Transport status notification 2792 */ 2793 static pj_bool_t on_transport_state(pjsip_transport *tp, pj_uint32_t state, 2794 const pjsip_transport_state_info *info) 2795 { 2796 char host_port[128]; 2797 2798 pj_ansi_snprintf(host_port, sizeof(host_port), "[%.*s:%d]", 2799 (int)tp->remote_name.host.slen, 2800 tp->remote_name.host.ptr, 2801 tp->remote_name.port); 2802 2803 if (state & PJSIP_TP_STATE_CONNECTED) { 2804 PJ_LOG(3,(THIS_FILE, "SIP transport %s is connected to %s", 2805 tp->type_name, host_port)); 2806 } 2807 else if (state & PJSIP_TP_STATE_ACCEPTED) { 2808 PJ_LOG(3,(THIS_FILE, "SIP transport %s accepted %s", 2809 tp->type_name, host_port)); 2810 } 2811 else if (state & PJSIP_TP_STATE_DISCONNECTED) { 2812 char buf[100]; 2813 2814 snprintf(buf, sizeof(buf), "SIP transport %s is disconnected from %s", 2815 tp->type_name, host_port); 2816 pjsua_perror(THIS_FILE, buf, info->status); 2817 } 2818 else if (state & PJSIP_TP_STATE_REJECTED) { 2819 char buf[100]; 2820 2821 snprintf(buf, sizeof(buf), "SIP transport %s rejected %s", 2822 tp->type_name, host_port); 2823 pjsua_perror(THIS_FILE, buf, info->status); 2824 } 2825 2826 #if defined(PJSIP_HAS_TLS_TRANSPORT) && PJSIP_HAS_TLS_TRANSPORT!=0 2827 2828 if (!pj_ansi_stricmp(tp->type_name, "tls") && info->ext_info && 2829 (state == PJSIP_TP_STATE_CONNECTED || 2830 (state & PJSIP_TP_STATE_TLS_VERIF_ERROR))) 2831 { 2832 pjsip_tls_state_info *tls_info = (pjsip_tls_state_info*)info->ext_info; 2833 pj_ssl_sock_info *ssl_sock_info = (pj_ssl_sock_info*) 2834 tls_info->ssl_sock_info; 2835 char buf[2048]; 2836 const char *verif_msgs[32]; 2837 unsigned verif_msg_cnt; 2838 2839 /* Dump server TLS certificate */ 2840 pj_ssl_cert_info_dump(ssl_sock_info->remote_cert_info, " ", 2841 buf, sizeof(buf)); 2842 PJ_LOG(4,(THIS_FILE, "TLS cert info of %s:\n%s", host_port, buf)); 2843 2844 /* Dump server TLS certificate verification result */ 2845 verif_msg_cnt = PJ_ARRAY_SIZE(verif_msgs); 2846 pj_ssl_cert_verify_error_st(ssl_sock_info->verify_status, 2847 verif_msgs, &verif_msg_cnt); 2848 PJ_LOG(3,(THIS_FILE, "TLS cert verification result of %s : %s", 2849 host_port, 2850 (verif_msg_cnt == 1? verif_msgs[0]:""))); 2851 if (verif_msg_cnt > 1) { 2852 unsigned i; 2853 for (i = 0; i < verif_msg_cnt; ++i) 2854 PJ_LOG(3,(THIS_FILE, "- %s", verif_msgs[i])); 2855 } 2856 2857 if (state & PJSIP_TP_STATE_TLS_VERIF_ERROR && 2858 !app_config.udp_cfg.tls_setting.verify_server) 2859 { 2860 PJ_LOG(3,(THIS_FILE, "PJSUA is configured to ignore TLS cert " 2861 "verification errors")); 2862 } 2863 } 2864 2865 #endif 2866 return PJ_TRUE; 2867 } 2868 2869 /* 2791 2870 * Print buddy list. 2792 2871 */ … … 4384 4463 app_config.cfg.cb.on_nat_detect = &on_nat_detect; 4385 4464 app_config.cfg.cb.on_mwi_info = &on_mwi_info; 4465 app_config.cfg.cb.on_transport_state = &on_transport_state; 4386 4466 4387 4467 /* Set sound device latency */
Note: See TracChangeset
for help on using the changeset viewer.