Index: /pjproject/trunk/pjsip-apps/src/py_pjsua/pjsua_app.py
===================================================================
--- /pjproject/trunk/pjsip-apps/src/py_pjsua/pjsua_app.py	(revision 1437)
+++ /pjproject/trunk/pjsip-apps/src/py_pjsua/pjsua_app.py	(revision 1438)
@@ -20,6 +20,6 @@
 # Set C_STUN_HOST to the address:port of the STUN server to enable STUN
 #
-#C_STUN_HOST = ""
-C_STUN_HOST = "192.168.0.2"
+C_STUN_HOST = ""
+#C_STUN_HOST = "192.168.0.2"
 #C_STUN_HOST = "stun.iptel.org:3478"
 
@@ -268,10 +268,14 @@
 	acc_cfg.id = "sip:" + acc_username + "@" + acc_domain
 	acc_cfg.reg_uri = "sip:" + acc_domain
-	acc_cfg.cred_count = 1
-	acc_cfg.cred_info[0].realm = acc_domain
-	acc_cfg.cred_info[0].scheme = "digest"
-	acc_cfg.cred_info[0].username = acc_username
-	acc_cfg.cred_info[0].data_type = 0
-	acc_cfg.cred_info[0].data = acc_passwd
+
+	cred_info = py_pjsua.Pjsip_Cred_Info()
+	cred_info.realm = "*"
+	cred_info.scheme = "digest"
+	cred_info.username = acc_username
+	cred_info.data_type = 0
+	cred_info.data = acc_passwd
+
+	acc_cfg.cred_info.append(1)
+	acc_cfg.cred_info[0] = cred_info
 
 	# Add new SIP account
@@ -339,6 +343,6 @@
 		info = py_pjsua.conf_get_port_info(port)
 		txlist = ""
-		for i in range(info.listener_cnt):
-			txlist = txlist + "#" + `info.listeners[i]` + " "
+		for listener in info.listeners:
+			txlist = txlist + "#" + `listener` + " "
 		
 		print "Port #" + `info.slot_id` + "[" + `(info.clock_rate/1000)` + "KHz/" + `(info.samples_per_frame * 1000 / info.clock_rate)` + "ms] " + info.name + " transmitting to: " + txlist
Index: /pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.c	(revision 1437)
+++ /pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.c	(revision 1438)
@@ -2404,5 +2404,4 @@
     unsigned  samples_per_frame;
     unsigned  bits_per_sample;
-    unsigned  listener_cnt;
     PyListObject * listeners;
 
@@ -2444,5 +2443,5 @@
         }        
 	
-	self->listeners = (PyListObject *)PyList_New(PJSUA_MAX_CONF_PORTS);
+	self->listeners = (PyListObject *)PyList_New(0);
         if (self->listeners == NULL)
     	{
@@ -2488,9 +2487,4 @@
         offsetof(PyObj_pjsua_conf_port_info, bits_per_sample), 0,
         "Bits per sample"
-    },
-    {
-        "listener_cnt", T_INT, 
-        offsetof(PyObj_pjsua_conf_port_info, listener_cnt), 0,
-        "Number of listeners in the array."
     },
     {
@@ -3167,5 +3161,5 @@
     pjsua_conf_port_info info;
     int status;	
-    int i;
+    unsigned i;
 
     PJ_UNUSED_ARG(pSelf);
@@ -3183,10 +3177,10 @@
     obj->channel_count = info.bits_per_sample;
     obj->clock_rate = info.clock_rate;
-    obj->listener_cnt = info.listener_cnt;
     obj->name = PyString_FromStringAndSize(info.name.ptr, info.name.slen);
     obj->samples_per_frame = info.samples_per_frame;
     obj->slot_id = info.slot_id;
     
-    for (i = 0; i < PJSUA_MAX_CONF_PORTS; i++) {
+    obj->listeners = (PyListObject *)PyList_New(info.listener_cnt);
+    for (i = 0; i < info.listener_cnt; i++) {
 	PyObject * item = Py_BuildValue("i",info.listeners[i]);
 	PyList_SetItem((PyObject *)obj->listeners, i, item);
Index: /pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.h
===================================================================
--- /pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.h	(revision 1437)
+++ /pjproject/trunk/pjsip-apps/src/py_pjsua/py_pjsua.h	(revision 1438)
@@ -29,6 +29,11 @@
     pj_str_t str;
 
-    str.ptr = PyString_AS_STRING(obj);
-    str.slen = PyString_GET_SIZE(obj);
+    if (obj) {
+	str.ptr = PyString_AS_STRING(obj);
+	str.slen = PyString_GET_SIZE(obj);
+    } else {
+	str.ptr = NULL;
+	str.slen = 0;
+    }
 
     return str;
@@ -1906,10 +1911,10 @@
 						    cfg->force_contact.slen);
     Py_XDECREF(obj->proxy);
-    obj->proxy = (PyListObject *)PyList_New(8);
+    obj->proxy = (PyListObject *)PyList_New(0);
     for (i=0; i<cfg->proxy_cnt; ++i) {
 	PyObject * str;
 	str = PyString_FromStringAndSize(cfg->proxy[i].ptr, 
 					 cfg->proxy[i].slen);
-	PyList_SetItem((PyObject *)obj->proxy, i, str);
+	PyList_Append((PyObject *)obj->proxy, str);
     }
 
@@ -1917,5 +1922,5 @@
 
     Py_XDECREF(obj->cred_info);
-    obj->cred_info = (PyListObject *)PyList_New(8);
+    obj->cred_info = (PyListObject *)PyList_New(0);
     for (i=0; i<cfg->cred_count; ++i) {
 	PyObj_pjsip_cred_info * ci;
@@ -1924,5 +1929,5 @@
 	     PyObj_pjsip_cred_info_new(&PyTyp_pjsip_cred_info,NULL,NULL);
 	PyObj_pjsip_cred_info_import(ci, &cfg->cred_info[i]);
-	PyList_SetItem((PyObject *)obj->cred_info, i, (PyObject *)ci);
+	PyList_Append((PyObject *)obj->cred_info, (PyObject *)ci);
     }
 
@@ -1992,10 +1997,10 @@
             return NULL;
         }
-	self->proxy = (PyListObject *)PyList_New(8);
+	self->proxy = (PyListObject *)PyList_New(0);
 	if (self->proxy == NULL) {
 	    Py_DECREF(self);
 	    return NULL;
 	}
-	self->cred_info = (PyListObject *)PyList_New(8);
+	self->cred_info = (PyListObject *)PyList_New(0);
 	if (self->cred_info == NULL) {
 	    Py_DECREF(self);
