Index: /pjproject/trunk/pjsip/include/pjsip/sip_endpoint.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_endpoint.h	(revision 229)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_endpoint.h	(revision 230)
@@ -46,5 +46,4 @@
  *  - it manages listeners and transports, and how they are used by 
  *    transactions.
- *  - it owns transaction hash table.
  *  - it receives incoming messages from transport layer and automatically
  *    dispatches them to the correct transaction (or create a new one).
@@ -53,6 +52,4 @@
  *  - it provides single polling function for all objects and distributes 
  *    events.
- *  - it provides SIP policy such as which outbound proxy to use for all
- *    outgoing SIP request messages.
  *  - it automatically handles incoming requests which can not be handled by
  *    existing modules (such as when incoming request has unsupported method).
@@ -142,16 +139,4 @@
 PJ_DECL(void) pjsip_endpt_cancel_timer( pjsip_endpoint *endpt, 
 					pj_timer_entry *entry );
-
-
-/**
- * Dump endpoint status to the log. This will print the status to the log
- * with log level 3.
- *
- * @param endpt		The endpoint.
- * @param detail	If non zero, then it will dump a detailed output.
- *			BEWARE that this option may crash the system because
- *			it tries to access all memory pools.
- */
-PJ_DECL(void) pjsip_endpt_dump( pjsip_endpoint *endpt, pj_bool_t detail );
 
 
@@ -395,4 +380,5 @@
 /**
  * Get list of additional headers to be put in outgoing request message.
+ * Currently only Max-Forwards are defined.
  *
  * @param e	    The endpoint.
@@ -404,33 +390,15 @@
 
 /**
- * Set list of SIP proxies to be visited for all outbound request messages.
- * Application can call this function to specify how outgoing request messages
- * should be routed. For example, if outgoing requests should go through an
- * outbound proxy, then application can specify the URL of the proxy when
- * calling this function. More than one proxy can be specified, and the
- * order of which proxy is specified when calling this function specifies
- * the order of which proxy will be visited first by the request messages.
- *
- * @param endpt	    The endpoint instance.
- * @param url_cnt   Number of proxies/URLs in the array.
- * @param url	    Array of proxy URL, which specifies the order of which
- *		    proxy will be visited first (e.g. url[0] will be visited
- *		    before url[1]).
- *
- * @return	    Zero on success.
- */
-PJ_DECL(pj_status_t) pjsip_endpt_set_proxies( pjsip_endpoint *endpt,
-					      int url_cnt, const pj_str_t url[]);
-
-/**
- * Get the list of "Route" header that are configured for this endpoint.
- * The "Route" header specifies how outbound request messages will be sent,
- * and is built when application sets the outbound proxy.
- *
- * @param endpt	    The endpoint instance.
- *
- * @return	    List of "Route" header.
- */
-PJ_DECL(const pjsip_route_hdr*) pjsip_endpt_get_routing( pjsip_endpoint *endpt );
+ * Dump endpoint status to the log. This will print the status to the log
+ * with log level 3.
+ *
+ * @param endpt		The endpoint.
+ * @param detail	If non zero, then it will dump a detailed output.
+ *			BEWARE that this option may crash the system because
+ *			it tries to access all memory pools.
+ */
+PJ_DECL(void) pjsip_endpt_dump( pjsip_endpoint *endpt, pj_bool_t detail );
+
+
 
 /**
Index: /pjproject/trunk/pjsip/include/pjsip/sip_module.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_module.h	(revision 229)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_module.h	(revision 230)
@@ -62,10 +62,4 @@
      */
     int priority;
-
-    /**
-     * Opaque data which can be used by a module to identify a resource within
-     * the module itself.
-     */
-    void *user_data;
 
     /**
@@ -167,4 +161,5 @@
     PJSIP_MOD_PRIORITY_TSX_LAYER	= 16,
     PJSIP_MOD_PRIORITY_UA_PROXY_LAYER	= 32,
+    PJSIP_MOD_PRIORITY_DIALOG_USAGE	= 48,
     PJSIP_MOD_PRIORITY_APPLICATION	= 64,
 };
Index: /pjproject/trunk/pjsip/include/pjsip/sip_transaction.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_transaction.h	(revision 229)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_transaction.h	(revision 230)
@@ -121,5 +121,5 @@
  * @return	    PJ_SUCCESS on success.
  */
-PJ_DECL(pj_status_t) pjsip_tsx_layer_init(pjsip_endpoint *endpt);
+PJ_DECL(pj_status_t) pjsip_tsx_layer_init_module(pjsip_endpoint *endpt);
 
 /**
Index: /pjproject/trunk/pjsip/include/pjsip/sip_ua_layer.h
===================================================================
--- /pjproject/trunk/pjsip/include/pjsip/sip_ua_layer.h	(revision 229)
+++ /pjproject/trunk/pjsip/include/pjsip/sip_ua_layer.h	(revision 230)
@@ -56,6 +56,6 @@
  * @return		PJ_SUCCESS on success.
  */
-PJ_DECL(pj_status_t) pjsip_ua_init(pjsip_endpoint *endpt,
-				   const pjsip_ua_init_param *prm);
+PJ_DECL(pj_status_t) pjsip_ua_init_module(pjsip_endpoint *endpt,
+					  const pjsip_ua_init_param *prm);
 
 /**
Index: /pjproject/trunk/pjsip/src/pjsip-simple/evsub.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-simple/evsub.c	(revision 229)
+++ /pjproject/trunk/pjsip/src/pjsip-simple/evsub.c	(revision 230)
@@ -170,18 +170,17 @@
 {
     {
-	NULL, NULL,		    /* prev, next.			*/
-	{ "mod-evsub", 9 },	    /* Name.				*/
-	-1,			    /* Id				*/
-	PJSIP_MOD_PRIORITY_APPLICATION-1,	/* Priority		*/
-	NULL,			    /* User data.			*/
-	NULL,			    /* load()				*/
-	NULL,			    /* start()				*/
-	NULL,			    /* stop()				*/
-	&mod_evsub_unload,	    /* unload()				*/
-	NULL,			    /* on_rx_request()			*/
-	NULL,			    /* on_rx_response()			*/
-	NULL,			    /* on_tx_request.			*/
-	NULL,			    /* on_tx_response()			*/
-	&mod_evsub_on_tsx_state,    /* on_tsx_state()			*/
+	NULL, NULL,			    /* prev, next.		*/
+	{ "mod-evsub", 9 },		    /* Name.			*/
+	-1,				    /* Id			*/
+	PJSIP_MOD_PRIORITY_DIALOG_USAGE,    /* Priority			*/
+	NULL,				    /* load()			*/
+	NULL,				    /* start()			*/
+	NULL,				    /* stop()			*/
+	&mod_evsub_unload,		    /* unload()			*/
+	NULL,				    /* on_rx_request()		*/
+	NULL,				    /* on_rx_response()		*/
+	NULL,				    /* on_tx_request.		*/
+	NULL,				    /* on_tx_response()		*/
+	&mod_evsub_on_tsx_state,	    /* on_tsx_state()		*/
     }
 };
Index: /pjproject/trunk/pjsip/src/pjsip-simple/presence.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-simple/presence.c	(revision 229)
+++ /pjproject/trunk/pjsip/src/pjsip-simple/presence.c	(revision 230)
@@ -42,6 +42,5 @@
     { "mod-presence", 12 },	    /* Name.				*/
     -1,				    /* Id				*/
-    PJSIP_MOD_PRIORITY_APPLICATION-1,	/* Priority			*/
-    NULL,			    /* User data.			*/
+    PJSIP_MOD_PRIORITY_DIALOG_USAGE,/* Priority				*/
     NULL,			    /* load()				*/
     NULL,			    /* start()				*/
Index: /pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c	(revision 229)
+++ /pjproject/trunk/pjsip/src/pjsip-ua/sip_inv.c	(revision 230)
@@ -71,18 +71,17 @@
 {
     {
-	NULL, NULL,		    /* prev, next.			*/
-	{ "mod-invite", 10 },	    /* Name.				*/
-	-1,			    /* Id				*/
-	PJSIP_MOD_PRIORITY_APPLICATION-1,	/* Priority		*/
-	NULL,			    /* User data.			*/
-	&mod_inv_load,		    /* load()				*/
-	NULL,			    /* start()				*/
-	NULL,			    /* stop()				*/
-	&mod_inv_unload,	    /* unload()				*/
-	&mod_inv_on_rx_request,	    /* on_rx_request()			*/
-	&mod_inv_on_rx_response,    /* on_rx_response()			*/
-	NULL,			    /* on_tx_request.			*/
-	NULL,			    /* on_tx_response()			*/
-	&mod_inv_on_tsx_state,	    /* on_tsx_state()			*/
+	NULL, NULL,			    /* prev, next.		*/
+	{ "mod-invite", 10 },		    /* Name.			*/
+	-1,				    /* Id			*/
+	PJSIP_MOD_PRIORITY_DIALOG_USAGE,    /* Priority			*/
+	&mod_inv_load,			    /* load()			*/
+	NULL,				    /* start()			*/
+	NULL,				    /* stop()			*/
+	&mod_inv_unload,		    /* unload()			*/
+	&mod_inv_on_rx_request,		    /* on_rx_request()		*/
+	&mod_inv_on_rx_response,	    /* on_rx_response()		*/
+	NULL,				    /* on_tx_request.		*/
+	NULL,				    /* on_tx_response()		*/
+	&mod_inv_on_tsx_state,		    /* on_tsx_state()		*/
     }
 };
Index: /pjproject/trunk/pjsip/src/pjsip-ua/sip_xfer.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip-ua/sip_xfer.c	(revision 229)
+++ /pjproject/trunk/pjsip/src/pjsip-ua/sip_xfer.c	(revision 230)
@@ -34,18 +34,17 @@
 static struct pjsip_module mod_xfer = 
 {
-    NULL, NULL,			    /* prev, next.			*/
-    { "mod-refer", 9 },		    /* Name.				*/
-    -1,				    /* Id				*/
-    PJSIP_MOD_PRIORITY_APPLICATION-1,	/* Priority			*/
-    NULL,			    /* User data.			*/
-    NULL,			    /* load()				*/
-    NULL,			    /* start()				*/
-    NULL,			    /* stop()				*/
-    NULL,			    /* unload()				*/
-    NULL,			    /* on_rx_request()			*/
-    NULL,			    /* on_rx_response()			*/
-    NULL,			    /* on_tx_request.			*/
-    NULL,			    /* on_tx_response()			*/
-    NULL,			    /* on_tsx_state()			*/
+    NULL, NULL,				/* prev, next.			*/
+    { "mod-refer", 9 },			/* Name.			*/
+    -1,					/* Id				*/
+    PJSIP_MOD_PRIORITY_DIALOG_USAGE,	/* Priority			*/
+    NULL,				/* load()			*/
+    NULL,				/* start()			*/
+    NULL,				/* stop()			*/
+    NULL,				/* unload()			*/
+    NULL,				/* on_rx_request()		*/
+    NULL,				/* on_rx_response()		*/
+    NULL,				/* on_tx_request.		*/
+    NULL,				/* on_tx_response()		*/
+    NULL,				/* on_tsx_state()		*/
 };
 
Index: /pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c	(revision 229)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c	(revision 230)
@@ -78,7 +78,4 @@
     pjsip_module	 module_list;
 
-    /** Route header list. */
-    pjsip_route_hdr	 route_hdr_list;
-
     /** Capability header list. */
     pjsip_hdr		 cap_hdr;
@@ -371,47 +368,4 @@
 }
 
-PJ_DEF(pj_status_t) pjsip_endpt_set_proxies( pjsip_endpoint *endpt,
-					     int url_cnt, const pj_str_t url[])
-{
-    int i;
-    pjsip_route_hdr *hdr;
-    pj_str_t str_ROUTE = { "Route", 5 };
-
-    /* Lock endpoint mutex. */
-    pj_mutex_lock(endpt->mutex);
-
-    pj_list_init(&endpt->route_hdr_list);
-
-    for (i=0; i<url_cnt; ++i) {
-	int len = url[i].slen;
-	char *dup = pj_pool_alloc(endpt->pool, len + 1);
-	pj_memcpy(dup, url[i].ptr, len);
-	dup[len] = '\0';
-
-	hdr = pjsip_parse_hdr(endpt->pool, &str_ROUTE, dup, len, NULL);
-	if (!hdr) {
-	    pj_mutex_unlock(endpt->mutex);
-	    PJ_LOG(4,(THIS_FILE, "Invalid URL %s in proxy URL", dup));
-	    return -1;
-	}
-
-	pj_assert(hdr->type == PJSIP_H_ROUTE);
-	pj_list_insert_before(&endpt->route_hdr_list, hdr);
-    }
-
-    /* Unlock endpoint mutex. */
-    pj_mutex_unlock(endpt->mutex);
-
-    return 0;
-}
-
-/*
- * Get "Route" header list.
- */
-PJ_DEF(const pjsip_route_hdr*) pjsip_endpt_get_routing( pjsip_endpoint *endpt )
-{
-    return &endpt->route_hdr_list;
-}
-
 
 /*
@@ -521,7 +475,4 @@
     /* Initialize request headers. */
     pj_list_init(&endpt->req_hdr);
-
-    /* Initialist "Route" header list. */
-    pj_list_init(&endpt->route_hdr_list);
 
     /* Add "Max-Forwards" for request header. */
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transaction.c	(revision 229)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transaction.c	(revision 230)
@@ -68,5 +68,4 @@
 	-1,				/* Module ID		    */
 	PJSIP_MOD_PRIORITY_TSX_LAYER,	/* Priority.		    */
-	NULL,				/* User_data.		    */
 	mod_tsx_layer_load,		/* load().		    */
 	mod_tsx_layer_start,		/* start()		    */
@@ -411,5 +410,5 @@
  * Create transaction layer module and registers it to the endpoint.
  */
-PJ_DEF(pj_status_t) pjsip_tsx_layer_init(pjsip_endpoint *endpt)
+PJ_DEF(pj_status_t) pjsip_tsx_layer_init_module(pjsip_endpoint *endpt)
 {
     pj_pool_t *pool;
Index: /pjproject/trunk/pjsip/src/pjsip/sip_transport.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_transport.c	(revision 229)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_transport.c	(revision 230)
@@ -48,5 +48,4 @@
     -1,					/* Id				    */
     PJSIP_MOD_PRIORITY_TRANSPORT_LAYER,	/* Priority			    */
-    NULL,				/* User data.			    */
     NULL,				/* load()			    */
     NULL,				/* start()			    */
Index: /pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c	(revision 229)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_ua_layer.c	(revision 230)
@@ -90,5 +90,4 @@
     -1,			    /* Id				*/
     PJSIP_MOD_PRIORITY_UA_PROXY_LAYER,	/* Priority		*/
-    NULL,		    /* User data.			*/
     &mod_ua_load,	    /* load()				*/
     NULL,		    /* start()				*/
@@ -183,6 +182,6 @@
  * Init user agent module and register it to the endpoint.
  */
-PJ_DEF(pj_status_t) pjsip_ua_init( pjsip_endpoint *endpt,
-				   const pjsip_ua_init_param *prm)
+PJ_DEF(pj_status_t) pjsip_ua_init_module( pjsip_endpoint *endpt,
+					  const pjsip_ua_init_param *prm)
 {
     pj_status_t status;
Index: /pjproject/trunk/pjsip/src/pjsip/sip_util_statefull.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsip/sip_util_statefull.c	(revision 229)
+++ /pjproject/trunk/pjsip/src/pjsip/sip_util_statefull.c	(revision 230)
@@ -42,5 +42,4 @@
     -1,				    /* Id				*/
     PJSIP_MOD_PRIORITY_APPLICATION, /* Priority				*/
-    NULL,			    /* User data.			*/
     NULL,			    /* load()				*/
     NULL,			    /* start()				*/
Index: /pjproject/trunk/pjsip/src/pjsua/main.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua/main.c	(revision 229)
+++ /pjproject/trunk/pjsip/src/pjsua/main.c	(revision 230)
@@ -282,5 +282,5 @@
 	    }
 	}
-	printf("Port #%02d %20.*s  tx to: %s\n", 
+	printf("Port #%02d %20.*s  transmitting to: %s\n", 
 	       port_info->slot, 
 	       (int)port_info->name.slen, 
@@ -680,5 +680,4 @@
     -1,					/* Id			*/
     PJSIP_MOD_PRIORITY_TRANSPORT_LAYER-1,/* Priority	        */
-    NULL,				/* User data.		*/
     NULL,				/* load()		*/
     NULL,				/* start()		*/
@@ -765,4 +764,5 @@
 int main(int argc, char *argv[])
 {
+
     /* Init default settings. */
 
Index: /pjproject/trunk/pjsip/src/pjsua/pjsua_core.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua/pjsua_core.c	(revision 229)
+++ /pjproject/trunk/pjsip/src/pjsua/pjsua_core.c	(revision 230)
@@ -345,5 +345,5 @@
     /* Initialize transaction layer: */
 
-    status = pjsip_tsx_layer_init(pjsua.endpt);
+    status = pjsip_tsx_layer_init_module(pjsua.endpt);
     if (status != PJ_SUCCESS) {
 	pjsua_perror(THIS_FILE, "Transaction layer initialization error", 
@@ -354,5 +354,5 @@
     /* Initialize UA layer module: */
 
-    status = pjsip_ua_init( pjsua.endpt, NULL );
+    status = pjsip_ua_init_module( pjsua.endpt, NULL );
     if (status != PJ_SUCCESS) {
 	pjsua_perror(THIS_FILE, "UA layer initialization error", status);
@@ -369,5 +369,4 @@
 	-1,			    /* Id				*/
 	PJSIP_MOD_PRIORITY_APPLICATION,	/* Priority			*/
-	NULL,			    /* User data.			*/
 	NULL,			    /* load()				*/
 	NULL,			    /* start()				*/
Index: /pjproject/trunk/pjsip/src/pjsua/pjsua_pres.c
===================================================================
--- /pjproject/trunk/pjsip/src/pjsua/pjsua_pres.c	(revision 229)
+++ /pjproject/trunk/pjsip/src/pjsua/pjsua_pres.c	(revision 230)
@@ -44,5 +44,4 @@
     -1,					/* Id			*/
     PJSIP_MOD_PRIORITY_APPLICATION,	/* Priority	        */
-    NULL,				/* User data.		*/
     NULL,				/* load()		*/
     NULL,				/* start()		*/
