Index: pjproject/trunk/pjsip/build/Makefile
===================================================================
--- pjproject/trunk/pjsip/build/Makefile	(revision 144)
+++ pjproject/trunk/pjsip/build/Makefile	(revision 145)
@@ -1,73 +1,113 @@
-include make-$(TARGET).inc
+include ../../build/common.mak
 
+RULES_MAK := ../../build/rules.mak
+
+PJLIB_LIB:=../../pjlib/lib/libpj-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(LIBEXT)
+PJLIB_UTIL_LIB:=../../pjlib-util/lib/libpjlib-util-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(LIBEXT)
+PJMEDIA_LIB:=../../pjmedia/lib/libpjmedia-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(LIBEXT)
+
+export PJSIP_LIB:=../lib/libpjsip-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(LIBEXT)
+export PJSIP_UA_LIB:=../lib/libpjsip-ua-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(LIBEXT)
+
+
+###############################################################################
+# Gather all flags.
+#
+export _CFLAGS 	:= -O2 -g $(CC_CFLAGS) $(OS_CFLAGS) $(HOST_CFLAGS) $(M_CFLAGS) \
+		   $(CFLAGS) $(CC_INC)../include $(CC_INC)../../pjlib/include \
+		   $(CC_INC)../../pjlib-util/include $(CC_INC)../../pjmedia/include
+export _CXXFLAGS:= $(_CFLAGS) $(CC_CXXFLAGS) $(OS_CXXFLAGS) $(M_CXXFLAGS) \
+		   $(HOST_CXXFLAGS) $(CXXFLAGS)
+export _LDFLAGS := $(subst /,$(HOST_PSEP),$(PJSIP_UA_LIB)) \
+		   $(subst /,$(HOST_PSEP),$(PJSIP_LIB)) \
+		   $(subst /,$(HOST_PSEP),$(PJMEDIA_LIB)) \
+		   $(subst /,$(HOST_PSEP),$(PJLIB_UTIL_LIB)) \
+		   $(subst /,$(HOST_PSEP),$(PJLIB_LIB)) \
+		   $(CC_LDFLAGS) $(OS_LDFLAGS) $(M_LDFLAGS) $(HOST_LDFLAGS) \
+		   $(LDFLAGS) 
+
+
+###############################################################################
+# Defines for building PJSIP core library
+#
 export PJSIP_SRCDIR = ../src/pjsip
-export PJSIP_SRCEXT = .c
-export PJSIP_SRCS = $(PJSIP_SOURCES) sip_auth.c sip_auth_msg.c sip_auth_parser.c \
-		    sip_endpoint.c sip_misc.c sip_msg.c sip_parser.c \
-		    sip_resolve.c sip_transaction.c sip_transport.c sip_uri.c
+export PJSIP_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
+		sip_errno.o sip_msg.o sip_parser.o sip_tel_uri.o sip_uri.o \
+		sip_endpoint.o sip_util.o sip_util_proxy.o \
+		sip_resolve.o sip_transport.o sip_transport_loop.o sip_transport_udp.o \
+		sip_auth_client.o sip_auth_msg.o sip_auth_parser.o sip_auth_server.o \
+		sip_transaction.o sip_util_statefull.o \
+		sip_dialog.o sip_ua_layer.o
+export PJSIP_CFLAGS += $(_CFLAGS)
 
-export PJSIP_UA_SRCDIR = ../src/pjsip_mod_ua
-export PJSIP_UA_SRCEXT = .c
-export PJSIP_UA_SRCS = $(PJSIP_UA_SOURCES) sip_dialog.c sip_reg.c sip_ua.c 
+###############################################################################
+# Defines for building PJSIP UA library
+#
+export PJSIP_UA_SRCDIR = ../src/pjsip-ua
+export PJSIP_UA_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
+			sip_inv.o sip_reg.o
+export PJSIP_UA_CFLAGS += $(_CFLAGS)
 
-export PJSIP_SIMPLE_SRCDIR = ../src/pjsip_simple
-export PJSIP_SIMPLE_SRCEXT = .c
-export PJSIP_SIMPLE_SRCS = $(PJSIP_SIMPLE_SOURCES) event_notify.c event_notify_msg.c \
-		    messaging.c pidf.c presence.c xpidf.c
 
+###############################################################################
+# Defines for building PJSUA
+#
 export PJSUA_SRCDIR = ../src/pjsua
-export PJSUA_SRCEXT = .c
-export PJSUA_SRCS = $(PJSUA_SOURCES) main.c getopt.c
+export PJSUA_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
+			main.o pjsua_reg.o pjsua.o
+export PJSUA_CFLAGS += $(_CFLAGS)
+export PJSUA_LDFLAGS += $(_LDFLAGS)
+export PJSUA_EXE:=../bin/pjsua-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(HOST_EXE)
 
-export TARGET CCOUT CC AR RANLIB MV RM RMDIR MKDIR OBJEXT LD LDOUT 
 
-all: pjsip pjsip_ua pjsip_simple pjsua 
+
+export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT 
+###############################################################################
+# Main entry
+#
+#
+TARGETS := pjsip pjsip-ua pjsua
+
+all: $(TARGETS)
 
 doc:
 	cd .. && doxygen docs/doxygen.cfg
 
-print:
-	$(MAKE) -f make-rules APP=PJSIP app=pjsip print_lib
-	$(MAKE) -f make-rules APP=PJSIP_UA app=pjsip_ua print_lib
-	$(MAKE) -f make-rules APP=PJSIP_SIMPLE app=pjsip_simple print_lib
-	$(MAKE) -f make-rules APP=PJSUA app=pjsua print_bin
-	
-depend:
-	$(MAKE) -f make-rules APP=PJSIP app=pjsip depend
-	$(MAKE) -f make-rules APP=PJSUA app=pjsua depend
-	$(MAKE) -f make-rules APP=PJSIP_UA app=pjsip_ua depend
-	$(MAKE) -f make-rules APP=PJSIP_SIMPLE app=pjsip_simple depend
-	echo '$(PJSUA_EXE): $(PJSIP_LIB) $(PJSIP_UA_LIB)' >> .pjsua.depend
+dep: depend
+distclean: realclean
 
-dep: depend
+.PHONY: dep depend pjsip pjsip-ua pjsua clean realclean distclean
 
 pjsip:
-	$(MAKE) -f make-rules APP=PJSIP app=pjsip $(PJSIP_LIB)
+	$(MAKE) -f $(RULES_MAK) APP=PJSIP app=pjsip $(PJSIP_LIB)
 
-pjsua: 
-	$(MAKE) -f make-rules APP=PJSUA app=pjsua $(PJSUA_EXE)
+pjsip-ua:
+	$(MAKE) -f $(RULES_MAK) APP=PJSIP_UA app=pjsip-ua $(PJSIP_UA_LIB)
 
-pjsip_ua:
-	$(MAKE) -f make-rules APP=PJSIP_UA app=pjsip_ua $(PJSIP_UA_LIB)
+pjsua: $(PJSIP_LIB) $(PJSIP_UA_LIB)
+	$(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $(PJSUA_EXE)
 
-pjsip_simple:
-	$(MAKE) -f make-rules APP=PJSIP_SIMPLE app=pjsip_simple $(PJSIP_SIMPLE_LIB)
+.PHONY: ../lib/pjsip.ko
+../lib/pjsip.ko:
+	echo Making $@
+	$(MAKE) -f $(RULES_MAK) APP=PJSIP app=pjsip $@
 
-samples:
-	gcc $(_CFLAGS) -o ../bin/simpleua ../src/samples/simpleua.c $(_LDFLAGS) 
+.PHONY: ../lib/pjsip-ua.ko
+../lib/pjsip-ua.ko:
+	echo Making $@
+	$(MAKE) -f $(RULES_MAK) APP=PJSIP_UA app=pjsip-ua $@
 
-clean:
-	$(MAKE) -f make-rules APP=PJSIP app=pjsip clean
-	$(MAKE) -f make-rules APP=PJSUA app=pjsua clean
-	$(MAKE) -f make-rules APP=PJSIP_UA app=pjsip_ua clean
-	$(MAKE) -f make-rules APP=PJSIP_SIMPLE app=pjsip_simple clean
+.PHONY: ../lib/pjsua.ko
+../lib/pjsua.ko:
+	$(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $@
 
-realclean:
-	$(MAKE) -f make-rules APP=PJSIP app=pjsip realclean
-	$(MAKE) -f make-rules APP=PJSUA app=pjsua realclean
-	$(MAKE) -f make-rules APP=PJSIP_UA app=pjsip_ua realclean
-	$(MAKE) -f make-rules APP=PJSIP_SIMPLE app=pjsip_simple realclean
-
-distclean: realclean
+clean depend realclean:
+	$(MAKE) -f $(RULES_MAK) APP=PJSIP app=pjsip $@
+	$(MAKE) -f $(RULES_MAK) APP=PJSIP_UA app=pjsip-ua $@
+	$(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $@
+	@if test "$@" == "depend"; then \
+	  echo '$(PJSUA_EXE): $(PJSIP_LIB) $(PJSIP_UA_LIB)' >> .pjsua-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME).depend; \
+	fi
 
 
+
Index: pjproject/trunk/pjsip/build/make-linux-i386.inc
===================================================================
--- pjproject/trunk/pjsip/build/make-linux-i386.inc	(revision 144)
+++ 	(revision )
@@ -1,58 +1,0 @@
-#
-# make-linux-i386.inc: Platform specific rules for Linux i386 compile.
-#
-
-#
-# Include PJLIB settings.
-#
-include ../../pjlib/build/make-$(TARGET).inc
-
-#
-# make-optimize.inc declares PJSIP_OPTIMIZE variable
-#
-include make-optimize.inc
-
-
-
-_CFLAGS := $(_CFLAGS) -I../../pjlib/src -I../../pjmedia/src \
-          -I../src $(PJSIP_OPTIMIZE)
-_LDFLAGS := $(_LDFLAGS) -L../lib -L../../pjlib/lib  \
-		      -L../../pjmedia/lib -lpjsip_core -lpjsip_ua -lpjsip_simple \
-		      -lpjmedia -lpj -lpthread
-
-#
-# libpjsip_core.a
-#
-export PJSIP_SOURCES = 
-export PJSIP_CFLAGS = $(_CFLAGS) 
-export PJSIP_LIB = ../lib/libpjsip_core.a
-export PJSIP_EXTRA_DEP := 
-
-#
-# libpjsip_ua.a
-#
-export PJSIP_UA_SOURCES = 
-export PJSIP_UA_CFLAGS = $(_CFLAGS) 
-export PJSIP_UA_LIB = ../lib/libpjsip_ua.a
-export PJSIP_UA_EXTRA_DEP :=
-
-#
-# libpjsip_simple.a
-#
-export PJSIP_SIMPLE_SOURCES :=
-export PJSIP_SIMPLE_CFLAGS := $(_CFLAGS)
-export PJSIP_SIMPLE_LIB := ../lib/libpjsip_simple.a
-export PJSIP_SIMPLE_EXTRA_LIB :=
-
-#
-# pjsua.exe
-#
-export PJSUA_SOURCES = 
-export PJSUA_CFLAGS = $(_CFLAGS)
-export PJSUA_LDFLAGS =  $(_LDFLAGS)
-export PJSUA_EXE = ../bin/pjsua
-export PJSUA_EXTRA_DEP := ../lib/libpjsip_core.a ../lib/libpjsip_ua.a \
-			  ../lib/libpjsip_simple.a ../../pjlib/lib/libpj.a \
-			  ../../pjmedia/lib/libpjmedia.a
-
-
Index: pjproject/trunk/pjsip/build/make-mingw.inc
===================================================================
--- pjproject/trunk/pjsip/build/make-mingw.inc	(revision 144)
+++ 	(revision )
@@ -1,56 +1,0 @@
-#
-# Platform specific flags
-#
-
-#
-# Include PJLIB settings.
-#
-include ../../pjlib/build/make-$(TARGET).inc
-
-
-#
-# make-optimize.inc declares PJSIP_OPTIMIZE variable
-#
-include make-optimize.inc
-
-
-_CFLAGS := $(_CFLAGS) -I../../pjlib/src -I../../pjmedia/src \
-	  $(PJSIP_OPTIMIZE)
-_LDFLAGS := -L../../pjlib/lib -L../../pjmedia/lib \
-	   -lpjsip_ua -lpjsip_simple -lpjsip_core -lpjmedia $(_LDFLAGS)
-
-#
-# libpjsip_core.a
-#
-export PJSIP_SOURCES := 
-export PJSIP_CFLAGS := $(_CFLAGS)
-export PJSIP_LIB := ../lib/libpjsip_core.a
-export PJSIP_EXTRA_DEP := 
-
-#
-# libpjsip_ua.a
-#
-export PJSIP_UA_SOURCES := 
-export PJSIP_UA_CFLAGS := $(_CFLAGS)
-export PJSIP_UA_LIB := ../lib/libpjsip_ua.a
-export PJSIP_UA_EXTRA_DEP :=
-
-#
-# libpjsip_simple.a
-#
-export PJSIP_SIMPLE_SOURCES :=
-export PJSIP_SIMPLE_CFLAGS := $(_CFLAGS)
-export PJSIP_SIMPLE_LIB := ../lib/libpjsip_simple.a
-export PJSIP_SIMPLE_EXTRA_LIB :=
-
-
-#
-# pjsua.exe
-#
-export PJSUA_SOURCES := 
-export PJSUA_CFLAGS := $(_CFLAGS)
-export PJSUA_LDFLAGS = $(_LDFLAGS)
-export PJSUA_EXE = ../bin/pjsua_mingw.exe
-export PJSUA_EXTRA_DEP := ../lib/libpjsip_core.a ../lib/libpjsip_ua.a \
-			  ../lib/libpjsip_simple.a ../../pjlib/lib/libpj.a \
-			  ../../pjmedia/lib/libpjmedia.a
Index: pjproject/trunk/pjsip/build/make-optimize.inc
===================================================================
--- pjproject/trunk/pjsip/build/make-optimize.inc	(revision 144)
+++ 	(revision )
@@ -1,10 +1,0 @@
-
-#
-# If MINSIZE is defined, optimize for code size.
-#
-ifdef MINSIZE
-PJSIP_OPTIMIZE := $(PJSIP_OPTIMIZE) -DPJSIP_HAS_DUMP=0
-else
-PJSIP_OPTIMIZE := $(PJSIP_OPTIMIZE)
-endif
-
Index: pjproject/trunk/pjsip/build/make-rules
===================================================================
--- pjproject/trunk/pjsip/build/make-rules	(revision 144)
+++ 	(revision )
@@ -1,119 +1,0 @@
-LIBDIR = ../lib
-BINDIR = ../bin
-
-#
-# The full path of output lib file (e.g. ../lib/libapp.a).
-#
-LIB = $($(APP)_LIB)
-
-#
-# The full path of output executable file (e.g. ../bin/app.exe).
-#
-EXE = $($(APP)_EXE)
-
-#
-# Source directory
-#
-SRCDIR = $($(APP)_SRCDIR)
-
-#
-# SRCEXT is .c
-# SRCS is file.c
-# FULL_SRCS is ../src/app/file.c
-#
-SRCEXT = $($(APP)_SRCEXT)
-SRCS = $($(APP)_SRCS)
-FULL_SRCS = $(foreach file, $(SRCS), $(SRCDIR)/$(file))
-
-
-#
-# Output directory for object files (i.e. output/target)
-#
-OBJDIR = ./output/$(app)-$(TARGET)
-
-#
-# OBJS1 is ./output/target/file.c
-# OBJS is ./output/target/file.o
-#
-OBJS1 = $(foreach file, $(SRCS), $(OBJDIR)/$(file))
-OBJS = $(OBJS1:%$(SRCEXT)=%$(OBJEXT))
-OBJDIRS := $(sort $(foreach file, $(SRCS), $(dir $(OBJDIR)/$(file))))
-
-
-#
-# When generating dependency (gcc -MM), ideally we use only either
-# CFLAGS or CXXFLAGS (not both). But I just couldn't make if/ifeq to work.
-#
-DEPFLAGS = $($(APP)_CXXFLAGS) $($(APP)_CFLAGS)
-
-print_common:
-	@echo "###"
-	@echo "### DUMPING MAKE VARIABLES (I WON'T DO ANYTHING ELSE):"
-	@echo "###"
-	@echo APP=$(APP)
-	@echo SRCEXT=$(SRCEXT)
-	@echo OBJDIR=$(OBJDIR)
-	@echo OBJS=$(OBJS)
-	@echo SRCDIR=$(SRCDIR)
-	@echo FULL_SRCS=$(FULL_SRCS)
-	@echo $(APP)_CFLAGS=$($(APP)_CFLAGS)
-	@echo $(APP)_CXXFLAGS=$($(APP)_CXXFLAGS)
-	@echo $(APP)_LDFLAGS=$($(APP)_LDFLAGS)
-	@echo DEPFLAGS=$(DEPFLAGS)
-
-print_bin: print_common
-	@echo EXE=$(EXE)
-	@echo BINDIR=$(BINDIR)
-
-print_lib: print_common
-	@echo LIB=$(LIB)
-	@echo LIBDIR=$(LIBDIR)
-
-$(LIB): $(LIBDIR) $(OBJDIRS) $(OBJS) $($(APP)_EXTRA_DEP)
-	$(AR) $(LIB) $(OBJS)
-	$(RANLIB) $(LIB)
-
-$(EXE): $(BINDIR) $(OBJDIRS) $(OBJS) $($(APP)_EXTRA_DEP)
-	$(LD) $(LDOUT) $(EXE) $(OBJS) $($(APP)_LDFLAGS)
-
-$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.c
-	$(CC) $($(APP)_CFLAGS) $< $(CCOUT) $@
-
-$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%.cpp
-	$(CC) $($(APP)_CXXFLAGS) $< $(CCOUT) $@
-
-#$(OBJDIR):
-#	$(MKDIR) $(OBJDIR)
-$(OBJDIRS):
-	$(MKDIR) $@
-
-$(LIBDIR):
-	$(MKDIR) $(LIBDIR)
-
-$(BINDIR):
-	$(MKDIR) $(BINDIR)
-
-clean:
-	$(RM) -r $(OBJDIR)/*
-	$(RMDIR) $(OBJDIR)
-
-realclean: clean
-	$(RM) $(LIB) $(EXE)
-	$(RM) .$(app).depend
-
-depend:
-	$(RM) .$(app).depend
-	for F in $(FULL_SRCS); do \
-	   echo -n $(OBJDIR)/ >> .$(app).depend; \
-	   if gcc -MM $(DEPFLAGS) $$F >> .$(app).depend; then \
-		true; \
-	   else \
-		echo 'err:' >> .$(app).depend; \
-		exit 1; \
-	   fi; \
-	done
-
-dep: depend
-
--include .$(app).depend
-
Index: pjproject/trunk/pjsip/include/pjsip/sip_msg.h
===================================================================
--- pjproject/trunk/pjsip/include/pjsip/sip_msg.h	(revision 144)
+++ pjproject/trunk/pjsip/include/pjsip/sip_msg.h	(revision 145)
@@ -73,10 +73,10 @@
  * is recognized or not.
  */
-typedef struct pjsip_method
+struct pjsip_method
 {
     pjsip_method_e id;	    /**< Method ID, from \a pjsip_method_e. */
     pj_str_t	   name;    /**< Method name, which will always contain the 
 			         method string. */
-} pjsip_method;
+};
 
 
Index: pjproject/trunk/pjsip/include/pjsip/sip_transport.h
===================================================================
--- pjproject/trunk/pjsip/include/pjsip/sip_transport.h	(revision 144)
+++ pjproject/trunk/pjsip/include/pjsip/sip_transport.h	(revision 145)
@@ -467,5 +467,5 @@
  * specific members.
  */
-typedef struct pjsip_transport
+struct pjsip_transport
 {
     char		    obj_name[PJ_MAX_OBJ_NAME];	/**< Name. */
@@ -538,5 +538,5 @@
      * Application may extend this structure..
      */
-} pjsip_transport;
+};
 
 
Index: pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c	(revision 144)
+++ pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c	(revision 145)
@@ -847,5 +847,5 @@
     /* Include SDP for 18x and 2xx response. */
     if (st_code/10 == 18 || st_code/10 == 20) {
-	pjmedia_sdp_session *local;
+	const pjmedia_sdp_session *local;
 
 	status = pjmedia_sdp_neg_get_neg_local(inv->neg, &local);
Index: pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c	(revision 144)
+++ pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c	(revision 145)
@@ -123,7 +123,7 @@
 
 /* Compare module name, used for searching module based on name. */
-static int cmp_mod_name(void *name, const pjsip_module *mod)
-{
-    return pj_stricmp(name, &mod->name);
+static int cmp_mod_name(void *name, const void *mod)
+{
+    return pj_stricmp(name, &((pjsip_module*)mod)->name);
 }
 
Index: pjproject/trunk/pjsip/src/pjsip/sip_msg.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_msg.c	(revision 144)
+++ pjproject/trunk/pjsip/src/pjsip/sip_msg.c	(revision 145)
@@ -1717,6 +1717,6 @@
 				     text->slen + 2);	/* text */
     hvalue.slen = pj_sprintf(hvalue.ptr, "%u %.*s \"%.*s\"",
-			     code, host->slen, host->ptr,
-			     text->slen, text->ptr);
+			     code, (int)host->slen, host->ptr,
+			     (int)text->slen, text->ptr);
 
     return pjsip_generic_string_hdr_create(pool, &str_warning, &hvalue);
Index: pjproject/trunk/pjsip/src/pjsip/sip_parser.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_parser.c	(revision 144)
+++ pjproject/trunk/pjsip/src/pjsip/sip_parser.c	(revision 145)
@@ -155,5 +155,5 @@
 					        pj_pool_t *pool, 
                                                 unsigned option);
-static pjsip_sip_uri* int_parse_sip_url( pj_scanner *scanner, 
+static void*	    int_parse_sip_url( pj_scanner *scanner, 
 				         pj_pool_t *pool,
 				         pj_bool_t parse_params);
@@ -1150,8 +1150,10 @@
 }
 
-/* Parse "sip:" and "sips:" URI. */
-static pjsip_sip_uri *int_parse_sip_url( pj_scanner *scanner, 
-					 pj_pool_t *pool,
-					 pj_bool_t parse_params)
+/* Parse "sip:" and "sips:" URI. 
+ * This actually returns (pjsip_sip_uri*) type,
+ */
+static void* int_parse_sip_url( pj_scanner *scanner, 
+				pj_pool_t *pool,
+				pj_bool_t parse_params)
 {
     pj_str_t scheme;
Index: pjproject/trunk/pjsip/src/pjsip/sip_tel_uri.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_tel_uri.c	(revision 144)
+++ pjproject/trunk/pjsip/src/pjsip/sip_tel_uri.c	(revision 145)
@@ -71,5 +71,5 @@
 			const pjsip_tel_uri *url1, const pjsip_tel_uri *url2);
 static pjsip_tel_uri* tel_uri_clone(pj_pool_t *pool, const pjsip_tel_uri *rhs);
-static pjsip_tel_uri *tel_uri_parse( pj_scanner *scanner, pj_pool_t *pool,
+static void*	      tel_uri_parse( pj_scanner *scanner, pj_pool_t *pool,
 				     pj_bool_t parse_params);
 
@@ -351,7 +351,9 @@
 }
 
-/* Parse tel: URI */
-static pjsip_tel_uri *tel_uri_parse( pj_scanner *scanner, pj_pool_t *pool,
-				     pj_bool_t parse_params)
+/* Parse tel: URI 
+ * THis actually returns (pjsip_tel_uri *) type.
+ */
+static void* tel_uri_parse( pj_scanner *scanner, pj_pool_t *pool,
+			    pj_bool_t parse_params)
 {
     pjsip_tel_uri *uri;
Index: pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_transaction.c	(revision 144)
+++ pjproject/trunk/pjsip/src/pjsip/sip_transaction.c	(revision 145)
@@ -45,5 +45,5 @@
  **
  *****************************************************************************
-
+ **/
 /* Prototypes. */
 static pj_status_t mod_tsx_layer_load(pjsip_endpoint *endpt);
@@ -409,5 +409,5 @@
  **
  *****************************************************************************
-
+ **/
 /*
  * Create transaction layer module and registers it to the endpoint.
@@ -771,5 +771,5 @@
  **
  *****************************************************************************
-
+ **/
 /*
  * Lock transaction and set the value of Thread Local Storage.
Index: pjproject/trunk/pjsip/src/pjsip/sip_transport.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_transport.c	(revision 144)
+++ pjproject/trunk/pjsip/src/pjsip/sip_transport.c	(revision 145)
@@ -321,5 +321,5 @@
 	len = pj_snprintf(info_buf, sizeof(info_buf), 
 			  "Request msg %.*s/cseq=%d (%s)",
-			  msg->line.req.method.name.slen,
+			  (int)msg->line.req.method.name.slen,
 			  msg->line.req.method.name.ptr,
 			  cseq->cseq, obj_name);
@@ -328,5 +328,5 @@
 			  "Response msg %d/%.*s/cseq=%d (%s)",
 			  msg->line.status.code,
-			  cseq->method.name.slen,
+			  (int)cseq->method.name.slen,
 			  cseq->method.name.ptr,
 			  cseq->cseq, obj_name);
@@ -445,5 +445,5 @@
 PJ_DEF(pj_status_t) pjsip_transport_send(  pjsip_transport *tr, 
 					   pjsip_tx_data *tdata,
-					   const pj_sockaddr *addr,
+					   const pj_sockaddr_t *addr,
 					   int addr_len,
 					   void *token,
@@ -466,5 +466,5 @@
     pj_memcpy(&tdata->tp_info.dst_addr, addr, addr_len);
     tdata->tp_info.dst_addr_len = addr_len;
-    if (addr->sa_family == PJ_AF_INET) {
+    if (((pj_sockaddr*)addr)->sa_family == PJ_AF_INET) {
 	const char *str_addr;
 	str_addr = pj_inet_ntoa(((pj_sockaddr_in*)addr)->sin_addr);
Index: pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c	(revision 144)
+++ pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c	(revision 145)
@@ -625,5 +625,5 @@
 
     if (rdata->msg_info.cseq->method.id == PJSIP_INVITE_METHOD) {
-	pj_str_t *to_tag = &rdata->msg_info.to->tag;
+	//pj_str_t *to_tag = &rdata->msg_info.to->tag;
 
 	/* Must hold UA mutex before accessing dialog set. */
Index: pjproject/trunk/pjsip/src/pjsua/pjsua.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsua/pjsua.c	(revision 144)
+++ pjproject/trunk/pjsip/src/pjsua/pjsua.c	(revision 145)
@@ -19,8 +19,8 @@
 #include "pjsua.h"
 
-struct pjsua pjsua;
 
 #define THIS_FILE   "pjsua.c"
 
+struct pjsua_t pjsua;
 
 #define PJSUA_LOCAL_URI	    "<sip:user@127.0.0.1>"
Index: pjproject/trunk/pjsip/src/pjsua/pjsua.h
===================================================================
--- pjproject/trunk/pjsip/src/pjsua/pjsua.h	(revision 144)
+++ pjproject/trunk/pjsip/src/pjsua/pjsua.h	(revision 145)
@@ -37,5 +37,5 @@
 
 /* PJSUA application variables. */
-extern struct pjsua
+extern struct pjsua_t
 {
     /* Control: */
