Index: pjproject/trunk/build.symbian/pjlibU.def
===================================================================
--- pjproject/trunk/build.symbian/pjlibU.def	(revision 1524)
+++ pjproject/trunk/build.symbian/pjlibU.def	(revision 1525)
@@ -261,36 +261,37 @@
 	pj_strtrim                               @ 260 NONAME
 	pj_symbianos_poll                        @ 261 NONAME
-	pj_thread_create                         @ 262 NONAME
-	pj_thread_destroy                        @ 263 NONAME
-	pj_thread_get_name                       @ 264 NONAME
-	pj_thread_join                           @ 265 NONAME
-	pj_thread_local_alloc                    @ 266 NONAME
-	pj_thread_local_free                     @ 267 NONAME
-	pj_thread_local_get                      @ 268 NONAME
-	pj_thread_local_set                      @ 269 NONAME
-	pj_thread_register                       @ 270 NONAME
-	pj_thread_resume                         @ 271 NONAME
-	pj_thread_sleep                          @ 272 NONAME
-	pj_thread_this                           @ 273 NONAME
-	pj_time_decode                           @ 274 NONAME
-	pj_time_encode                           @ 275 NONAME
-	pj_time_gmt_to_local                     @ 276 NONAME
-	pj_time_local_to_gmt                     @ 277 NONAME
-	pj_time_val_normalize                    @ 278 NONAME
-	pj_timer_entry_init                      @ 279 NONAME
-	pj_timer_heap_cancel                     @ 280 NONAME
-	pj_timer_heap_count                      @ 281 NONAME
-	pj_timer_heap_create                     @ 282 NONAME
-	pj_timer_heap_destroy                    @ 283 NONAME
-	pj_timer_heap_earliest_time              @ 284 NONAME
-	pj_timer_heap_mem_size                   @ 285 NONAME
-	pj_timer_heap_poll                       @ 286 NONAME
-	pj_timer_heap_schedule                   @ 287 NONAME
-	pj_timer_heap_set_lock                   @ 288 NONAME
-	pj_timer_heap_set_max_timed_out_per_poll @ 289 NONAME
-	pj_unicode_to_ansi                       @ 290 NONAME
-	pj_utoa                                  @ 291 NONAME
-	pj_utoa_pad                              @ 292 NONAME
-	platform_strerror                        @ 293 NONAME
-	snprintf                                 @ 294 NONAME
-	vsnprintf                                @ 295 NONAME
+	pj_symbianos_set_params                  @ 262 NONAME
+	pj_thread_create                         @ 263 NONAME
+	pj_thread_destroy                        @ 264 NONAME
+	pj_thread_get_name                       @ 265 NONAME
+	pj_thread_join                           @ 266 NONAME
+	pj_thread_local_alloc                    @ 267 NONAME
+	pj_thread_local_free                     @ 268 NONAME
+	pj_thread_local_get                      @ 269 NONAME
+	pj_thread_local_set                      @ 270 NONAME
+	pj_thread_register                       @ 271 NONAME
+	pj_thread_resume                         @ 272 NONAME
+	pj_thread_sleep                          @ 273 NONAME
+	pj_thread_this                           @ 274 NONAME
+	pj_time_decode                           @ 275 NONAME
+	pj_time_encode                           @ 276 NONAME
+	pj_time_gmt_to_local                     @ 277 NONAME
+	pj_time_local_to_gmt                     @ 278 NONAME
+	pj_time_val_normalize                    @ 279 NONAME
+	pj_timer_entry_init                      @ 280 NONAME
+	pj_timer_heap_cancel                     @ 281 NONAME
+	pj_timer_heap_count                      @ 282 NONAME
+	pj_timer_heap_create                     @ 283 NONAME
+	pj_timer_heap_destroy                    @ 284 NONAME
+	pj_timer_heap_earliest_time              @ 285 NONAME
+	pj_timer_heap_mem_size                   @ 286 NONAME
+	pj_timer_heap_poll                       @ 287 NONAME
+	pj_timer_heap_schedule                   @ 288 NONAME
+	pj_timer_heap_set_lock                   @ 289 NONAME
+	pj_timer_heap_set_max_timed_out_per_poll @ 290 NONAME
+	pj_unicode_to_ansi                       @ 291 NONAME
+	pj_utoa                                  @ 292 NONAME
+	pj_utoa_pad                              @ 293 NONAME
+	platform_strerror                        @ 294 NONAME
+	snprintf                                 @ 295 NONAME
+	vsnprintf                                @ 296 NONAME
Index: pjproject/trunk/build.symbian/pjproject.cww
===================================================================
--- pjproject/trunk/build.symbian/pjproject.cww	(revision 1524)
+++ pjproject/trunk/build.symbian/pjproject.cww	(revision 1525)
@@ -313,15 +313,15 @@
     </WINDOW>
     <WINDOW>
-        <SESSION>-1</SESSION>
-        <EDOCTYPE>1</EDOCTYPE>
-        <PATH USERELATIVEPATHS = "true">..\pjsip-apps\src\symbian_ua\ua.cpp</PATH>
+        <SESSION>-2147483648</SESSION>
+        <EDOCTYPE>20</EDOCTYPE>
+        <DEFAULT>true</DEFAULT>
         <MAXIMIZED>true</MAXIMIZED>
         <FRAMELOC>
             <X>4</X>
-            <Y>4</Y>
-        </FRAMELOC>
-        <FRAMESIZE>
-            <W>557</W>
-            <H>627</H>
+            <Y>23</Y>
+        </FRAMELOC>
+        <FRAMESIZE>
+            <W>1464</W>
+            <H>3681</H>
         </FRAMESIZE>
         <DOCKINFO>
@@ -338,3 +338,54 @@
         </DOCKINFO>
     </WINDOW>
+    <WINDOW>
+        <SESSION>-2147483648</SESSION>
+        <EDOCTYPE>36</EDOCTYPE>
+        <DEFAULT>true</DEFAULT>
+        <FRAMELOC>
+            <X>4</X>
+            <Y>23</Y>
+        </FRAMELOC>
+        <FRAMESIZE>
+            <W>366</W>
+            <H>354</H>
+        </FRAMESIZE>
+        <DOCKINFO>
+            <STATUS>0</STATUS>
+            <ROW></ROW>
+            <COLUMN></COLUMN>
+            <DOCKBARID></DOCKBARID>
+            <PCTWIDTH></PCTWIDTH>
+            <HGT></HGT>
+            <GROUPID>
+                <GIDHIGHPART></GIDHIGHPART>
+                <GIDLOWPART></GIDLOWPART>
+            </GROUPID>
+        </DOCKINFO>
+    </WINDOW>
+    <WINDOW>
+        <SESSION>-2147483648</SESSION>
+        <EDOCTYPE>23</EDOCTYPE>
+        <DEFAULT>true</DEFAULT>
+        <MAXIMIZED>true</MAXIMIZED>
+        <FRAMELOC>
+            <X>6</X>
+            <Y>81</Y>
+        </FRAMELOC>
+        <FRAMESIZE>
+            <W>566</W>
+            <H>477</H>
+        </FRAMESIZE>
+        <DOCKINFO>
+            <STATUS>0</STATUS>
+            <ROW></ROW>
+            <COLUMN></COLUMN>
+            <DOCKBARID></DOCKBARID>
+            <PCTWIDTH></PCTWIDTH>
+            <HGT></HGT>
+            <GROUPID>
+                <GIDHIGHPART></GIDHIGHPART>
+                <GIDLOWPART></GIDLOWPART>
+            </GROUPID>
+        </DOCKINFO>
+    </WINDOW>
 </MWIDEWORKSPACE>
Index: pjproject/trunk/pjlib/include/pj/os.h
===================================================================
--- pjproject/trunk/pjlib/include/pj/os.h	(revision 1524)
+++ pjproject/trunk/pjlib/include/pj/os.h	(revision 1525)
@@ -293,4 +293,46 @@
  */
 PJ_DECL(pj_bool_t) pj_symbianos_poll(int priority, int ms_timeout);
+
+
+/**
+ * This structure declares Symbian OS specific parameters that can be
+ * specified when calling #pj_symbianos_set_params().
+ */
+typedef struct pj_symbianos_params 
+{
+    /**
+     * Optional RSocketServ instance to be used by PJLIB. If this
+     * value is NULL, PJLIB will create a new RSocketServ instance
+     * when pj_init() is called.
+     */
+    void	*rsocketserv;
+    
+    /**
+     * Optional RConnection instance to be used by PJLIB when creating
+     * sockets. If this value is NULL, no RConnection will be
+     * specified when creating sockets.
+     */
+    void	*rconnection;
+    
+    /**
+     * Optional RHostResolver instance to be used by PJLIB. If this value
+     * is NULL, a new RHostResolver instance will be created when
+     * pj_init() is called.
+     */
+    void 	*rhostresolver;
+     
+} pj_symbianos_params;
+
+/**
+ * Specify Symbian OS parameters to be used by PJLIB. This function MUST
+ * be called before #pj_init() is called.
+ *
+ * @param prm		Symbian specific parameters.
+ *
+ * @return		PJ_SUCCESS if the parameters can be applied
+ *			successfully.
+ */
+PJ_DECL(pj_status_t) pj_symbianos_set_params(pj_symbianos_params *prm);
+
 
 /**
Index: pjproject/trunk/pjlib/src/pj/os_core_symbian.cpp
===================================================================
--- pjproject/trunk/pjlib/src/pj/os_core_symbian.cpp	(revision 1524)
+++ pjproject/trunk/pjlib/src/pj/os_core_symbian.cpp	(revision 1525)
@@ -154,6 +154,15 @@
 PjSymbianOS::PjSymbianOS()
 : isSocketServInitialized_(false), isResolverInitialized_(false),
-  console_(NULL), selectTimeoutTimer_(NULL)
-{
+  console_(NULL), selectTimeoutTimer_(NULL),
+  appSocketServ_(NULL), appConnection_(NULL), appHostResolver_(NULL)
+{
+}
+
+// Set parameters
+void PjSymbianOS::SetParameters(pj_symbianos_params *params) 
+{
+    appSocketServ_ = (RSocketServ*) params->rsocketserv;
+    appConnection_ = (RConnection*) params->rconnection;
+    appHostResolver_ = (RHostResolver*) params->rhostresolver;
 }
 
@@ -180,5 +189,8 @@
 #endif
 
-    if (!isSocketServInitialized_) {
+    /* Only create RSocketServ if application doesn't specify it
+     * in the parameters
+     */
+    if (!isSocketServInitialized_ && appSocketServ_ == NULL) {
 	err = socketServ_.Connect();
 	if (err != KErrNone)
@@ -188,6 +200,11 @@
     }
 
-    if (!isResolverInitialized_) {
-	err = hostResolver_.Open(SocketServ(), KAfInet, KSockStream);
+    if (!isResolverInitialized_ && appHostResolver_ == NULL) {
+    	if (Connection())
+    	    err = hostResolver_.Open(SocketServ(), KAfInet, KSockStream,
+    	    			     *Connection());
+    	else
+	    err = hostResolver_.Open(SocketServ(), KAfInet, KSockStream);
+    	
 	if (err != KErrNone)
 	    goto on_error;
@@ -258,4 +275,13 @@
 {
     return 0;
+}
+
+
+/* Set Symbian specific parameters */
+PJ_DEF(pj_status_t) pj_symbianos_set_params(pj_symbianos_params *prm) 
+{
+    PJ_ASSERT_RETURN(prm != NULL, PJ_EINVAL);
+    PjSymbianOS::Instance()->SetParameters(prm);
+    return PJ_SUCCESS;
 }
 
Index: pjproject/trunk/pjlib/src/pj/os_symbian.h
===================================================================
--- pjproject/trunk/pjlib/src/pj/os_symbian.h	(revision 1524)
+++ pjproject/trunk/pjlib/src/pj/os_symbian.h	(revision 1525)
@@ -21,4 +21,5 @@
 
 #include <pj/sock.h>
+#include <pj/os.h>
 #include <pj/string.h>
 
@@ -196,4 +197,9 @@
 
     //
+    // Set parameters
+    //
+    void SetParameters(pj_symbianos_params *params);
+    
+    //
     // Initialize.
     //
@@ -213,7 +219,13 @@
     RSocketServ &SocketServ()
     {
-	return socketServ_;
-    }
-
+	return appSocketServ_ ? *appSocketServ_ : socketServ_;
+    }
+
+    // Get RConnection instance, if any.
+    RConnection *Connection() 
+    {
+    	return appConnection_;
+    }
+    
     // Convert TInetAddr to pj_sockaddr_in
     static inline void Addr2pj(const TInetAddr & sym_addr,
@@ -244,5 +256,5 @@
     RHostResolver & GetResolver()
     {
-	return hostResolver_;
+	return appHostResolver_ ? *appHostResolver_ : hostResolver_;
     }
 
@@ -297,4 +309,9 @@
     CPjTimeoutTimer *selectTimeoutTimer_;
 
+    // App parameters
+    RSocketServ *appSocketServ_;
+    RConnection *appConnection_;
+    RHostResolver *appHostResolver_;
+    
 private:
     PjSymbianOS();
Index: pjproject/trunk/pjlib/src/pj/sock_symbian.cpp
===================================================================
--- pjproject/trunk/pjlib/src/pj/sock_symbian.cpp	(revision 1524)
+++ pjproject/trunk/pjlib/src/pj/sock_symbian.cpp	(revision 1525)
@@ -475,5 +475,12 @@
     /* Create Symbian RSocket */
     RSocket rSock;
-    rc = rSock.Open(PjSymbianOS::Instance()->SocketServ(), af, type, proto);
+    if (PjSymbianOS::Instance()->Connection())
+    	rc = rSock.Open(PjSymbianOS::Instance()->SocketServ(), 
+    			af, type, proto,
+    			*PjSymbianOS::Instance()->Connection());
+    else
+    	rc = rSock.Open(PjSymbianOS::Instance()->SocketServ(), 
+    			af, type, proto);
+        
     if (rc != KErrNone)
 	return PJ_RETURN_OS_ERROR(rc);
