From b0f62471ea72f5767d859f18e41d4326f57b85c5 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Fri, 12 Oct 2007 12:14:27 +0000 Subject: Ticket #399: Initial implementation of tool to perform NAT type detection/classification git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1495 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/pjsua_wince/pjsua_wince.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'pjsip-apps/src/pjsua_wince') diff --git a/pjsip-apps/src/pjsua_wince/pjsua_wince.cpp b/pjsip-apps/src/pjsua_wince/pjsua_wince.cpp index 81e47f39..0367d3b1 100644 --- a/pjsip-apps/src/pjsua_wince/pjsua_wince.cpp +++ b/pjsip-apps/src/pjsua_wince/pjsua_wince.cpp @@ -56,7 +56,7 @@ static HWND hwndActionButton, hwndExitButton; #if 0 // Use this to have the STUN server resolved normally # define STUN_DOMAIN NULL -# define STUN_SERVER "stun.fwdnet.net" +# define STUN_SERVER "192.168.0.2" #elif 0 // Use this to have the STUN server resolved with DNS SRV # define STUN_DOMAIN "iptel.org" @@ -515,6 +515,25 @@ static ATOM MyRegisterClass(HINSTANCE hInstance, LPTSTR szWindowClass) } +/* Callback upon NAT detection completion */ +static void nat_detect_cb(void *user_data, + const pj_stun_nat_detect_result *res) +{ + PJ_UNUSED_ARG(user_data); + + if (res->status != PJ_SUCCESS) { + char msg[250]; + pj_ansi_snprintf(msg, sizeof(msg), "NAT detection failed: %s", + res->status_text); + SetCallStatus(msg, pj_ansi_strlen(msg)); + } else { + char msg[250]; + pj_ansi_snprintf(msg, sizeof(msg), "NAT type is %s", + res->nat_type_name); + SetCallStatus(msg, pj_ansi_strlen(msg)); + } +} + BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { @@ -548,6 +567,8 @@ BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) CommandBar_Show(hwndCB, TRUE); SetTimer(hMainWnd, ID_POLL_TIMER, 50, NULL); + + pjsua_detect_nat_type(NULL, &nat_detect_cb); return TRUE; } -- cgit v1.2.3