Index: /pjproject/trunk/pjsip/build/Makefile
===================================================================
--- /pjproject/trunk/pjsip/build/Makefile	(revision 252)
+++ /pjproject/trunk/pjsip/build/Makefile	(revision 253)
@@ -75,16 +75,4 @@
 
 
-###############################################################################
-# Defines for building PJSUA
-#
-export PJSUA_SRCDIR = ../src/pjsua
-export PJSUA_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
-			main.o 
-export PJSUA_CFLAGS += $(_CFLAGS)
-export PJSUA_LDFLAGS += $(_LDFLAGS)
-export PJSUA_EXE:=../bin/pjsua-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME)$(HOST_EXE)
-
-
-
 export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT 
 ###############################################################################
@@ -92,5 +80,5 @@
 #
 #
-TARGETS := pjsip pjsip-ua pjsip-simple pjsua-lib pjsua
+TARGETS := pjsip pjsip-ua pjsip-simple pjsua-lib
 
 .PHONY: $(TARGETS)
@@ -104,5 +92,5 @@
 distclean: realclean
 
-.PHONY: dep depend pjsip pjsip-ua pjsua-lib pjsua clean realclean distclean
+.PHONY: dep depend pjsip pjsip-ua pjsua-lib clean realclean distclean
 
 pjsip:
@@ -117,7 +105,4 @@
 pjsua-lib: 
 	$(MAKE) -f $(RULES_MAK) APP=PJSUA_LIB app=pjsua-lib $(PJSUA_LIB_LIB)
-
-pjsua:
-	$(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $(PJSUA_EXE)
 
 .PHONY: ../lib/pjsip.ko
@@ -141,8 +126,4 @@
 	$(MAKE) -f $(RULES_MAK) APP=PJSUA_LIB app=pjsua-lib $@
 
-.PHONY: ../lib/pjsua.ko
-../lib/pjsua.ko:
-	$(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $@
-
 clean depend realclean:
 	$(MAKE) -f $(RULES_MAK) APP=PJSIP app=pjsip $@
@@ -150,8 +131,4 @@
 	$(MAKE) -f $(RULES_MAK) APP=PJSIP_SIMPLE app=pjsip-simple $@
 	$(MAKE) -f $(RULES_MAK) APP=PJSUA_LIB app=pjsua-lib $@
-	$(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $@
-	@if test "$@" == "depend"; then \
-	  echo '$(PJSUA_EXE): $(PJSIP_LIB) $(PJSIP_UA_LIB) $(PJSIP_SIMPLE) $(PJSUA_LIB_LIB) $(PJLIB_LIB) $(PJLIB_UTIL_LIB) $(PJMEDIA_LIB) $(PJMEDIA_CODEC_LIB)' >> .pjsua-$(MACHINE_NAME)-$(OS_NAME)-$(CC_NAME).depend; \
-	fi
 
 
Index: project/trunk/pjsip/build/os-win32.mak
===================================================================
--- /pjproject/trunk/pjsip/build/os-win32.mak	(revision 252)
+++ 	(revision )
@@ -1,2 +1,0 @@
-
-export LDFLAGS += -lwinmm
Index: project/trunk/pjsip/build/pjsip_auth_lib.dsp
===================================================================
--- /pjproject/trunk/pjsip/build/pjsip_auth_lib.dsp	(revision 252)
+++ 	(revision )
@@ -1,122 +1,0 @@
-# Microsoft Developer Studio Project File - Name="pjsip_auth_lib" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=pjsip_auth_lib - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "pjsip_auth_lib.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "pjsip_auth_lib.mak" CFG="pjsip_auth_lib - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "pjsip_auth_lib - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "pjsip_auth_lib - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""$/pjproject/pjsip/build", RIAAAAAA"
-# PROP Scc_LocalPath "."
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "pjsip_auth_lib - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "./output/pjsip_auth_vc6_Release"
-# PROP BASE Intermediate_Dir "./output/pjsip_auth_vc6_Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "./output/pjsip_auth_vc6_Release"
-# PROP Intermediate_Dir "./output/pjsip_auth_vc6_Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /GX /O2 /I "../src" /I "../../pjsip/src" /I "../../pjlib/src" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"../lib/pjsip_auth_vc6s.lib"
-
-!ELSEIF  "$(CFG)" == "pjsip_auth_lib - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "./output/pjsip_auth_vc6_Debug"
-# PROP BASE Intermediate_Dir "./output/pjsip_auth_vc6_Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "./output/pjsip_auth_vc6_Debug"
-# PROP Intermediate_Dir "./output/pjsip_auth_vc6_Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../src" /I "../../pjsip/src" /I "../../pjlib/src" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"../lib/pjsip_auth_vc6sd.lib"
-
-!ENDIF 
-
-# Begin Target
-
-# Name "pjsip_auth_lib - Win32 Release"
-# Name "pjsip_auth_lib - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\src\pjsip_auth\sip_auth.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjsip_auth\sip_auth_msg.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjsip_auth\sip_auth_parser.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\src\pjsip_auth.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjsip_auth\sip_auth.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjsip_auth\sip_auth_msg.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\pjsip_auth\sip_auth_parser.h
-# End Source File
-# End Group
-# End Target
-# End Project
Index: project/trunk/pjsip/build/pjsua.dsp
===================================================================
--- /pjproject/trunk/pjsip/build/pjsua.dsp	(revision 252)
+++ 	(revision )
@@ -1,105 +1,0 @@
-# Microsoft Developer Studio Project File - Name="pjsua" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=pjsua - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "pjsua.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "pjsua.mak" CFG="pjsua - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "pjsua - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "pjsua - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""$/pjproject/pjsip/build", RIAAAAAA"
-# PROP Scc_LocalPath "."
-CPP=cl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "pjsua - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir ".\output\pjsua-i386-win32-vc6-release"
-# PROP BASE Intermediate_Dir ".\output\pjsua-i386-win32-vc6-release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir ".\output\pjsua-i386-win32-vc6-release"
-# PROP Intermediate_Dir ".\output\pjsua-i386-win32-vc6-release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W4 /GX /Zi /O2 /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjmedia/include" /D "NDEBUG" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR /FD /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /map /machine:I386 /out:"../bin/pjsua_vc6.exe" /fixed:no
-# SUBTRACT LINK32 /pdb:none /debug
-
-!ELSEIF  "$(CFG)" == "pjsua - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir ".\output\pjsua-i386-win32-vc6-debug"
-# PROP BASE Intermediate_Dir ".\output\pjsua-i386-win32-vc6-debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ".\output\pjsua-i386-win32-vc6-debug"
-# PROP Intermediate_Dir ".\output\pjsua-i386-win32-vc6-debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /I "../include" /I "../../pjlib/include" /I "../../pjlib-util/include" /I "../../pjmedia/include" /D "_DEBUG" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c
-# SUBTRACT CPP /YX
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 dsound.lib dxguid.lib netapi32.lib mswsock.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/pjsua_vc6d.exe" /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "pjsua - Win32 Release"
-# Name "pjsua - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\src\pjsua\main.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
Index: /pjproject/trunk/pjsip/include/pjsip/sip_transaction.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_transaction.h	(revision 252)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_transaction.h	(revision 253)
@@ -284,5 +284,5 @@
  * Dump transaction layer.
  */
-PJ_DECL(void) pjsip_tsx_layer_dump(void);
+PJ_DECL(void) pjsip_tsx_layer_dump(pj_bool_t detail);
 
 /*
Index: /pjproject/trunk/pjsip/include/pjsip/sip_ua_layer.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_ua_layer.h	(revision 252)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_ua_layer.h	(revision 253)
@@ -75,6 +75,8 @@
 /**
  * Dump user agent contents (e.g. all dialogs).
+ *
+ * @param detail	If non-zero, list of dialogs will be printed.
  */
-PJ_DEF(void) pjsip_ua_dump(void);
+PJ_DEF(void) pjsip_ua_dump(pj_bool_t detail);
 
 /**
Index: /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 252)
+++ /pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h	(revision 253)
@@ -176,4 +176,5 @@
 
     /* Media:  */
+    int		     start_rtp_port;/**< Start of RTP port to try.	*/
     pjmedia_endpt   *med_endpt;	    /**< Media endpoint.		*/
     pjmedia_conf    *mconf;	    /**< Media conference.		*/
Index: /pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c	(revision 252)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c	(revision 253)
@@ -606,4 +606,9 @@
     timeout.sec = timeout.msec = 0;
     pj_timer_heap_poll( endpt->timer_heap, &timeout );
+
+    /* timer_heap_poll should never ever returns negative value, or otherwise
+     * ioqueue_poll() will block forever!
+     */
+    pj_assert(timeout.sec >= 0 && timeout.msec >= 0);
 
     /* If caller specifies maximum time to wait, then compare the value with
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transaction.c	(revision 252)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transaction.c	(revision 253)
@@ -762,5 +762,5 @@
  * Dump transaction layer.
  */
-PJ_DEF(void) pjsip_tsx_layer_dump(void)
+PJ_DEF(void) pjsip_tsx_layer_dump(pj_bool_t detail)
 {
 #if PJ_LOG_MAX_LEVEL >= 3
@@ -771,19 +771,25 @@
 
     PJ_LOG(3, (THIS_FILE, "Dumping transaction table:"));
-
-    it = pj_hash_first(mod_tsx_layer.htable, &itbuf);
-    if (it == NULL) {
-	PJ_LOG(3, (THIS_FILE, " - none - "));
-    } else {
-	while (it != NULL) {
-	    pjsip_transaction *tsx = pj_hash_this( mod_tsx_layer.htable, it);
-
-	    PJ_LOG(3, (THIS_FILE, " %s %s|%d|%s",
-		       tsx->obj_name,
-		       (tsx->last_tx? pjsip_tx_data_get_info(tsx->last_tx): "none"),
-		       tsx->status_code,
-		       pjsip_tsx_state_str(tsx->state)));
-
-	    it = pj_hash_next(mod_tsx_layer.htable, it);
+    PJ_LOG(3, (THIS_FILE, " Total %d transactions", 
+			  pj_hash_count(mod_tsx_layer.htable)));
+
+    if (detail) {
+	it = pj_hash_first(mod_tsx_layer.htable, &itbuf);
+	if (it == NULL) {
+	    PJ_LOG(3, (THIS_FILE, " - none - "));
+	} else {
+	    while (it != NULL) {
+		pjsip_transaction *tsx = pj_hash_this(mod_tsx_layer.htable,it);
+
+		PJ_LOG(3, (THIS_FILE, " %s %s|%d|%s",
+			   tsx->obj_name,
+			   (tsx->last_tx? 
+				pjsip_tx_data_get_info(tsx->last_tx): 
+				"none"),
+			   tsx->status_code,
+			   pjsip_tsx_state_str(tsx->state)));
+
+		it = pj_hash_next(mod_tsx_layer.htable, it);
+	    }
 	}
     }
Index: /pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c	(revision 252)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c	(revision 253)
@@ -778,5 +778,5 @@
  * Dump user agent contents (e.g. all dialogs).
  */
-PJ_DEF(void) pjsip_ua_dump(void)
+PJ_DEF(void) pjsip_ua_dump(pj_bool_t detail)
 {
 #if PJ_LOG_MAX_LEVEL >= 3
@@ -786,31 +786,34 @@
     pj_mutex_lock(mod_ua.mutex);
 
-    PJ_LOG(3, (THIS_FILE, "Number of dialog sets: %u", pj_hash_count(mod_ua.dlg_table)));
-    PJ_LOG(3, (THIS_FILE, "Dumping dialog sets:"));
-
-    it = pj_hash_first(mod_ua.dlg_table, &itbuf);
-    for (; it != NULL; it = pj_hash_next(mod_ua.dlg_table, it))  {
-	struct dlg_set *dlg_set;
-	pjsip_dialog *dlg;
-	const char *title;
-
-	dlg_set = pj_hash_this(mod_ua.dlg_table, it);
-	if (!dlg_set || pj_list_empty(&dlg_set->dlg_list)) continue;
-
-	/* First dialog in dialog set. */
-	dlg = dlg_set->dlg_list.next;
-	if (dlg->role == PJSIP_ROLE_UAC)
-	    title = "  [out] ";
-	else
-	    title = "  [in]  ";
-
-	print_dialog(title, dlg, dlginfo, sizeof(dlginfo));
-	PJ_LOG(3,(THIS_FILE, "%s", dlginfo));
-
-	/* Next dialog in dialog set (forked) */
-	dlg = dlg->next;
-	while (dlg != (pjsip_dialog*) &dlg_set->dlg_list) {
-	    print_dialog("    [forked] ", dlg, dlginfo, sizeof(dlginfo));
+    PJ_LOG(3, (THIS_FILE, "Number of dialog sets: %u", 
+			  pj_hash_count(mod_ua.dlg_table)));
+
+    if (detail && pj_hash_count(mod_ua.dlg_table)) {
+	PJ_LOG(3, (THIS_FILE, "Dumping dialog sets:"));
+	it = pj_hash_first(mod_ua.dlg_table, &itbuf);
+	for (; it != NULL; it = pj_hash_next(mod_ua.dlg_table, it))  {
+	    struct dlg_set *dlg_set;
+	    pjsip_dialog *dlg;
+	    const char *title;
+
+	    dlg_set = pj_hash_this(mod_ua.dlg_table, it);
+	    if (!dlg_set || pj_list_empty(&dlg_set->dlg_list)) continue;
+
+	    /* First dialog in dialog set. */
+	    dlg = dlg_set->dlg_list.next;
+	    if (dlg->role == PJSIP_ROLE_UAC)
+		title = "  [out] ";
+	    else
+		title = "  [in]  ";
+
+	    print_dialog(title, dlg, dlginfo, sizeof(dlginfo));
+	    PJ_LOG(3,(THIS_FILE, "%s", dlginfo));
+
+	    /* Next dialog in dialog set (forked) */
 	    dlg = dlg->next;
+	    while (dlg != (pjsip_dialog*) &dlg_set->dlg_list) {
+		print_dialog("    [forked] ", dlg, dlginfo, sizeof(dlginfo));
+		dlg = dlg->next;
+	    }
 	}
     }
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 252)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c	(revision 253)
@@ -59,4 +59,8 @@
 
 
+    /* Default we start RTP at port 4000 */
+    pjsua.start_rtp_port = 4000;
+
+
     /* Default logging settings: */
     pjsua.log_level = 5;
@@ -139,6 +143,4 @@
 {
     enum { 
-	RTP_START_PORT = 4000,
-	RTP_RANDOM_START = 2,
 	RTP_RETRY = 100
     };
@@ -149,8 +151,11 @@
     };
     int i;
-    static pj_uint16_t rtp_port = RTP_START_PORT;
+    static pj_uint16_t rtp_port;
     pj_sock_t sock[3];
     pj_sockaddr_in mapped_addr[3];
     pj_status_t status = PJ_SUCCESS;
+
+    if (rtp_port == 0)
+	rtp_port = (pj_uint16_t)pjsua.start_rtp_port;
 
     for (i=0; i<3; ++i)
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_opt.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_opt.c	(revision 252)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_opt.c	(revision 253)
@@ -83,4 +83,5 @@
     puts("  --auto-loop         Automatically loop incoming RTP to outgoing RTP");
     puts("  --auto-conf         Automatically put incoming calls to conference");
+    puts("  --rtp-port=N	Base port to try for RTP");
     puts("");
     puts("Buddy List (can be more than one):");
@@ -212,5 +213,5 @@
 	   OPT_AUTO_ANSWER, OPT_AUTO_HANGUP, OPT_AUTO_PLAY, OPT_AUTO_LOOP,
 	   OPT_AUTO_CONF,
-	   OPT_PLAY_FILE,
+	   OPT_PLAY_FILE, OPT_RTP_PORT,
 	   OPT_NEXT_ACCOUNT, OPT_NEXT_CRED, OPT_MAX_CALLS,
     };
@@ -244,4 +245,5 @@
 	{ "auto-conf",  0, 0, OPT_AUTO_CONF},
 	{ "play-file",  1, 0, OPT_PLAY_FILE},
+	{ "rtp-port",	1, 0, OPT_RTP_PORT},
 	{ "next-account",0,0, OPT_NEXT_ACCOUNT},
 	{ "next-cred",	0, 0, OPT_NEXT_CRED},
@@ -463,8 +465,17 @@
 	    break;
 
+	case OPT_RTP_PORT:
+	    pjsua.start_rtp_port = my_atoi(optarg);
+	    if (pjsua.start_rtp_port < 1 || pjsua.start_rtp_port > 65535) {
+		PJ_LOG(1,(THIS_FILE,
+			  "Error: rtp-port argument value (expecting 1-65535"));
+		return -1;
+	    }
+
 	case OPT_AUTO_ANSWER:
 	    pjsua.auto_answer = my_atoi(optarg);
 	    if (pjsua.auto_answer < 100 || pjsua.auto_answer > 699) {
-		puts("Error: invalid code in --auto-answer (expecting 100-699");
+		PJ_LOG(1,(THIS_FILE,
+			  "Error: invalid code in --auto-answer (expecting 100-699"));
 		return -1;
 	    }
@@ -474,5 +485,5 @@
 	    pjsua.max_calls = my_atoi(optarg);
 	    if (pjsua.max_calls < 1 || pjsua.max_calls > 255) {
-		puts("Too many calls for max-calls (1-255)");
+		PJ_LOG(1,(THIS_FILE,"Too many calls for max-calls (1-255)"));
 		return -1;
 	    }
@@ -578,6 +589,6 @@
     pjsip_endpt_dump(pjsua.endpt, 1);
     pjmedia_endpt_dump(pjsua.med_endpt);
-    pjsip_tsx_layer_dump();
-    pjsip_ua_dump();
+    pjsip_tsx_layer_dump(1);
+    pjsip_ua_dump(1);
 
 
Index: /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_reg.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_reg.c	(revision 252)
+++ /pjproject/trunk/pjsip/src/pjsua-lib/pjsua_reg.c	(revision 253)
@@ -87,6 +87,6 @@
 void pjsua_regc_update(int acc_index, pj_bool_t renew)
 {
-    pj_status_t status;
-    pjsip_tx_data *tdata;
+    pj_status_t status = 0;
+    pjsip_tx_data *tdata = 0;
 
     if (renew) {
@@ -99,5 +99,10 @@
 	    }
 	}
-	status = pjsip_regc_register(pjsua.acc[acc_index].regc, 1, &tdata);
+	if (!pjsua.acc[acc_index].regc)
+	    return;
+
+	status = pjsip_regc_register(pjsua.acc[acc_index].regc, 1, 
+				     &tdata);
+
     } else {
 	if (pjsua.acc[acc_index].regc == NULL) {
@@ -127,39 +132,42 @@
     pj_status_t status;
 
+    if (pjsua.acc[acc_index].reg_uri.slen == 0) {
+	PJ_LOG(3,(THIS_FILE, "Registrar URI is not specified"));
+	return PJ_SUCCESS;
+    }
+
     /* initialize SIP registration if registrar is configured */
-    if (pjsua.acc[acc_index].reg_uri.slen) {
 
-	status = pjsip_regc_create( pjsua.endpt, 
-				    &pjsua.acc[acc_index], 
-				    &regc_cb, 
-				    &pjsua.acc[acc_index].regc);
+    status = pjsip_regc_create( pjsua.endpt, 
+				&pjsua.acc[acc_index], 
+				&regc_cb, 
+				&pjsua.acc[acc_index].regc);
 
-	if (status != PJ_SUCCESS) {
-	    pjsua_perror(THIS_FILE, "Unable to create client registration", 
-			 status);
-	    return status;
-	}
+    if (status != PJ_SUCCESS) {
+	pjsua_perror(THIS_FILE, "Unable to create client registration", 
+		     status);
+	return status;
+    }
 
 
-	status = pjsip_regc_init( pjsua.acc[acc_index].regc, 
-				  &pjsua.acc[acc_index].reg_uri, 
-				  &pjsua.acc[acc_index].local_uri, 
-				  &pjsua.acc[acc_index].local_uri,
-				  1, &pjsua.acc[acc_index].contact_uri, 
-				  pjsua.acc[acc_index].reg_timeout);
-	if (status != PJ_SUCCESS) {
-	    pjsua_perror(THIS_FILE, 
-			 "Client registration initialization error", 
-			 status);
-	    return status;
-	}
+    status = pjsip_regc_init( pjsua.acc[acc_index].regc, 
+			      &pjsua.acc[acc_index].reg_uri, 
+			      &pjsua.acc[acc_index].local_uri, 
+			      &pjsua.acc[acc_index].local_uri,
+			      1, &pjsua.acc[acc_index].contact_uri, 
+			      pjsua.acc[acc_index].reg_timeout);
+    if (status != PJ_SUCCESS) {
+	pjsua_perror(THIS_FILE, 
+		     "Client registration initialization error", 
+		     status);
+	return status;
+    }
 
-	pjsip_regc_set_credentials( pjsua.acc[acc_index].regc, 
-				    pjsua.cred_count, 
-				    pjsua.cred_info );
+    pjsip_regc_set_credentials( pjsua.acc[acc_index].regc, 
+				pjsua.cred_count, 
+				pjsua.cred_info );
 
-	pjsip_regc_set_route_set( pjsua.acc[acc_index].regc, 
-				  &pjsua.acc[acc_index].route_set );
-    }
+    pjsip_regc_set_route_set( pjsua.acc[acc_index].regc, 
+			      &pjsua.acc[acc_index].route_set );
 
     return PJ_SUCCESS;
