Index: pjproject/trunk/pjsip-apps/build/Makefile
===================================================================
--- pjproject/trunk/pjsip-apps/build/Makefile	(revision 2990)
+++ pjproject/trunk/pjsip-apps/build/Makefile	(revision 2991)
@@ -40,4 +40,15 @@
 
 
+###############################################################################
+# Defines for building pjsystest
+#
+export PJSYSTEST_SRCDIR = ../src/pjsystest
+export PJSYSTEST_OBJS += $(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
+			systest.o main_console.o
+export PJSYSTEST_CFLAGS += $(_CFLAGS)
+export PJSYSTEST_LDFLAGS += $(APP_LDFLAGS) $(APP_LDLIBS) $(LDFLAGS)
+export PJSYSTEST_EXE:=../bin/pjsystest-$(TARGET_NAME)$(HOST_EXE)
+
+
 export CC_OUT CC AR RANLIB HOST_MV HOST_RM HOST_RMDIR HOST_MKDIR OBJEXT LD LDOUT 
 ###############################################################################
@@ -45,5 +56,5 @@
 #
 #
-TARGETS := pjsua samples
+TARGETS := pjsua pjsystest samples
 
 .PHONY: $(TARGETS)
@@ -61,4 +72,7 @@
 	$(MAKE) -f $(RULES_MAK) APP=PJSUA app=pjsua $(PJSUA_EXE)
 
+pjsystest:
+	$(MAKE) -f $(RULES_MAK) APP=PJSYSTEST app=pjsystest $(PJSYSTEST_EXE)
+
 samples:
 	$(MAKE) -f Samples.mak
@@ -73,4 +87,5 @@
 	@if test "$@" = "depend"; then \
 	  echo '$(PJSUA_EXE): $(APP_LIB_FILES)' >> .pjsua-$(TARGET_NAME).depend; \
+	  echo '$(PJSYSTEST_EXE): $(APP_LIB_FILES)' >> .pjsystest-$(TARGET_NAME).depend; \
 	fi
 
Index: pjproject/trunk/pjsip-apps/src/pjsystest/systest.c
===================================================================
--- pjproject/trunk/pjsip-apps/src/pjsystest/systest.c	(revision 2990)
+++ pjproject/trunk/pjsip-apps/src/pjsystest/systest.c	(revision 2991)
@@ -115,5 +115,5 @@
     
     strcpy(themsg, title);
-    strncat(themsg, errmsg, sizeof(themsg));
+    strncat(themsg, errmsg, sizeof(themsg)-1);
     themsg[sizeof(themsg)-1] = '\0';
 
@@ -246,14 +246,30 @@
 }
 
+/* Util: create file player, each time trying different paths until we get
+ * the file.
+ */
+static pj_status_t create_player(unsigned path_cnt, const char *paths[], 
+				 pjsua_player_id *p_id)
+{
+    pj_str_t name;
+    pj_status_t status = PJ_ENOTFOUND;
+    unsigned i;
+
+    for (i=0; i<path_cnt; ++i) {
+	status = pjsua_player_create(pj_cstr(&name, paths[i]), 0, p_id);
+	if (status == PJ_SUCCESS)
+	    return PJ_SUCCESS;
+    }
+    return status;
+}
 
 /*****************************************************************************
  * test: play WAV file
  */
-static void systest_play_wav(const char *filename)
+static void systest_play_wav(unsigned path_cnt, const char *paths[])
 {
     pjsua_player_id play_id = PJSUA_INVALID_ID;
     enum gui_key key;
     test_item_t *ti;
-    pj_str_t name;
     const char *title = "WAV File Playback Test";
     pj_status_t status;
@@ -269,5 +285,5 @@
 		     "for a while to make sure that everything is okay."
 		     " Press OK to start, CANCEL to skip",
-		     filename);
+		     paths[0]);
 
     key = gui_msgbox(title, textbuf,
@@ -281,5 +297,5 @@
 
     /* WAV port */
-    status = pjsua_player_create(pj_cstr(&name, filename), 0, &play_id);
+    status = create_player(path_cnt, paths, &play_id);
     if (status != PJ_SUCCESS)
 	goto on_return;
@@ -314,10 +330,14 @@
 static void systest_play_wav1(void)
 {
-    systest_play_wav(WAV_PLAYBACK_PATH);
+    const char *paths[] = { WAV_PLAYBACK_PATH, 
+			    ALT_PATH1 WAV_PLAYBACK_PATH };
+    systest_play_wav(PJ_ARRAY_SIZE(paths), paths);
 }
 
 static void systest_play_wav2(void)
 {
-    systest_play_wav(WAV_TOCK8_PATH);
+    const char *paths[] = { WAV_TOCK8_PATH, 
+			    ALT_PATH1 WAV_TOCK8_PATH};
+    systest_play_wav(PJ_ARRAY_SIZE(paths), paths);
 }
 
@@ -713,5 +733,5 @@
 static void systest_latency_test(void)
 {
-    const pj_str_t ref_wav_file = pj_str(WAV_TOCK8_PATH);
+    const char *ref_wav_paths[] = { WAV_TOCK8_PATH, ALT_PATH1 WAV_TOCK8_PATH };
     const pj_str_t rec_wav_file = pj_str(WAV_LATENCY_OUT_PATH);
     pjsua_player_id play_id = PJSUA_INVALID_ID;
@@ -755,5 +775,6 @@
     PJ_LOG(3,(THIS_FILE, "Running %s", title));
 
-    status = pjsua_player_create(&ref_wav_file, 0, &play_id);
+    status = create_player(PJ_ARRAY_SIZE(ref_wav_paths), ref_wav_paths, 
+			   &play_id);
     if (status != PJ_SUCCESS)
 	goto on_return;
Index: pjproject/trunk/pjsip-apps/src/pjsystest/systest.h
===================================================================
--- pjproject/trunk/pjsip-apps/src/pjsystest/systest.h	(revision 2990)
+++ pjproject/trunk/pjsip-apps/src/pjsystest/systest.h	(revision 2991)
@@ -54,4 +54,5 @@
     #define WAV_TOCK8_PATH		"\\Program Files\\pjsystest\\tock8.WAV"
     #define WAV_LATENCY_OUT_PATH	"\\PJSYSTEST_LATREC.WAV"
+    #define ALT_PATH1			""
 #else
     #define LOG_OUT_PATH		"PJSYSTEST.LOG"
@@ -61,4 +62,5 @@
     #define WAV_TOCK8_PATH		"tock8.wav"
     #define WAV_LATENCY_OUT_PATH	"PJSYSTEST_LATREC.WAV"
+    #define ALT_PATH1			"../../tests/pjsua/wavs/"
 #endif
 
