Index: /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c
===================================================================
--- /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 881)
+++ /pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c	(revision 882)
@@ -2892,4 +2892,20 @@
     }
 
+    /* Add UDP transport unless it's disabled. */
+    if (!app_config.no_udp) {
+	pjsua_acc_id aid;
+
+	status = pjsua_transport_create(PJSIP_TRANSPORT_UDP,
+					&app_config.udp_cfg, 
+					&transport_id);
+	if (status != PJ_SUCCESS)
+	    goto on_error;
+
+	/* Add local account */
+	pjsua_acc_add_local(transport_id, PJ_TRUE, &aid);
+	//pjsua_acc_set_transport(aid, transport_id);
+	pjsua_acc_set_online_status(current_acc, PJ_TRUE);
+    }
+
     /* Add TCP transport unless it's disabled */
     if (!app_config.no_tcp) {
@@ -2906,16 +2922,4 @@
     }
 
-    /* Add UDP transport unless it's disabled. */
-    if (!app_config.no_udp) {
-	status = pjsua_transport_create(PJSIP_TRANSPORT_UDP,
-					&app_config.udp_cfg, 
-					&transport_id);
-	if (status != PJ_SUCCESS)
-	    goto on_error;
-
-	/* Add local account */
-	pjsua_acc_add_local(transport_id, PJ_TRUE, NULL);
-	pjsua_acc_set_online_status(current_acc, PJ_TRUE);
-    }
 
 #if defined(PJSIP_HAS_TLS_TRANSPORT) && PJSIP_HAS_TLS_TRANSPORT!=0
Index: /pjproject/trunk/pjsip/include/pjsip/sip_dialog.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_dialog.h	(revision 881)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_dialog.h	(revision 882)
@@ -231,6 +231,6 @@
  * Lock/bind dialog to a specific transport/listener. This is optional,
  * as normally transport will be selected automatically based on the 
- * destination of requests upon resolver completion. When the dialog is 
- * explicitly bound to the specific transport/listener, all UAC transactions
+ * destination of messages upon resolver completion. When the dialog is 
+ * explicitly bound to the specific transport/listener, all transactions
  * originated by this dialog will use the specified transport/listener
  * when sending outgoing requests.
Index: /pjproject/trunk/pjsip/include/pjsip/sip_transaction.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_transaction.h	(revision 881)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_transaction.h	(revision 882)
@@ -219,11 +219,7 @@
  * Lock/bind transaction to a specific transport/listener. This is optional,
  * as normally transport will be selected automatically based on the 
- * destination of the request upon resolver completion. Also it's only valid
- * for UAC transaction (to send outgoing request), since for UAS the
- * transport will be selected according to rules about handling incoming
- * request (most likely it will use the transport where the request is
- * coming from if ";rport" parameter is present in Via header).
- *
- * @param tsx	    The UAC transaction.
+ * destination of the message upon resolver completion.
+ *
+ * @param tsx	    The transaction.
  * @param sel	    Transport selector containing the specification of
  *		    transport or listener to be used by this transaction
Index: /pjproject/trunk/pjsip/include/pjsip/sip_transport.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_transport.h	(revision 881)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_transport.h	(revision 882)
@@ -212,4 +212,5 @@
 	pjsip_transport	*transport;
 	pjsip_tpfactory	*listener;
+	void		*ptr;
     } u;
 
Index: /pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_dialog.c	(revision 881)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_dialog.c	(revision 882)
@@ -1326,4 +1326,15 @@
     pjsip_dlg_inc_lock(dlg);
 
+    /* If the dialog is locked to transport, make sure that transaction
+     * is locked to the same transport too.
+     */
+    if (dlg->tp_sel.type != tsx->tp_sel.type ||
+	dlg->tp_sel.u.ptr != tsx->tp_sel.u.ptr)
+    {
+	status = pjsip_tsx_set_transport(tsx, &dlg->tp_sel);
+	pj_assert(status == PJ_SUCCESS);
+    }
+
+    /* Ask transaction to send the response */
     status = pjsip_tsx_send_msg(tsx, tdata);
 
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transaction.c	(revision 881)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transaction.c	(revision 882)
@@ -1375,5 +1375,5 @@
 
     /* Must be UAC transaction */
-    PJ_ASSERT_RETURN(tsx && sel && tsx->role == PJSIP_ROLE_UAC, PJ_EINVAL);
+    PJ_ASSERT_RETURN(tsx && sel, PJ_EINVAL);
 
     /* Start locking the transaction. */
