Index: pjproject/trunk/build.symbian/pjsua_libU.def
===================================================================
--- pjproject/trunk/build.symbian/pjsua_libU.def	(revision 1532)
+++ pjproject/trunk/build.symbian/pjsua_libU.def	(revision 1533)
@@ -33,86 +33,88 @@
 	pjsua_call_get_info                      @ 32 NONAME
 	pjsua_call_get_max_count                 @ 33 NONAME
-	pjsua_call_get_user_data                 @ 34 NONAME
-	pjsua_call_hangup                        @ 35 NONAME
-	pjsua_call_hangup_all                    @ 36 NONAME
-	pjsua_call_has_media                     @ 37 NONAME
-	pjsua_call_is_active                     @ 38 NONAME
-	pjsua_call_make_call                     @ 39 NONAME
-	pjsua_call_reinvite                      @ 40 NONAME
-	pjsua_call_send_im                       @ 41 NONAME
-	pjsua_call_send_request                  @ 42 NONAME
-	pjsua_call_send_typing_ind               @ 43 NONAME
-	pjsua_call_set_hold                      @ 44 NONAME
-	pjsua_call_set_user_data                 @ 45 NONAME
-	pjsua_call_update                        @ 46 NONAME
-	pjsua_call_xfer                          @ 47 NONAME
-	pjsua_call_xfer_replaces                 @ 48 NONAME
-	pjsua_codec_get_param                    @ 49 NONAME
-	pjsua_codec_set_param                    @ 50 NONAME
-	pjsua_codec_set_priority                 @ 51 NONAME
-	pjsua_conf_add_port                      @ 52 NONAME
-	pjsua_conf_adjust_rx_level               @ 53 NONAME
-	pjsua_conf_adjust_tx_level               @ 54 NONAME
-	pjsua_conf_connect                       @ 55 NONAME
-	pjsua_conf_disconnect                    @ 56 NONAME
-	pjsua_conf_get_active_ports              @ 57 NONAME
-	pjsua_conf_get_max_ports                 @ 58 NONAME
-	pjsua_conf_get_port_info                 @ 59 NONAME
-	pjsua_conf_get_signal_level              @ 60 NONAME
-	pjsua_conf_remove_port                   @ 61 NONAME
-	pjsua_config_default                     @ 62 NONAME
-	pjsua_config_dup                         @ 63 NONAME
-	pjsua_create                             @ 64 NONAME
-	pjsua_destroy                            @ 65 NONAME
-	pjsua_detect_nat_type                    @ 66 NONAME
-	pjsua_dump                               @ 67 NONAME
-	pjsua_enum_accs                          @ 68 NONAME
-	pjsua_enum_buddies                       @ 69 NONAME
-	pjsua_enum_calls                         @ 70 NONAME
-	pjsua_enum_codecs                        @ 71 NONAME
-	pjsua_enum_conf_ports                    @ 72 NONAME
-	pjsua_enum_snd_devs                      @ 73 NONAME
-	pjsua_enum_transports                    @ 74 NONAME
-	pjsua_get_buddy_count                    @ 75 NONAME
-	pjsua_get_ec_tail                        @ 76 NONAME
-	pjsua_get_nat_type                       @ 77 NONAME
-	pjsua_get_pjmedia_endpt                  @ 78 NONAME
-	pjsua_get_pjsip_endpt                    @ 79 NONAME
-	pjsua_get_pool_factory                   @ 80 NONAME
-	pjsua_get_snd_dev                        @ 81 NONAME
-	pjsua_handle_events                      @ 82 NONAME
-	pjsua_im_send                            @ 83 NONAME
-	pjsua_im_typing                          @ 84 NONAME
-	pjsua_init                               @ 85 NONAME
-	pjsua_logging_config_default             @ 86 NONAME
-	pjsua_logging_config_dup                 @ 87 NONAME
-	pjsua_media_config_default               @ 88 NONAME
-	pjsua_media_transports_create            @ 89 NONAME
-	pjsua_msg_data_init                      @ 90 NONAME
-	pjsua_perror                             @ 91 NONAME
-	pjsua_player_create                      @ 92 NONAME
-	pjsua_player_destroy                     @ 93 NONAME
-	pjsua_player_get_conf_port               @ 94 NONAME
-	pjsua_player_get_port                    @ 95 NONAME
-	pjsua_player_set_pos                     @ 96 NONAME
-	pjsua_playlist_create                    @ 97 NONAME
-	pjsua_pool_create                        @ 98 NONAME
-	pjsua_pres_dump                          @ 99 NONAME
-	pjsua_reconfigure_logging                @ 100 NONAME
-	pjsua_recorder_create                    @ 101 NONAME
-	pjsua_recorder_destroy                   @ 102 NONAME
-	pjsua_recorder_get_conf_port             @ 103 NONAME
-	pjsua_recorder_get_port                  @ 104 NONAME
-	pjsua_set_ec                             @ 105 NONAME
-	pjsua_set_no_snd_dev                     @ 106 NONAME
-	pjsua_set_null_snd_dev                   @ 107 NONAME
-	pjsua_set_snd_dev                        @ 108 NONAME
-	pjsua_start                              @ 109 NONAME
-	pjsua_transport_close                    @ 110 NONAME
-	pjsua_transport_config_default           @ 111 NONAME
-	pjsua_transport_config_dup               @ 112 NONAME
-	pjsua_transport_create                   @ 113 NONAME
-	pjsua_transport_get_info                 @ 114 NONAME
-	pjsua_transport_register                 @ 115 NONAME
-	pjsua_transport_set_enable               @ 116 NONAME
-	pjsua_verify_sip_url                     @ 117 NONAME
+	pjsua_call_get_rem_nat_type              @ 34 NONAME
+	pjsua_call_get_user_data                 @ 35 NONAME
+	pjsua_call_hangup                        @ 36 NONAME
+	pjsua_call_hangup_all                    @ 37 NONAME
+	pjsua_call_has_media                     @ 38 NONAME
+	pjsua_call_is_active                     @ 39 NONAME
+	pjsua_call_make_call                     @ 40 NONAME
+	pjsua_call_reinvite                      @ 41 NONAME
+	pjsua_call_send_im                       @ 42 NONAME
+	pjsua_call_send_request                  @ 43 NONAME
+	pjsua_call_send_typing_ind               @ 44 NONAME
+	pjsua_call_set_hold                      @ 45 NONAME
+	pjsua_call_set_user_data                 @ 46 NONAME
+	pjsua_call_update                        @ 47 NONAME
+	pjsua_call_xfer                          @ 48 NONAME
+	pjsua_call_xfer_replaces                 @ 49 NONAME
+	pjsua_codec_get_param                    @ 50 NONAME
+	pjsua_codec_set_param                    @ 51 NONAME
+	pjsua_codec_set_priority                 @ 52 NONAME
+	pjsua_conf_add_port                      @ 53 NONAME
+	pjsua_conf_adjust_rx_level               @ 54 NONAME
+	pjsua_conf_adjust_tx_level               @ 55 NONAME
+	pjsua_conf_connect                       @ 56 NONAME
+	pjsua_conf_disconnect                    @ 57 NONAME
+	pjsua_conf_get_active_ports              @ 58 NONAME
+	pjsua_conf_get_max_ports                 @ 59 NONAME
+	pjsua_conf_get_port_info                 @ 60 NONAME
+	pjsua_conf_get_signal_level              @ 61 NONAME
+	pjsua_conf_remove_port                   @ 62 NONAME
+	pjsua_config_default                     @ 63 NONAME
+	pjsua_config_dup                         @ 64 NONAME
+	pjsua_create                             @ 65 NONAME
+	pjsua_destroy                            @ 66 NONAME
+	pjsua_detect_nat_type                    @ 67 NONAME
+	pjsua_dump                               @ 68 NONAME
+	pjsua_enum_accs                          @ 69 NONAME
+	pjsua_enum_buddies                       @ 70 NONAME
+	pjsua_enum_calls                         @ 71 NONAME
+	pjsua_enum_codecs                        @ 72 NONAME
+	pjsua_enum_conf_ports                    @ 73 NONAME
+	pjsua_enum_snd_devs                      @ 74 NONAME
+	pjsua_enum_transports                    @ 75 NONAME
+	pjsua_get_buddy_count                    @ 76 NONAME
+	pjsua_get_ec_tail                        @ 77 NONAME
+	pjsua_get_nat_type                       @ 78 NONAME
+	pjsua_get_pjmedia_endpt                  @ 79 NONAME
+	pjsua_get_pjsip_endpt                    @ 80 NONAME
+	pjsua_get_pool_factory                   @ 81 NONAME
+	pjsua_get_snd_dev                        @ 82 NONAME
+	pjsua_get_var                            @ 83 NONAME
+	pjsua_handle_events                      @ 84 NONAME
+	pjsua_im_send                            @ 85 NONAME
+	pjsua_im_typing                          @ 86 NONAME
+	pjsua_init                               @ 87 NONAME
+	pjsua_logging_config_default             @ 88 NONAME
+	pjsua_logging_config_dup                 @ 89 NONAME
+	pjsua_media_config_default               @ 90 NONAME
+	pjsua_media_transports_create            @ 91 NONAME
+	pjsua_msg_data_init                      @ 92 NONAME
+	pjsua_perror                             @ 93 NONAME
+	pjsua_player_create                      @ 94 NONAME
+	pjsua_player_destroy                     @ 95 NONAME
+	pjsua_player_get_conf_port               @ 96 NONAME
+	pjsua_player_get_port                    @ 97 NONAME
+	pjsua_player_set_pos                     @ 98 NONAME
+	pjsua_playlist_create                    @ 99 NONAME
+	pjsua_pool_create                        @ 100 NONAME
+	pjsua_pres_dump                          @ 101 NONAME
+	pjsua_reconfigure_logging                @ 102 NONAME
+	pjsua_recorder_create                    @ 103 NONAME
+	pjsua_recorder_destroy                   @ 104 NONAME
+	pjsua_recorder_get_conf_port             @ 105 NONAME
+	pjsua_recorder_get_port                  @ 106 NONAME
+	pjsua_set_ec                             @ 107 NONAME
+	pjsua_set_no_snd_dev                     @ 108 NONAME
+	pjsua_set_null_snd_dev                   @ 109 NONAME
+	pjsua_set_snd_dev                        @ 110 NONAME
+	pjsua_start                              @ 111 NONAME
+	pjsua_transport_close                    @ 112 NONAME
+	pjsua_transport_config_default           @ 113 NONAME
+	pjsua_transport_config_dup               @ 114 NONAME
+	pjsua_transport_create                   @ 115 NONAME
+	pjsua_transport_get_info                 @ 116 NONAME
+	pjsua_transport_register                 @ 117 NONAME
+	pjsua_transport_set_enable               @ 118 NONAME
+	pjsua_verify_sip_url                     @ 119 NONAME
Index: pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 1532)
+++ pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 1533)
@@ -990,11 +990,11 @@
 
     /**
-     * Include local endpoint's NAT type in the SDP to assist troubleshooting.
-     * The valid values are:
-     *	- 0: no information will be added in SDP.
+     * Support for adding and parsing NAT type in the SDP to assist 
+     * troubleshooting. The valid values are:
+     *	- 0: no information will be added in SDP, and parsing is disabled.
      *	- 1: only the NAT type number is added.
      *	- 2: add both NAT type number and name.
      *
-     * Default: 2
+     * Default: 1
      */
     int		    nat_type_in_sdp;
@@ -1366,4 +1366,6 @@
  *			value. Other return values indicate error and
  *			\a type will be set to PJ_STUN_NAT_TYPE_ERR_UNKNOWN.
+ *
+ * @see pjsua_call_get_rem_nat_type()
  */
 PJ_DECL(pj_status_t) pjsua_get_nat_type(pj_stun_nat_type *type);
@@ -2730,4 +2732,28 @@
 PJ_DECL(void*) pjsua_call_get_user_data(pjsua_call_id call_id);
 
+
+/**
+ * Get the NAT type of remote's endpoint. This is a proprietary feature
+ * of PJSUA-LIB which sends its NAT type in the SDP when \a nat_type_in_sdp
+ * is set in #pjsua_config.
+ *
+ * This function can only be called after SDP has been received from remote,
+ * which means for incoming call, this function can be called as soon as
+ * call is received as long as incoming call contains SDP, and for outgoing
+ * call, this function can be called only after SDP is received (normally in
+ * 200/OK response to INVITE). As a general case, application should call 
+ * this function after or in \a on_call_media_state() callback.
+ *
+ * @param call_id	Call identification.
+ * @param p_type	Pointer to store the NAT type. Application can then
+ *			retrieve the string description of the NAT type
+ *			by calling pj_stun_get_nat_name().
+ *
+ * @return		PJ_SUCCESS on success.
+ *
+ * @see pjsua_get_nat_type(), nat_type_in_sdp
+ */
+PJ_DECL(pj_status_t) pjsua_call_get_rem_nat_type(pjsua_call_id call_id,
+						 pj_stun_nat_type *p_type);
 
 /**
Index: pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h
===================================================================
--- pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h	(revision 1532)
+++ pjproject/trunk/pjsip/include/pjsua-lib/pjsua_internal.h	(revision 1533)
@@ -53,4 +53,5 @@
     pj_timer_entry	 refresh_tm;/**< Timer to send re-INVITE.	    */
     pj_timer_entry	 hangup_tm; /**< Timer to hangup call.		    */
+    pj_stun_nat_type	 rem_nat_type; /**< NAT type of remote endpoint.    */
 
     char    last_text_buf_[128];    /**< Buffer for last_text.		    */
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 1532)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 1533)
@@ -99,4 +99,5 @@
     call->res_time.sec = 0;
     call->res_time.msec = 0;
+    call->rem_nat_type = PJ_STUN_NAT_TYPE_UNKNOWN;
 }
 
@@ -427,4 +428,22 @@
     PJSUA_UNLOCK();
     return status;
+}
+
+
+/* Get the NAT type information in remote's SDP */
+static void update_remote_nat_type(pjsua_call *call, 
+				   const pjmedia_sdp_session *sdp)
+{
+    const pjmedia_sdp_attr *xnat;
+
+    xnat = pjmedia_sdp_attr_find2(sdp->attr_count, sdp->attr, "X-nat", NULL);
+    if (xnat) {
+	call->rem_nat_type = (pj_stun_nat_type) (xnat->value.ptr[0] - '0');
+    } else {
+	call->rem_nat_type = PJ_STUN_NAT_TYPE_UNKNOWN;
+    }
+
+    PJ_LOG(5,(THIS_FILE, "Call %d: remote NAT type is %d (%s)", call->index,
+	      call->rem_nat_type, pj_stun_get_nat_name(call->rem_nat_type)));
 }
 
@@ -659,4 +678,11 @@
     }
 
+    /* Update NAT type of remote endpoint */
+    if (pjsua_var.ua_cfg.nat_type_in_sdp) {
+	const pjmedia_sdp_session *remote_sdp;
+
+	if (pjmedia_sdp_neg_get_neg_remote(inv->neg, &remote_sdp)==PJ_SUCCESS)
+	    update_remote_nat_type(call, remote_sdp);
+    }
 
     /* Create and attach pjsua_var data to the dialog: */
@@ -1020,4 +1046,19 @@
 		     NULL);
     return pjsua_var.calls[call_id].user_data;
+}
+
+
+/*
+ * Get remote's NAT type.
+ */
+PJ_DEF(pj_status_t) pjsua_call_get_rem_nat_type(pjsua_call_id call_id,
+						pj_stun_nat_type *p_type)
+{
+    PJ_ASSERT_RETURN(call_id>=0 && call_id<(int)pjsua_var.ua_cfg.max_calls,
+		     PJ_EINVAL);
+    PJ_ASSERT_RETURN(p_type != NULL, PJ_EINVAL);
+
+    *p_type = pjsua_var.calls[call_id].rem_nat_type;
+    return PJ_SUCCESS;
 }
 
@@ -2268,5 +2309,4 @@
     }
 
-
     status = pjmedia_sdp_neg_get_active_remote(call->inv->neg, &remote_sdp);
     if (status != PJ_SUCCESS) {
@@ -2279,4 +2319,10 @@
     }
 
+    /* Update remote's NAT type */
+    if (pjsua_var.ua_cfg.nat_type_in_sdp) {
+	update_remote_nat_type(call, remote_sdp);
+    }
+
+    /* Update media channel with the new SDP */
     status = pjsua_media_channel_update(call->index, local_sdp, remote_sdp);
     if (status != PJ_SUCCESS) {
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 1532)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 1533)
@@ -87,5 +87,5 @@
     cfg->max_calls = 4;
     cfg->thread_cnt = 1;
-    cfg->nat_type_in_sdp = 2;
+    cfg->nat_type_in_sdp = 1;
 }
 
