Index: /pjproject/branches/symbian/pjlib/src/pj/addr_resolv_sock.c
===================================================================
--- /pjproject/branches/symbian/pjlib/src/pj/addr_resolv_sock.c	(revision 1191)
+++ /pjproject/branches/symbian/pjlib/src/pj/addr_resolv_sock.c	(revision 1192)
@@ -50,2 +50,63 @@
 }
 
+/* Resolve the IP address of local machine */
+PJ_DEF(pj_status_t) pj_gethostip(pj_in_addr *addr)
+{
+    const pj_str_t *hostname = pj_gethostname();
+    struct pj_hostent he;
+    pj_status_t status;
+
+
+#ifdef _MSC_VER
+    /* Get rid of "uninitialized he variable" with MS compilers */
+    pj_memset(&he, 0, sizeof(he));
+#endif
+
+    /* Try with resolving local hostname first */
+    status = pj_gethostbyname(hostname, &he);
+    if (status == PJ_SUCCESS) {
+	*addr = *(pj_in_addr*)he.h_addr;
+    }
+
+
+    /* If we end up with 127.x.x.x, resolve the IP by getting the default
+     * interface to connect to some public host.
+     */
+    if (status != PJ_SUCCESS || (pj_ntohl(addr->s_addr) >> 24)==127) {
+	pj_sock_t fd;
+	pj_str_t cp;
+	pj_sockaddr_in a;
+	int len;
+
+	status = pj_sock_socket(PJ_AF_INET, PJ_SOCK_DGRAM, 0, &fd);
+	if (status != PJ_SUCCESS) {
+	    return status;
+	}
+
+	cp = pj_str("1.1.1.1");
+	pj_sockaddr_in_init(&a, &cp, 53);
+
+	status = pj_sock_connect(fd, &a, sizeof(a));
+	if (status != PJ_SUCCESS) {
+	    pj_sock_close(fd);
+	    /* Return 127.0.0.1 as the address */
+	    return PJ_SUCCESS;
+	}
+
+	len = sizeof(a);
+	status = pj_sock_getsockname(fd, &a, &len);
+	if (status != PJ_SUCCESS) {
+	    pj_sock_close(fd);
+	    /* Return 127.0.0.1 as the address */
+	    return PJ_SUCCESS;
+	}
+
+	pj_sock_close(fd);
+
+	*addr = a.sin_addr;
+    }
+
+    return status;
+}
+
+
Index: /pjproject/branches/symbian/pjlib/src/pj/sock_bsd.c
===================================================================
--- /pjproject/branches/symbian/pjlib/src/pj/sock_bsd.c	(revision 1191)
+++ /pjproject/branches/symbian/pjlib/src/pj/sock_bsd.c	(revision 1192)
@@ -633,6 +633,4 @@
     PJ_ASSERT_RETURN(newsock != NULL, PJ_EINVAL);
 
-    hello
-
 #if defined(PJ_SOCKADDR_HAS_LEN) && PJ_SOCKADDR_HAS_LEN!=0
     if (addr) {
Index: /pjproject/branches/symbian/pjsip/src/pjsip/sip_transaction.c
===================================================================
--- /pjproject/branches/symbian/pjsip/src/pjsip/sip_transaction.c	(revision 1191)
+++ /pjproject/branches/symbian/pjsip/src/pjsip/sip_transaction.c	(revision 1192)
@@ -126,4 +126,6 @@
 static const pj_time_val t1_timer_val = { PJSIP_T1_TIMEOUT/1000, 
                                           PJSIP_T1_TIMEOUT%1000 };
+static const pj_time_val t2_timer_val = { PJSIP_T2_TIMEOUT/1000, 
+                                          PJSIP_T2_TIMEOUT%1000 };
 static const pj_time_val t4_timer_val = { PJSIP_T4_TIMEOUT/1000, 
                                           PJSIP_T4_TIMEOUT%1000 };
@@ -1704,5 +1706,10 @@
     pj_assert((tsx->transport_flag & TSX_HAS_PENDING_TRANSPORT) == 0);
 
-    msec_time = (1 << (tsx->retransmit_count)) * PJSIP_T1_TIMEOUT;
+    pj_assert(tsx->status_code < 200);
+
+    if (tsx->status_code >= 100)
+	msec_time = PJSIP_T2_TIMEOUT;
+    else
+	msec_time = (1 << (tsx->retransmit_count)) * PJSIP_T1_TIMEOUT;
 
     if (tsx->role == PJSIP_ROLE_UAC) {
@@ -1879,23 +1886,55 @@
     } else if (event->type == PJSIP_EVENT_RX_MSG) {
 	pjsip_msg *msg;
-	//int code;
+	int code;
 
 	/* Get message instance */
 	msg = event->body.rx_msg.rdata->msg_info.msg;
 
-	/* Better be a response message. */
-	if (msg->type != PJSIP_RESPONSE_MSG)
-	    return PJSIP_ENOTRESPONSEMSG;
-
-	/* Cancel retransmission timer A. */
-	if (tsx->retransmit_timer._timer_id != -1) {
-	    pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer);
-	    tsx->retransmit_timer._timer_id = -1;
-	}
+	code = msg->line.status.code;
+
+	/* If the response is final, cancel both retransmission and timeout
+	 * timer.
+	 */
+	if (code >= 200) {
+	    if (tsx->retransmit_timer._timer_id != -1) {
+		pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer);
+		tsx->retransmit_timer._timer_id = -1;
+	    }
+
+	    if (tsx->timeout_timer._timer_id != -1) {
+		pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer);
+		tsx->timeout_timer._timer_id = -1;
+	    }
+
+	} else {
+	    /* Cancel retransmit timer (for non-INVITE transaction, the
+	     * retransmit timer will be rescheduled at T2.
+	     */
+	    if (tsx->retransmit_timer._timer_id != -1) {
+		pjsip_endpt_cancel_timer(tsx->endpt, &tsx->retransmit_timer);
+		tsx->retransmit_timer._timer_id = -1;
+	    }
+
+	    /* For provisional response, only cancel retransmit when this
+	     * is an INVITE transaction. For non-INVITE, section 17.1.2.1
+	     * of RFC 3261 says that:
+	     *	- retransmit timer is set to T2
+	     *	- timeout timer F is not deleted.
+	     */
+	    if (tsx->method.id == PJSIP_INVITE_METHOD) {
+
+		/* Cancel timeout timer */
+		pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer);
+
+	    } else {
+		if (!tsx->is_reliable) {
+		    pjsip_endpt_schedule_timer(tsx->endpt, 
+					       &tsx->retransmit_timer,
+					       &t2_timer_val);
+		}
+	    }
+	}
+ 
 	tsx->transport_flag &= ~(TSX_HAS_PENDING_RESCHED);
-
-
-	/* Cancel timer B (transaction timeout) */
-	pjsip_endpt_cancel_timer(tsx->endpt, &tsx->timeout_timer);
 
 	/* Discard retransmission message if it is not INVITE.
@@ -2222,5 +2261,15 @@
 	tsx->status_code = msg->line.status.code;
     } else {
-	tsx->status_code = PJSIP_SC_TSX_TIMEOUT;
+	if (event->body.timer.entry == &tsx->retransmit_timer) {
+	    /* Retransmit message. */
+            pj_status_t status;
+
+            status = tsx_retransmit( tsx, 1 );
+	    
+	    return status;
+
+	} else {
+	    tsx->status_code = PJSIP_SC_TSX_TIMEOUT;
+	}
     }
 
@@ -2266,4 +2315,12 @@
 	}
 
+    } else if (event->type == PJSIP_EVENT_TIMER &&
+	       event->body.timer.entry == &tsx->timeout_timer) {
+
+	/* Inform TU. */
+	tsx_set_state( tsx, PJSIP_TSX_STATE_TERMINATED, 
+		       PJSIP_EVENT_TIMER, &tsx->timeout_timer);
+
+
     } else if (tsx->status_code >= 300 && tsx->status_code <= 699) {
 
Index: /pjproject/branches/symbian/pjsip/src/pjsua-lib/pjsua_core.c
===================================================================
--- /pjproject/branches/symbian/pjsip/src/pjsua-lib/pjsua_core.c	(revision 1191)
+++ /pjproject/branches/symbian/pjsip/src/pjsua-lib/pjsua_core.c	(revision 1192)
@@ -494,5 +494,5 @@
 
     /* Init caching pool. */
-    pj_caching_pool_init(&pjsua.cp, &pj_pool_factory_default_policy, 0);
+    pj_caching_pool_init(&pjsua.cp, pj_pool_factory_get_default_policy(), 0);
 
     /* Create memory pool for application. */
