Index: pjproject/trunk/pjsip/include/pjsip/sip_endpoint.h
===================================================================
--- pjproject/trunk/pjsip/include/pjsip/sip_endpoint.h	(revision 5054)
+++ pjproject/trunk/pjsip/include/pjsip/sip_endpoint.h	(revision 5055)
@@ -392,4 +392,22 @@
 
 /**
+ * Set the DNS external resolver implementation to use in the SIP resolver. 
+ *
+ * Note that naturally when implementing its own resolver, application would not
+ * need the internal resolver, hence this function will also destroy the 
+ * PJLIB-UTIL DNS resolver if any (e.g: set using #pjsip_endpt_set_resolver()). 
+ * Application that needs it, still be able create its own instance. 
+ *
+ * @param res       The SIP resolver engine.
+ * @param ext_res   The external resolver implementation callback. This argument
+ *		    can be NULL to reset the whole external implementation. 
+ *		    However, it is prohibited to reset individual callback.
+ * 
+ * @return	    PJ_SUCCESS on success, or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsip_endpt_set_ext_resolver(pjsip_endpoint *endpt,
+						  pjsip_ext_resolver *ext_res);
+
+/**
  * Get the DNS resolver being used by the SIP resolver.
  *
Index: pjproject/trunk/pjsip/include/pjsip/sip_resolve.h
===================================================================
--- pjproject/trunk/pjsip/include/pjsip/sip_resolve.h	(revision 5054)
+++ pjproject/trunk/pjsip/include/pjsip/sip_resolve.h	(revision 5055)
@@ -119,4 +119,5 @@
  *    response caching, query aggregation, parallel nameservers, fallback
  *    nameserver, etc., which will be described below.
+ *  - Enable application to provide its own resolver implementation.  
  * 
  *
@@ -156,4 +157,12 @@
  * PJSIP needs to send SIP request/response messages.
  *
+ * \section PJSIP_RESOLVE_EXT_RESOLVER External Resolver
+ * 
+ * As an alternative to enabling PJLIB-UTIL DNS resolver, application can 
+ * provide its own resolver implementation by defining the callback in 
+ * pjsip_ext_resolver and pass the callback to 
+ * #pjsip_resolver_set_ext_resolver() function. Please note that if the 
+ * implementation needs feature from PJLIB-UTL DNS resolver, it has to create
+ * its own PJLIB-UTL DNS resolver instance.
  *
  * \section PJSIP_RESOLVE_REFERENCE Reference
@@ -208,4 +217,28 @@
 
 /**
+ * This structure describes application callback to receive various event from 
+ * the SIP resolver engine. Application can use this for its own resolver
+ * implementation. 
+ */
+typedef struct pjsip_ext_resolver
+{
+    /**
+     * Notify application when the resolution should begin.
+     *
+     * @param resolver      The resolver engine.
+     * @param pool          The pool to allocate resolver job.
+     * @param target        The target specification to be resolved.
+     * @param token         A user defined token to be passed back to callback 
+     *                      function.
+     * @param cb            The callback function.
+     */
+    void (*resolve) (pjsip_resolver_t *resolver, pj_pool_t *pool,
+                     const pjsip_host_info *target, void *token,
+                     pjsip_resolver_callback *cb);
+
+} pjsip_ext_resolver;
+
+
+/**
  * Create SIP resolver engine. Note that this function is normally called
  * internally by pjsip_endpoint instance.
@@ -237,4 +270,26 @@
 						 pj_dns_resolver *dns_res);
 
+
+/**
+ * Set the DNS external resolver implementation to use in the SIP resolver 
+ * engine. Naturally when implementing its own resolver, application would not
+ * need the internal resolver, hence this function will also destroy the 
+ * PJLIB-UTIL DNS resolver if any (e.g: set using 
+ * #pjsip_resolver_set_resolver()). Application that needs it, still be able 
+ * create its own instance.
+ *
+ * Note that application normally will use #pjsip_endpt_set_ext_resolver() 
+ * instead since it does not normally have access to the SIP resolver instance. 
+ *
+ * @param res       The SIP resolver engine.
+ * @param ext_res   The external resolver implementation callback. This argument
+ *		    can be NULL to reset the whole external implementation. 
+ *		    However, it is prohibited to reset individual callback.
+ * 
+ * @return	    PJ_SUCCESS on success, or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsip_resolver_set_ext_resolver(
+						pjsip_resolver_t *res,
+					        pjsip_ext_resolver *ext_res);
 
 /**
Index: pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c	(revision 5054)
+++ pjproject/trunk/pjsip/src/pjsip/sip_endpoint.c	(revision 5055)
@@ -1129,4 +1129,13 @@
 
 /*
+ * Set DNS external resolver implementation to be used by the SIP resolver.
+ */
+PJ_DEF(pj_status_t) pjsip_endpt_set_ext_resolver(pjsip_endpoint *endpt,
+						 pjsip_ext_resolver *ext_res)
+{
+    return pjsip_resolver_set_ext_resolver(endpt->resolver, ext_res);
+}
+
+/*
  * Get the DNS resolver being used by the SIP resolver.
  */
Index: pjproject/trunk/pjsip/src/pjsip/sip_resolve.c
===================================================================
--- pjproject/trunk/pjsip/src/pjsip/sip_resolve.c	(revision 5054)
+++ pjproject/trunk/pjsip/src/pjsip/sip_resolve.c	(revision 5055)
@@ -71,4 +71,5 @@
 {
     pj_dns_resolver *res;
+    pjsip_ext_resolver *ext_res;
 };
 
@@ -115,4 +116,24 @@
 }
 
+/*
+ * Public API to set the DNS external resolver implementation for the SIP 
+ * resolver.
+ */
+PJ_DEF(pj_status_t) pjsip_resolver_set_ext_resolver(pjsip_resolver_t *res,
+                                                    pjsip_ext_resolver *ext_res)
+{
+    if (ext_res && !ext_res->resolve)
+	return PJ_EINVAL;
+
+    if (ext_res && res->res) {
+#if PJSIP_HAS_RESOLVER
+	pj_dns_resolver_destroy(res->res, PJ_FALSE);
+#endif
+	res->res = NULL;
+    }
+    res->ext_res = ext_res;
+    return PJ_SUCCESS;
+}
+
 
 /*
@@ -175,4 +196,10 @@
     struct query *query;
     pjsip_transport_type_e type = target->type;
+
+    /* If an external implementation has been provided use it instead */
+    if (resolver->ext_res) {
+        (*resolver->ext_res->resolve)(resolver, pool, target, token, cb);
+        return;
+    }
 
     /* Is it IP address or hostname? And if it's an IP, which version? */
