summaryrefslogtreecommitdiff
path: root/pjsip-apps/src/pjsua_wince/pjsua_wince.cpp
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-10-12 12:14:27 +0000
committerBenny Prijono <bennylp@teluu.com>2007-10-12 12:14:27 +0000
commitb0f62471ea72f5767d859f18e41d4326f57b85c5 (patch)
tree5be22dd454663b8e8daee9e322ed794ccf54e8c4 /pjsip-apps/src/pjsua_wince/pjsua_wince.cpp
parent9ca491d9d373e4f9114b429bcd61b72b1ff97048 (diff)
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
Diffstat (limited to 'pjsip-apps/src/pjsua_wince/pjsua_wince.cpp')
-rw-r--r--pjsip-apps/src/pjsua_wince/pjsua_wince.cpp23
1 files changed, 22 insertions, 1 deletions
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;
}