Index: pjproject/trunk/pjmedia/src/pjmedia/conference.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/conference.c	(revision 1928)
+++ pjproject/trunk/pjmedia/src/pjmedia/conference.c	(revision 1929)
@@ -1374,5 +1374,6 @@
 	    if (cport->channel_count != conf->channel_count) {
 		if (cport->channel_count == 1) {
-		    pjmedia_convert_channel_1ton(f.buf, f.buf,
+		    pjmedia_convert_channel_1ton((pj_int16_t*)f.buf, 
+						 (const pj_int16_t*)f.buf,
 						 conf->channel_count, 
 						 cport->samples_per_frame,
@@ -1381,5 +1382,6 @@
 					    conf->channel_count);
 		} else { /* conf->channel_count == 1 */
-		    pjmedia_convert_channel_nto1(f.buf, f.buf,
+		    pjmedia_convert_channel_nto1((pj_int16_t*)f.buf, 
+						 (const pj_int16_t*)f.buf,
 						 cport->channel_count, 
 						 cport->samples_per_frame, 
Index: pjproject/trunk/pjmedia/src/pjmedia/g711.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/g711.c	(revision 1928)
+++ pjproject/trunk/pjmedia/src/pjmedia/g711.c	(revision 1929)
@@ -584,5 +584,5 @@
 #if !PLC_DISABLED
     if (priv->plc_enabled)
-	pjmedia_plc_save( priv->plc, output->buf);
+	pjmedia_plc_save( priv->plc, (pj_int16_t*)output->buf);
 #endif
 
@@ -595,5 +595,5 @@
 				  struct pjmedia_frame *output)
 {
-    struct g711_private *priv = codec->codec_data;
+    struct g711_private *priv = (struct g711_private*) codec->codec_data;
 
     if (!priv->plc_enabled)
@@ -603,5 +603,5 @@
 		     PJMEDIA_CODEC_EPCMTOOSHORT);
 
-    pjmedia_plc_generate(priv->plc, output->buf);
+    pjmedia_plc_generate(priv->plc, (pj_int16_t*)output->buf);
     output->size = SAMPLES_PER_FRAME * 2;
 
Index: pjproject/trunk/pjmedia/src/pjmedia/stereo_port.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/stereo_port.c	(revision 1928)
+++ pjproject/trunk/pjmedia/src/pjmedia/stereo_port.c	(revision 1929)
@@ -119,5 +119,6 @@
 	tmp_frame.buf = sport->put_buf;
 	if (sport->dn_port->info.channel_count == 1) {
-	    pjmedia_convert_channel_nto1(tmp_frame.buf, frame->buf,
+	    pjmedia_convert_channel_nto1((pj_int16_t*)tmp_frame.buf, 
+					 (const pj_int16_t*)frame->buf,
 					 sport->base.info.channel_count, 
 					 sport->base.info.samples_per_frame, 
@@ -125,5 +126,6 @@
 					 0);
 	} else {
-	    pjmedia_convert_channel_1ton(tmp_frame.buf, frame->buf,
+	    pjmedia_convert_channel_1ton((pj_int16_t*)tmp_frame.buf, 
+					 (const pj_int16_t*)frame->buf,
 					 sport->dn_port->info.channel_count, 
 					 sport->base.info.samples_per_frame,
@@ -176,10 +178,12 @@
 
     if (sport->base.info.channel_count == 1) {
-	pjmedia_convert_channel_nto1(frame->buf, tmp_frame.buf,
+	pjmedia_convert_channel_nto1((pj_int16_t*)frame->buf, 
+				     (const pj_int16_t*)tmp_frame.buf,
 				     sport->dn_port->info.channel_count, 
 				     sport->dn_port->info.samples_per_frame, 
 				     (sport->options & PJMEDIA_STEREO_MIX), 0);
     } else {
-	pjmedia_convert_channel_1ton(frame->buf, tmp_frame.buf,
+	pjmedia_convert_channel_1ton((pj_int16_t*)frame->buf, 
+				     (const pj_int16_t*)tmp_frame.buf,
 				     sport->base.info.channel_count, 
 				     sport->dn_port->info.samples_per_frame,
Index: pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c
===================================================================
--- pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c	(revision 1928)
+++ pjproject/trunk/pjmedia/src/pjmedia/transport_srtp.c	(revision 1929)
@@ -212,5 +212,5 @@
 	"error while using pfkey"	    /* err_status_pfkey_err     = 24 */
     };
-    if (err >= 0 && err < PJ_ARRAY_SIZE(liberr)) {
+    if (err >= 0 && err < (int)PJ_ARRAY_SIZE(liberr)) {
 	return liberr[err];
     } else {
@@ -264,5 +264,5 @@
 PJ_DEF(void) pjmedia_srtp_setting_default(pjmedia_srtp_setting *opt)
 {
-    int i;
+    unsigned i;
 
     pj_bzero(opt, sizeof(pjmedia_srtp_setting));
@@ -289,5 +289,5 @@
     transport_srtp *srtp;
     pj_status_t status;
-    int i;
+    unsigned i;
 
     PJ_ASSERT_RETURN(endpt && p_tp, PJ_EINVAL);
@@ -821,5 +821,5 @@
 	char key[MAX_KEY_LEN];
 	err_status_t err;
-	int i;
+	unsigned i;
 
 	PJ_ASSERT_RETURN(MAX_KEY_LEN >= crypto_suites[cs_idx].cipher_key_len,
@@ -840,5 +840,6 @@
 
 	} while (!key_ok);
-	crypto->key.ptr = pj_pool_zalloc(pool, 
+	crypto->key.ptr = (char*)
+			  pj_pool_zalloc(pool, 
 					 crypto_suites[cs_idx].cipher_key_len);
 	pj_memcpy(crypto->key.ptr, key, crypto_suites[cs_idx].cipher_key_len);
@@ -923,5 +924,5 @@
     }
     tmp = pj_str(token);
-    crypto->key.ptr = pj_pool_zalloc(pool, MAX_KEY_LEN);
+    crypto->key.ptr = (char*) pj_pool_zalloc(pool, MAX_KEY_LEN);
 
     /* Decode key */
@@ -953,5 +954,5 @@
     pjmedia_sdp_attr *attr;
     pj_str_t attr_value;
-    int i, j;
+    unsigned i, j;
     unsigned member_tp_option;
 
@@ -1234,5 +1235,5 @@
 
 	    /* our offer tag is always ordered by setting */
-	    if (rem_tag < 1 || rem_tag > srtp->setting.crypto_count) {
+	    if (rem_tag < 1 || rem_tag > (int)srtp->setting.crypto_count) {
 		DEACTIVATE_MEDIA(pool, m_loc);
 		return PJMEDIA_SRTP_ESDPINCRYPTOTAG;
Index: pjproject/trunk/pjnath/src/pjnath-test/sess_auth.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath-test/sess_auth.c	(revision 1928)
+++ pjproject/trunk/pjnath/src/pjnath-test/sess_auth.c	(revision 1929)
@@ -164,4 +164,6 @@
     PJ_UNUSED_ARG(unused);
 
+    PJ_LOG(5,("", "    server thread started"));
+
     while (!server->quit) {
 	pj_fd_set_t readset;
@@ -171,5 +173,5 @@
 	PJ_FD_SET(server->sock, &readset);
 
-	if (pj_sock_select(server->sock, &readset, NULL, NULL, &delay)==1 &&
+	if (pj_sock_select(server->sock+1, &readset, NULL, NULL, &delay)==1 &&
 	    PJ_FD_ISSET(server->sock, &readset)) 
 	{
@@ -384,5 +386,5 @@
 	PJ_FD_SET(client->sock, &readset);
 
-	if (pj_sock_select(client->sock, &readset, NULL, NULL, &delay)==1 &&
+	if (pj_sock_select(client->sock+1, &readset, NULL, NULL, &delay)==1 &&
 	    PJ_FD_ISSET(client->sock, &readset)) 
 	{
@@ -451,6 +453,6 @@
 			   pj_bool_t dummy_mi,
 
-			   pj_stun_status expected_error,
-			   pj_stun_status expected_code,
+			   pj_bool_t expected_error,
+			   pj_status_t expected_code,
 			   const char *expected_realm,
 			   const char *expected_nonce,
@@ -690,6 +692,10 @@
 static int retransmit_check(void)
 {
-    if (server->recv_count != PJ_STUN_MAX_TRANSMIT_COUNT)
+
+    if (server->recv_count != PJ_STUN_MAX_TRANSMIT_COUNT) {
+	PJ_LOG(3,("", "    expecting %d retransmissions, got %d",
+		  PJ_STUN_MAX_TRANSMIT_COUNT, server->recv_count));
 	return -700;
+    }
     if (client->recv_count != 0)
 	return -710;
Index: pjproject/trunk/pjnath/src/pjnath/turn_session.c
===================================================================
--- pjproject/trunk/pjnath/src/pjnath/turn_session.c	(revision 1928)
+++ pjproject/trunk/pjnath/src/pjnath/turn_session.c	(revision 1929)
@@ -940,5 +940,5 @@
 
     sess = (pj_turn_session*) pj_stun_session_get_user_data(stun);
-    return (*sess->cb.on_send_pkt)(sess, pkt, pkt_size, 
+    return (*sess->cb.on_send_pkt)(sess, (const pj_uint8_t*)pkt, pkt_size, 
 				   dst_addr, addr_len);
 }
@@ -1124,5 +1124,6 @@
 {
     pj_turn_session *sess;
-    int method = PJ_STUN_GET_METHOD(tdata->msg->hdr.type);
+    enum pj_stun_method_e method = (enum pj_stun_method_e) 
+			      	   PJ_STUN_GET_METHOD(tdata->msg->hdr.type);
 
     PJ_UNUSED_ARG(src_addr);
@@ -1409,5 +1410,5 @@
     pj_lock_acquire(sess->lock);
 
-    eid = e->id;
+    eid = (enum timer_id_t) e->id;
     e->id = TIMER_NONE;
     
Index: pjproject/trunk/pjnath/src/pjturn-client/client_main.c
===================================================================
--- pjproject/trunk/pjnath/src/pjturn-client/client_main.c	(revision 1928)
+++ pjproject/trunk/pjnath/src/pjturn-client/client_main.c	(revision 1929)
@@ -122,5 +122,5 @@
      * Create peers
      */
-    for (i=0; i<PJ_ARRAY_SIZE(g.peer); ++i) {
+    for (i=0; i<(int)PJ_ARRAY_SIZE(g.peer); ++i) {
 	int len;
 	pj_sockaddr addr;
@@ -203,5 +203,5 @@
 	/* Poll peer sockets */
 	PJ_FD_ZERO(&readset);
-	for (i=0; i<PJ_ARRAY_SIZE(g.peer); ++i) {
+	for (i=0; i<(int)PJ_ARRAY_SIZE(g.peer); ++i) {
 	    PJ_FD_SET(g.peer[i].sock, &readset);
 	    if (g.peer[i].sock > n)
@@ -213,5 +213,5 @@
 
 	/* Handle incoming data on peer socket */
-	for (i=0; i<PJ_ARRAY_SIZE(g.peer); ++i) {
+	for (i=0; i<(int)PJ_ARRAY_SIZE(g.peer); ++i) {
 	    char buf[128];
 	    pj_ssize_t len;
@@ -267,5 +267,5 @@
 	cred.data.static_cred.realm = pj_str(o.realm);
 	cred.data.static_cred.username = pj_str(o.user_name);
-	cred.data.static_cred.data_type = 0;
+	cred.data.static_cred.data_type = PJ_STUN_PASSWD_PLAIN;
 	cred.data.static_cred.data = pj_str(o.password);
 	//cred.data.static_cred.nonce = pj_str(o.nonce);
Index: pjproject/trunk/pjnath/src/pjturn-srv/auth.c
===================================================================
--- pjproject/trunk/pjnath/src/pjturn-srv/auth.c	(revision 1928)
+++ pjproject/trunk/pjnath/src/pjturn-srv/auth.c	(revision 1929)
@@ -103,5 +103,5 @@
     for (i=0; i<PJ_ARRAY_SIZE(g_cred); ++i) {
 	if (pj_stricmp2(username, g_cred[i].username) == 0) {
-	    *data_type = 0;
+	    *data_type = PJ_STUN_PASSWD_PLAIN;
 	    *data = pj_str(g_cred[i].passwd);
 	    return PJ_SUCCESS;
Index: pjproject/trunk/pjnath/src/pjturn-srv/main.c
===================================================================
--- pjproject/trunk/pjnath/src/pjturn-srv/main.c	(revision 1928)
+++ pjproject/trunk/pjnath/src/pjturn-srv/main.c	(revision 1929)
@@ -21,6 +21,7 @@
 
 #define REALM		"pjsip.org"
-#define TURN_PORT	PJ_STUN_TURN_PORT
-//#define TURN_PORT	34780
+//#define TURN_PORT	PJ_STUN_TURN_PORT
+#define TURN_PORT	34780
+#define LOG_LEVEL	4
 
 
@@ -157,4 +158,6 @@
     puts("Server is running");
 
+    pj_log_set_level(LOG_LEVEL);
+
     console_main(srv);
 
Index: pjproject/trunk/pjnath/src/pjturn-srv/server.c
===================================================================
--- pjproject/trunk/pjnath/src/pjturn-srv/server.c	(revision 1928)
+++ pjproject/trunk/pjnath/src/pjturn-srv/server.c	(revision 1929)
@@ -567,5 +567,6 @@
     /* Get TURN allocation from the source address */
     pj_lock_acquire(srv->core.lock);
-    alloc = pj_hash_get(srv->tables.alloc, &pkt->src, sizeof(pkt->src), NULL);
+    alloc = (pj_turn_allocation*)
+	    pj_hash_get(srv->tables.alloc, &pkt->src, sizeof(pkt->src), NULL);
     pj_lock_release(srv->core.lock);
 
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 1928)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_acc.c	(revision 1929)
@@ -520,6 +520,9 @@
 	/* Remote doesn't support rport */
 	rport = via->sent_by.port;
-	if (rport==0)
-	    rport = pjsip_transport_get_default_port_for_type(tp->key.type);
+	if (rport==0) {
+	    pjsip_transport_type_e tp_type;
+	    tp_type = (pjsip_transport_type_e) tp->key.type;
+	    rport = pjsip_transport_get_default_port_for_type(tp_type);
+	}
     } else
 	rport = via->rport_param;
@@ -535,8 +538,11 @@
 	  pjsip_parse_uri(pool, acc->contact.ptr, acc->contact.slen, 0);
     pj_assert(uri != NULL);
-    uri = pjsip_uri_get_uri(uri);
-
-    if (uri->port == 0)
-	uri->port = pjsip_transport_get_default_port_for_type(tp->key.type);
+    uri = (pjsip_sip_uri*) pjsip_uri_get_uri(uri);
+
+    if (uri->port == 0) {
+	pjsip_transport_type_e tp_type;
+	tp_type = (pjsip_transport_type_e) tp->key.type;
+	uri->port = pjsip_transport_get_default_port_for_type(tp_type);
+    }
 
     if (uri->port == rport &&
@@ -573,5 +579,5 @@
 	int len;
 
-	tmp = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
+	tmp = (char*) pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);
 	len = pj_ansi_snprintf(tmp, PJSIP_MAX_URL_SIZE,
 			       "<sip:%.*s@%.*s:%d;transport=%s>",
Index: pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 1928)
+++ pjproject/trunk/pjsip/src/pjsua-lib/pjsua_call.c	(revision 1929)
@@ -714,5 +714,5 @@
     if (rdata->msg_info.msg->body) {
 	status = pjmedia_sdp_parse(rdata->tp_info.pool, 
-				   rdata->msg_info.msg->body->data,
+				   (char*)rdata->msg_info.msg->body->data,
 				   rdata->msg_info.msg->body->len, &offer);
 	if (status != PJ_SUCCESS) {
