From 56e13a2ee2d08c46cf873e907139ea0d6cfb984a Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Tue, 22 Apr 2008 18:32:16 +0000 Subject: Report NAT type as unknown rather than UDP blocked when test 1B failed (could happen when port 3479 is blocked). Thanks Helmut Wolf for the info. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1936 74dad513-b988-da41-8d7b-12977e46ad98 --- pjnath/src/pjnath/nat_detect.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'pjnath/src') diff --git a/pjnath/src/pjnath/nat_detect.c b/pjnath/src/pjnath/nat_detect.c index 7eef39ec..cbe10503 100644 --- a/pjnath/src/pjnath/nat_detect.c +++ b/pjnath/src/pjnath/nat_detect.c @@ -734,9 +734,26 @@ static void on_request_complete(pj_stun_session *stun_sess, case PJNATH_ESTUNTIMEDOUT: /* * Strangely test 1B has failed. Maybe connectivity was - * lost? + * lost? Or perhaps port 3489 (the usual port number in + * CHANGED-ADDRESS) is blocked? */ - end_session(sess, PJ_SUCCESS, PJ_STUN_NAT_TYPE_BLOCKED); + switch (sess->result[ST_TEST_3].status) { + case PJ_SUCCESS: + /* Although test 1B failed, test 3 was successful. + * It could be that port 3489 is blocked, while the + * NAT itself looks to be a Restricted one. + */ + end_session(sess, PJ_SUCCESS, + PJ_STUN_NAT_TYPE_RESTRICTED); + break; + default: + /* Can't distinguish between Symmetric and Port + * Restricted, so set the type to Unknown + */ + end_session(sess, PJ_SUCCESS, + PJ_STUN_NAT_TYPE_ERR_UNKNOWN); + break; + } break; default: /* -- cgit v1.2.3