Index: /pjproject/branches/projects/jni/pjsip-apps/src/jni/Makefile
===================================================================
--- /pjproject/branches/projects/jni/pjsip-apps/src/jni/Makefile	(revision 4575)
+++ /pjproject/branches/projects/jni/pjsip-apps/src/jni/Makefile	(revision 4576)
@@ -83,6 +83,6 @@
 	$(MY_JAVAC) -d $(MY_PACKAGE_BIN) -classpath "$(MY_PACKAGE_BIN)" $(TEST_SRC)/hello.java
 
-test: $(MY_PACKAGE_BIN)/hello.class
+test:
 	@# Need to specify classpath and library path, alternatively, they can be set via
 	@# CLASSPATH and java.library.path env settings
-	$(MY_JAVA) -cp $(MY_PACKAGE_BIN) -Djava.library.path="$(MY_PACKAGE_BIN)" hello
+	$(MY_JAVA) -cp $(MY_PACKAGE_BIN) -Djava.library.path="$(MY_PACKAGE_BIN)" $(TEST_PACKAGE).hello
Index: /pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/header.i
===================================================================
--- /pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/header.i	(revision 4575)
+++ /pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/header.i	(revision 4576)
@@ -77,4 +77,5 @@
 MY_JAVA_MEMBER_ARRAY_OF_POINTER(pjmedia_sdp_media, pjmedia_sdp_bandw, bandw, bandw_count)
 MY_JAVA_MEMBER_ARRAY_OF_POINTER(pjmedia_sdp_media, pjmedia_sdp_attr, attr, attr_count)
+MY_JAVA_MEMBER_ARRAY_OF_POINTER(pjsua_acc_config, pjsip_cred_info, cred_info, cred_count)
 
 %include "../callbacks.i"
Index: /pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/my_typemaps.i
===================================================================
--- /pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/my_typemaps.i	(revision 4575)
+++ /pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/my_typemaps.i	(revision 4576)
@@ -279,9 +279,9 @@
 
 %ignore CLASS_NAME::COUNT_NAME;
-%typemap(jni) 	   TYPE* NAME[ANY] "jlongArray"
-%typemap(jtype)    TYPE* NAME[ANY] "long[]"
-%typemap(jstype)   TYPE* NAME[ANY] "TYPE[]"
-%typemap(javain)   TYPE* NAME[ANY] "TYPE.cArrayUnwrap($javainput)"
-%typemap(javaout)  TYPE* NAME[ANY] {return TYPE.cArrayWrap($jnicall, $owner);}
+%typemap(jni) 	   TYPE* NAME[ANY], TYPE NAME[ANY] "jlongArray"
+%typemap(jtype)    TYPE* NAME[ANY], TYPE NAME[ANY] "long[]"
+%typemap(jstype)   TYPE* NAME[ANY], TYPE NAME[ANY] "TYPE[]"
+%typemap(javain)   TYPE* NAME[ANY], TYPE NAME[ANY] "TYPE.cArrayUnwrap($javainput)"
+%typemap(javaout)  TYPE* NAME[ANY], TYPE NAME[ANY] {return TYPE.cArrayWrap($jnicall, $owner);}
 
 %typemap(in)       TYPE* NAME[ANY] (jlong *jarr) %{
@@ -291,5 +291,11 @@
 %}
 
-%typemap(freearg)  TYPE* NAME[ANY] %{ if ($1) delete [] $1; %}
+%typemap(in)       TYPE NAME[ANY] (jlong *jarr) %{
+  if (!SWIG_JavaArrayInUlong(jenv, &jarr, (unsigned long**)&$1, $input))
+    return $null;
+  arg1->COUNT_NAME = jenv->GetArrayLength($input);
+%}
+
+%typemap(freearg)  TYPE* NAME[ANY], TYPE NAME[ANY] %{ if ($1) delete [] $1; %}
 
 %typemap(memberin) TYPE* NAME[ANY] %{
@@ -297,5 +303,9 @@
 %}
 
-%typemap(out)      TYPE* NAME[ANY] %{
+%typemap(memberin) TYPE NAME[ANY] %{
+  for (size_t i = 0; i < (size_t)arg1->COUNT_NAME; i++) $1[i] = **(TYPE**)(&$input[i]);
+%}
+
+%typemap(out)      TYPE* NAME[ANY], TYPE NAME[ANY] %{
   $result = SWIG_JavaArrayOutUlong(jenv, (unsigned long*)$1, arg1->COUNT_NAME);
 %}
Index: /pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/output/pjsua.i
===================================================================
--- /pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/output/pjsua.i	(revision 4575)
+++ /pjproject/branches/projects/jni/pjsip-apps/src/jni/jni/output/pjsua.i	(revision 4576)
@@ -77,4 +77,5 @@
 MY_JAVA_MEMBER_ARRAY_OF_POINTER(pjmedia_sdp_media, pjmedia_sdp_bandw, bandw, bandw_count)
 MY_JAVA_MEMBER_ARRAY_OF_POINTER(pjmedia_sdp_media, pjmedia_sdp_attr, attr, attr_count)
+MY_JAVA_MEMBER_ARRAY_OF_POINTER(pjsua_acc_config, pjsip_cred_info, cred_info, cred_count)
 
 %include "../callbacks.i"
Index: /pjproject/branches/projects/jni/pjsip-apps/src/jni/src/org/pjsip/hello/hello.java
===================================================================
--- /pjproject/branches/projects/jni/pjsip-apps/src/jni/src/org/pjsip/hello/hello.java	(revision 4575)
+++ /pjproject/branches/projects/jni/pjsip-apps/src/jni/src/org/pjsip/hello/hello.java	(revision 4576)
@@ -12,4 +12,12 @@
 	public static int cur_call_id = -1;
 	public static int cur_acc_id = -1;
+	
+	public static int sip_port = 6000;
+	
+	public static boolean is_reg = true;
+	public static String user = "301";
+	public static String pwd = "pw301"; 
+	public static String domain = "pjsip.org"; 
+	public static String proxy[] = { "sip:sip.pjsip.org;transport=tcp" }; 
 }
 
@@ -124,5 +132,5 @@
 			pjsua_transport_config cfg = new pjsua_transport_config();
 			pjsua.transport_config_default(cfg);
-			cfg.setPort(6000);
+			cfg.setPort(app_config.sip_port);
 			status = pjsua.transport_create(pjsip_transport_type_e.PJSIP_TRANSPORT_UDP, cfg, tp_id);
 			if (status != pjsua.PJ_SUCCESS) {
@@ -132,5 +140,5 @@
 		}
 		
-		/* Add local account */
+		/* Add UDP local account */
 		{
 			status = pjsua.acc_add_local(tp_id[0], true, acc_id);
@@ -140,4 +148,50 @@
 			}
 			app_config.cur_acc_id = acc_id[0]; 
+		}
+		
+		/* Add SIP TCP transport */
+		{
+			pjsua_transport_config cfg = new pjsua_transport_config();
+			pjsua.transport_config_default(cfg);
+			cfg.setPort(app_config.sip_port);
+			status = pjsua.transport_create(pjsip_transport_type_e.PJSIP_TRANSPORT_TCP, cfg, tp_id);
+			if (status != pjsua.PJ_SUCCESS) {
+				System.out.println("Error creating transport: " + status);
+				return status;
+			}
+		}
+		
+		/* Add TCP local account */
+		{
+			status = pjsua.acc_add_local(tp_id[0], true, acc_id);
+			if (status != pjsua.PJ_SUCCESS) {
+				System.out.println("Error creating local UDP account: " + status);
+				return status;
+			}
+			app_config.cur_acc_id = acc_id[0]; 
+		}
+		
+		/* Add registered account */
+		if (app_config.is_reg) {
+			pjsip_cred_info [] cred_info = { new pjsip_cred_info() };
+			cred_info[0].setUsername(app_config.user);
+			cred_info[0].setData_type(0);
+			cred_info[0].setData(app_config.pwd);
+			cred_info[0].setRealm("*");
+			cred_info[0].setScheme("Digest");
+
+			pjsua_acc_config acc_cfg = new pjsua_acc_config();
+			pjsua.acc_config_default(acc_cfg);
+			acc_cfg.setId("sip:" + app_config.user + "@" + app_config.domain);
+			acc_cfg.setCred_info(cred_info);
+			acc_cfg.setReg_uri("sip:" + app_config.domain);
+			acc_cfg.setProxy(app_config.proxy);
+			
+			status = pjsua.acc_add(acc_cfg, true, acc_id);
+			if (status != pjsua.PJ_SUCCESS) {
+				System.out.println("Error creating account " + acc_cfg.getId() + ": " + status);
+				return status;
+			}
+			app_config.cur_acc_id = acc_id[0];
 		}
 		
