Index: pjproject/trunk/doc/pjsip-book/breathe.rst
===================================================================
--- pjproject/trunk/doc/pjsip-book/breathe.rst	(revision 4763)
+++ pjproject/trunk/doc/pjsip-book/breathe.rst	(revision 4763)
@@ -0,0 +1,113 @@
+Appendix: Generating This Documentation
+=======================================
+
+Requirements
+------------
+
+This documentation is created with `Sphinx <http://sphinx-doc.org>`_ and `Breathe <http://michaeljones.github.io/breathe/index.html>`_. Here are the required tools:
+
+1. Doxygen is required. `Install <http://www.stack.nl/~dimitri/doxygen/download.html#srcbin>`_ it for your platform.
+
+2. The easiest way to install all the tools is with `Python Package Index (PyPI) <http://pypi.python.org>`_. Just run this and it will install Sphinx, Breathe, and all the required tools if they are not installed::
+
+   $ sudo pip install breathe
+
+3. Otherwise if PyPI is not available, consult Sphinx and Breathe sites for installation instructions and you may need to install these manually:
+
+  - `Sphinx <http://sphinx-doc.org>`_
+  - `Breathe <http://michaeljones.github.io/breathe/index.html>`_
+  - docutils
+  - Pygments
+
+
+Rendering The Documentation
+------------------------------
+The main source of the documentation is currently the '''Trac''' pages at https://trac.pjsip.org/repos/wiki/pjsip-doc/index. The copies in SVN are just copies for backup.
+
+To render the documentation as HTML in `_build/html` directory::
+
+  $ cd $PJDIR/doc/pjsip-book
+  $ python fetch_trac.py
+  $ make
+  
+To build PDF, run::
+
+  $ make latexpdf
+
+
+How to Use Integrate Book with Doxygen
+--------------------------------------
+Quick sample::
+
+  will be rendered like this:
+  +++++++++++++++++++++++++++
+
+  This is how to quote a code with syntax coloring:
+
+  .. code-block:: c++
+
+       pj::AudioMediaPlayer *player = new AudioMediaPlayer;
+       player->createPlayer("announcement.wav");
+
+  There are many ways to refer a symbol: 
+
+  * A method: :cpp:func:`pj::AudioMediaPlayer::createPlayer()`
+  * A method with alternate display: :cpp:func:`a method <pj::AudioMediaPlayer::createPlayer()>`
+  * A class :cpp:class:`pj::AudioMediaPlayer`
+  * A class with alternate display: :cpp:class:`a class <pj::AudioMediaPlayer>`
+
+  For that links to work, we need to display the link target declaration (a class or method) 
+  somewhere in the doc, like this:
+  
+  .. doxygenclass:: pj::AudioMediaPlayer
+        :path: xml
+        :members:
+
+  Alternatively we can display a single method declaration like this:
+
+  .. doxygenfunction:: pj::AudioMediaPlayer::createPlayer()
+        :path: xml
+        :no-link:
+
+  We can also display class declaration with specific members.
+  
+  For more info see `Breathe documentation <http://michaeljones.github.io/breathe/domains.html>`_
+
+     
+.. default-domain:: cpp
+
+will be rendered like this:
++++++++++++++++++++++++++++
+
+This is how to quote a code with syntax coloring:
+
+.. code-block:: c++
+
+       pj::AudioMediaPlayer *player = new AudioMediaPlayer;
+       player->createPlayer("announcement.wav");
+
+There are many ways to refer a symbol: 
+
+* A method: :cpp:func:`pj::AudioMediaPlayer::createPlayer()`
+* A method with alternate display: :cpp:func:`a method <pj::AudioMediaPlayer::createPlayer()>`
+* A class :cpp:class:`pj::AudioMediaPlayer`
+* A class with alternate display: :cpp:class:`a class <pj::AudioMediaPlayer>`
+
+For that links to work, we need to display the link target declaration (a class or method) somewhere in the doc, like this:
+  
+   .. doxygenclass:: pj::AudioMediaPlayer
+        :path: xml
+        :members:
+
+Alternatively we can display a single method declaration like this:
+
+   .. doxygenfunction:: pj::AudioMediaPlayer::createPlayer()
+        :path: xml
+        :no-link:
+
+We can also display class declaration with specific members.
+
+For more info see `Breathe documentation <http://michaeljones.github.io/breathe/domains.html>`_
+
+
+
Index: pjproject/trunk/doc/pjsip-book/conf.py
===================================================================
--- pjproject/trunk/doc/pjsip-book/conf.py	(revision 4762)
+++ pjproject/trunk/doc/pjsip-book/conf.py	(revision 4763)
@@ -41,6 +41,6 @@
 
 # General information about the project.
-project = u'The PJSIP Book'
-copyright = u'2013, Teluu Ltd.'
+project = u'PJSUA2 Documentation'
+copyright = u'2014, Teluu Ltd.'
 
 # The version info for the project you're documenting, acts as replacement for
@@ -51,5 +51,5 @@
 version = '1.0'
 # The full version, including alpha/beta/rc tags.
-release = '1.0-beta'
+release = '1.0-alpha'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
@@ -165,5 +165,5 @@
 
 # Output file base name for HTML help builder.
-htmlhelp_basename = 'ThePJSIPBookdoc'
+htmlhelp_basename = 'PJSUA2Doc'
 
 
@@ -184,5 +184,5 @@
 # (source start file, target name, title, author, documentclass [howto/manual]).
 latex_documents = [
-  ('index', 'ThePJSIPBook.tex', u'The PJSIP Book Documentation',
+  ('index', 'PJSUA2Doc.tex', u'PJSUA2 Documentation',
    u'Sauw Ming Liong, Benny Prijono', 'manual'),
 ]
@@ -214,5 +214,5 @@
 # (source start file, name, description, authors, manual section).
 man_pages = [
-    ('index', 'thepjsipbook', u'The PJSIP Book Documentation',
+    ('index', 'pjsua2doc', u'PJSUA2 Documentation',
      [u'Sauw Ming Liong', u'Benny Prijono'], 1)
 ]
@@ -228,5 +228,5 @@
 #  dir menu entry, description, category)
 texinfo_documents = [
-  ('index', 'ThePJSIPBook', u'The PJSIP Book Documentation',
+  ('index', 'PJSUA2Doc', u'PJSUA2 Documentation',
    u'Sauw Ming Liong@*Benny Prijono', 'ThePJSIPBook', 'One line description of project.',
    'Miscellaneous'),
Index: pjproject/trunk/doc/pjsip-book/consider.rst
===================================================================
--- pjproject/trunk/doc/pjsip-book/consider.rst	(revision 4762)
+++ pjproject/trunk/doc/pjsip-book/consider.rst	(revision 4763)
@@ -23,9 +23,9 @@
 **Essential:** set your editor to use 8 characters tab size in order to see PJSIP source correctly.
 
-These below are PJSIP coding style. You don't need to follow it unless you are submitting patches to PJSIP:
-
-* indentation uses tabs and spaces. Tab size is 8 characters, indentation 4.
-* all public API in header file must be documented in Doxygen format.
-* other than that, we mostly just use `K & R style <http://en.wikipedia.org/wiki/1_true_brace_style#K.26R_style>`_, which is the only correct style anyway.
+Detailed below is the PJSIP coding style. You don't need to follow it unless you are submitting patches to PJSIP:
+
+* Indentation uses tabs and spaces. Tab size is 8 characters, indentation 4.
+* All public API in header file must be documented in Doxygen format.
+* Apart from that, we mostly just use `K & R style <http://en.wikipedia.org/wiki/1_true_brace_style#K.26R_style>`_, which is the only correct style anyway.
 
 
@@ -43,5 +43,5 @@
 Windows is supported from Windows 2000 up to the recent Windows 8 and beyond. All features are expected to work. 64bit support was added recently. Development is based on Visual Studio. Considerations for this platform include:
 
-#. because Visual Studio file format keeps changing on every release, we decided to support the lowest denominator, namely Visual Studio 2005. Unfortunately the project upgrade procedure fails on Visual Studio 2010, and we don't have any solution for that. But VS 2008 and VS 20012 work.
+#. Because Visual Studio file format keeps changing on every release, we decided to support the lowest denominator, namely Visual Studio 2005. Unfortunately the project upgrade procedure fails on Visual Studio 2010, and we don't have any solution for that. VS 2008 and VS 2012 onwards should work.
 
 MacOS X
@@ -49,5 +49,5 @@
 All features are expected to work. Considerations include:
 
-#. development with XCode is currently not supported. This is **not** to say that you cannot use XCode, but PJSIP only provides basic Makefiles and if you want to use XCode you'd need to arrange the project yourself.
+#. Development with XCode is currently not supported. This is **not** to say that you cannot use XCode, but PJSIP only provides basic Makefiles and if you want to use XCode you'd need to arrange the project yourself.
 #. Mac systems typically provides very good sound device, so we don't expect any problems with audio on Mac. 
 
@@ -56,5 +56,5 @@
 All features are expected to work. Linux considerations:
 
-#. use our native ALSA backend instead of PortAudio because ALSA has less jitter than OSS and our backend is more lightweight than PortAudio
+#. Use our native ALSA backend instead of PortAudio because ALSA has less jitter than OSS and our backend is more lightweight than PortAudio
 
 
@@ -63,8 +63,8 @@
 All features except video are expected to work (video is coming soon!). Considerations for iOS:
 
-#. you need to use TCP transport for SIP for the background feature to work
+#. You need to use TCP transport for SIP for the background feature to work
 #. IP change (for example when user is changing access point) is a feature frequently asked by developers and you can find the documentation here: http://trac.pjsip.org/repos/wiki/IPAddressChange
-#. there are some specific issues for iOS 7 and beyond, please see http://trac.pjsip.org/repos/ticket/1697
-#. if SSL is needed, you need to compile OpenSSL for iOS
+#. There are some specific issues for iOS 7 and beyond, please see http://trac.pjsip.org/repos/ticket/1697
+#. If SSL is needed, you need to compile OpenSSL for iOS
 
 
@@ -73,19 +73,19 @@
 All features except video are expected to work (video is coming soon!). Considerations for Android:
 
-#. you can only use pjsua2 Java binding for this target
-#. it has been reported that Android audio device is not so good in general, so some audio tuning may be needed. Echo cancellation also needs to be checked
-#. this is also a new platform for us 
+#. You can only use pjsua2 Java binding for this target.
+#. It has been reported that Android audio device is not so good in general, so some audio tuning may be needed. Echo cancellation also needs to be checked.
+#. This is also a new platform for us. 
 
 
 Symbian
 -------
-Symbian has been supported for a long time but it doesn't get too many attention recently. In general all features (excluding video) are expected to work, but we're not going to do Symbian specific development anymore. Other considerations for Symbian:
-
-#. the MDA audio is not very good (it has high latency), so normally you'd want to use Audio Proxy Server (APS) or VoIP Audio Service (VAS) for the audio device, which we support. Using these audio backends will also provide us with high quality echo cancellation as well as low bitrate codecs such as AMR-NB, G.729, and iLBC. But VAS and APS requires purchase of Nokia development certificate to sign the app, and also since APS and VAS only run on specific device type, you need to package the app carefully and manage the deployment to cover various device types.
-
-
-Blackberry 10
--------------
-Blackberry 10 is supported since PJSIP version 2.2. As this is a relatively new platform for us, we are currently listening to developer's feedback regarding the port. But so far it seems to be working well. Some considerations for BB10 platform include:
+Symbian has been supported for a long time. In general all features (excluding video) are expected to work, but we're not going to do Symbian specific development anymore. Other considerations for Symbian:
+
+#. The MDA audio is not very good (it has high latency), so normally you'd want to use Audio Proxy Server (APS) or VoIP Audio Service (VAS) for the audio device, which we support. Using these audio backends will also provide us with high quality echo cancellation as well as low bitrate codecs such as AMR-NB, G.729, and iLBC. But VAS and APS requires purchase of Nokia development certificate to sign the app, and also since APS and VAS only run on specific device type, you need to package the app carefully and manage the deployment to cover various device types.
+
+
+BlackBerry 10
+-------------
+BlackBerry 10 (BB10) is supported since PJSIP version 2.2. As this is a relatively new platform for us, we are currently listening to developer's feedback regarding the port. But so far it seems to be working well. Some considerations for BB10 platform include:
 
 #. IP change (for example when user is changing access point) is a feature frequently asked by developers and you can find the documentation here: http://trac.pjsip.org/repos/wiki/IPAddressChange
@@ -94,10 +94,10 @@
 Windows Mobile
 --------------
-This is the old Windows Mobile platform that is based on WinCE. This platform has been supported for a long time, but doesn't seem to attract any attentions recently. We expect all features except video to work, but there may be some errors every now and then because this target is not actively maintained. No new development will be done for this platform.
+This is the old Windows Mobile platform that is based on WinCE. This platform has been supported for a long time. We expect all features except video to work, but there may be some errors every now and then because this target is not actively maintained. No new development will be done for this platform.
 
 Other considerations for Windows Mobile platform are:
 
-#. the quality of audio device on WM varies a lot, and this affects audio latency. Audio latency could go as high as hundreds of millisecond on bad hardware.
-#. echo cancellation could be a problem. We can only use basic echo suppressor due to hardware limitation, and combined with bad quality of audio device, it may cause ineffective echo cancellation. This could be mitigated by setting the audio level to low.
+#. The quality of audio device on WM varies a lot, and this affects audio latency. Audio latency could go as high as hundreds of millisecond on bad hardware.
+#. Echo cancellation could be a problem. We can only use basic echo suppressor due to hardware limitation, and combined with bad quality of audio device, it may cause ineffective echo cancellation. This could be mitigated by setting the audio level to low.
 
 
@@ -106,5 +106,5 @@
 Windows Phone 8 (WP8) support is being added to PJSIP version 2.2 and is still under development. Specific considerations for this platform are:
 
-#. WP8 governs specific interaction with WP8 GUI and framework that needs to be followed by application in order to make VoIP call work seamlessly on the device. Some lightweight process will be created by WP8 framework in order for background call to work and PJSIP needs to put it's background processing in this process's context. Currently this feature is under development.
+#. WP8 governs specific interaction with WP8 GUI and framework that needs to be followed by application in order to make VoIP call work seamlessly on the device. Some lightweight process will be created by WP8 framework in order for background call to work and PJSIP needs to put its background processing in this process' context. Currently this feature is under development.
 
 
@@ -114,10 +114,10 @@
 In general embedded Linux support is similar to Linux and we find no problems with it. We found some specific considerations for embedded Linux as follows:
 
-#. the performance of the audio device is probably the one with most issues, as some development boards have not so descent sound device that has high audio jitter (or burst) and latency. This will affect end to end audio latency and also the performance of the echo canceller. Also we found that ALSA generally works better than OSS, so if you can have ALSA up and running that will be better. Use our native ALSA backend audio device instead of PortAudio since it is simpler and lighter.
+#. The performance of the audio device is probably the one with most issues, as some development boards does not have a decent sound device. Typically there is high audio jitter (or burst) and latency. This will affect end to end audio latency and also the performance of the echo canceller. Also we found that ALSA generally works better than OSS, so if you can have ALSA up and running that will be better. Use our native ALSA backend audio device instead of PortAudio since it is simpler and lighter.
 
 
 QNX or Other Posix Embedded OS
 ------------------------------
-This is not part of our officially supported OSes, but users have run PJSIP on QNX and Blackberry 10 is based on QNX too. Since QNX provides Posix API, and maybe by using the settings found in the configure-bb10 script, PJSIP should be able to run on it, but you need to develop PJMEDIA sound device wrapper for your audio device. Other than this, we don't have enough experience to comment on the platform. 
+This is not part of our officially supported OS platforms, but users have run PJSIP on QNX and BlackBerry 10 is based on QNX too. Since QNX provides Posix API, and maybe by using the settings found in the configure-bb10 script, PJSIP should be able to run on it, but you need to develop PJMEDIA sound device wrapper for your audio device. Other than this, we don't have enough experience to comment on the platform. 
 
 
@@ -127,7 +127,7 @@
 
 
-Porting to Other Embedded OSes
+Porting to Other Embedded OS
 ------------------------------
-It is possible to port PJSIP to other embedded OSes or even directly to device without OS and people have done so. In general, the closer resemblance the new OS to existing supported OS, the easier the porting job will be. The good thing is, PJSIP has been made to be very very portable, and system dependent features are localized in PJLIB and PJMEDIA audio device, so the effort is more quantifiable. Once you are able to successfully run *pjlib-test*, you are more or less there with your porting effort. Other than that, if you really want to port PJSIP to new platform, you probably already know what you're doing. 
+It is possible to port PJSIP to other embedded OS or even directly to device without OS and people have done so. In general, the closer resemblance the new OS to existing supported OS, the easier the porting job will be. The good thing is, PJSIP has been made to be very very portable, and system dependent features are localized in PJLIB and PJMEDIA audio device, so the effort is more quantifiable. Once you are able to successfully run *pjlib-test*, you are more or less there with your porting effort. Other than that, if you really want to port PJSIP to new platform, you probably already know what you're doing. 
 
 
@@ -140,7 +140,7 @@
 At the lowest level we have the individual PJSIP **C** libraries, which consist of PJSIP, PJMEDIA, and PJNATH, with PJLIB-UTIL and PJLIB as support libraries. This level provides the most flexibility, but it's also the hardest to use. The only reason you'd want to use this level is if:
 
-#. you only need the individual library (say, PJNATH)
-#. you need to be very very tight in footprint (say when things need to be measured in Kilobytes instead of Megabytes)
-#. you are **not** developing a SIP client
+#. You only need the individual library (say, PJNATH)
+#. You need to be very very tight in footprint (say when things need to be measured in Kilobytes instead of Megabytes)
+#. You are **not** developing a SIP client
 
 Use the corresponding PJSIP, PJMEDIA, PJNATH manuals from http://trac.pjsip.org/repos/ for information on how to use the libraries. If you use PJSIP, the PJSIP Developer's Guide (PDF) from that page provides in-depth information about PJSIP library.  
@@ -152,6 +152,6 @@
 Motivations for using PJSUA-LIB library includes:
 
-#. developing client application (PJSUA-LIB is optimized for developing client app)
-#. better efficiency than higher level API
+#. Developing client application (PJSUA-LIB is optimized for developing client app)
+#. Better efficiency than higher level API
 
 
@@ -160,18 +160,18 @@
 pjsua2 is a new, objected oriented, C++ API created on top of PJSUA-LIB. The API is different than PJSUA-LIB, but it should be even easier to use and it should have better documentation too (such as this book). The pjsua2 API removes most cruxes typically associated with PJSIP, such as the pool and pj_str_t, and add new features such as object persistence so you can save your configs to a file, for example. All data structures are rewritten for more clarity. 
 
-A C++ application can use pjsua2 natively, while at the same time still has access to the lower level objects if it needs to. This means that the C++ application should not loose any information from using the C++ abstraction, compared to if it is using PJSUA-LIB directly. The C++ application also should not loose the ability to extend the library. It would still be able to register a custom PJSIP module, pjmedia_port, pjmedia_transport, and so on.
+A C++ application can use pjsua2 natively, while at the same time still has access to the lower level objects if it needs to. This means that the C++ application should not lose any information from using the C++ abstraction, compared to if it is using PJSUA-LIB directly. The C++ application also should not lose the ability to extend the library. It would still be able to register a custom PJSIP module, pjmedia_port, pjmedia_transport, and so on.
 
 Benefits of using pjsua2 C++ API include:
 
-#. cleaner object oriented API
-#. uniform API for higher level language such as Java and Python
-#. persistence API
-#. the ability to access PJSUA-LIB and lower level libraries when needed (including the ability to extend the libraries, for example creating custom PJSIP module, pjmedia_port, pjmedia_transport, etc.)
+#. Cleaner object oriented API
+#. Uniform API for higher level language such as Java and Python
+#. Persistence API
+#. The ability to access PJSUA-LIB and lower level libraries when needed (including the ability to extend the libraries, for example creating custom PJSIP module, pjmedia_port, pjmedia_transport, etc.)
 
 
 Some considerations on pjsua2 C++ API are:
-#. instead of returning error, the API uses exception for error reporting
+#. Instead of returning error, the API uses exception for error reporting
 #. pjsua2 uses standard C++ library
-#. the performance penalty due to the API abstraction should be negligible on typical modern device
+#. The performance penalty due to the API abstraction should be negligible on typical modern device
 
 
Index: pjproject/trunk/doc/pjsip-book/getting_started.rst
===================================================================
--- pjproject/trunk/doc/pjsip-book/getting_started.rst	(revision 4762)
+++ 	(revision )
@@ -1,211 +1,0 @@
-Getting Started
-******************************
-
-Building PJSUA2
-======================
-The PJSUA2 C++ library will be built by default by PJSIP build system.
-
-Building Python and Java SWIG Modules
-======================================
-The SWIG modules for Python and Java are built by invoking ``make`` and ``make install`` manually from ``pjsip-apps/src/swig`` directory. The ``make install`` will install the Python SWIG module to user's ``site-packages`` directory.
-
-Requirements
-------------
-
-#. ``JDK``.
-#. ``Python``, version 2.7 or above is required.
-   For **Linux/UNIX**, you will also need ``Python developent package`` (called ``python-devel`` (e.g. on Fedora) or ``python2.7-dev`` (e.g. on Ubuntu)). For **Windows**, you will need MinGW and ``Python SDK`` such as `ActivePython-2.7.5`_ from `ActiveState`_.
-
-.. _`ActivePython-2.7.5`: http://www.activestate.com/activepython/downloads
-.. _`ActiveState`: http://www.activestate.com
-
-Testing The Installation
-------------------------
-To test the installation, simply run python and import ``pjsua2`` module::
-
-  $ python
-  > import pjsua2
-  > ^Z
-
-
-Using in C++ Application
-========================
-As mentioned in previous chapter, a C++ application can use *pjsua2* natively, while at the same time still has access to the lower level objects and the ability to extend the libraries if it needs to. Using the API will be exactly the same as the API reference that is written in this book.
-
-Here is a sample complete C++ application to give you some idea about the API. The snippet below initializes the library and creates an account that registers to our pjsip.org SIP server.
-
-.. code-block:: c++
-    
-  #include <pjsua2.hpp>
-  #include <iostream>
-  
-  using namespace pj;
-  
-  // Subclass to extend the Account and get notifications etc.
-  class MyAccount : public Account {
-  public:
-      virtual void onRegState(OnRegStateParam &prm) {
-          AccountInfo ai = getInfo();
-          std::cout << (ai.regIsActive? "*** Register:" : "*** Unregister:")
-                    << " code=" << prm.code << std::endl;
-      }
-  };
-
-  int main()
-  {
-      Endpoint ep;
-      
-      ep.libCreate();
-      
-      // Initialize endpoint
-      EpConfig ep_cfg;
-      ep.libInit( ep_cfg );
-      
-      // Create SIP transport. Error handling sample is shown
-      TransportConfig tcfg;
-      tcfg.port = 5060;
-      try {
-          ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg);
-      } catch (Error &err) {
-          std::cout << err.info() << std::endl;
-          return 1;
-      }
-      
-      // Start the library (worker threads etc)
-      ep.libStart();
-      std::cout << "*** PJSUA2 STARTED ***" << std::endl;
-      
-      // Configure an AccountConfig
-      AccountConfig acfg;
-      acfg.idUri = "sip:test@pjsip.org";
-      acfg.regConfig.registrarUri = "sip:pjsip.org";
-      AuthCredInfo cred("digest", "*", "test", 0, "secret");
-      acfg.sipConfig.authCreds.push_back( cred );
-      
-      // Create the account
-      MyAccount *acc = new MyAccount;
-      acc->create(acfg);
-      
-      // Here we don't have anything else to do..
-      pj_thread_sleep(10000);
-      
-      // Delete the account. This will unregister from server
-      delete acc;
-      
-      // This will implicitly shutdown the library
-      return 0;
-  }
-
-
-Using in Python Application
-===========================
-The equivalence of the C++ sample code above in Python is as follows:
-
-.. code-block:: python
-
-  # Subclass to extend the Account and get notifications etc.
-  class Account(pj.Account):
-    def onRegState(self, prm):
-        print "***OnRegState: " + prm.reason
-
-  # pjsua2 test function
-  def pjsua2_test():
-    # Create and initialize the library
-    ep_cfg = pj.EpConfig()
-    ep = pj.Endpoint()
-    ep.libCreate()
-    ep.libInit(ep_cfg)
-    
-    # Create SIP transport. Error handling sample is shown
-    sipTpConfig = pj.TransportConfig();
-    sipTpConfig.port = 5060;
-    ep.transportCreate(pj.PJSIP_TRANSPORT_UDP, sipTpConfig);
-    # Start the library
-    ep.libStart();
-    
-    acfg = pj.AccountConfig();
-    acfg.idUri = "sip:test@pjsip.org";
-    acfg.regConfig.registrarUri = "sip:pjsip.org";
-    cred = pj.AuthCredInfo("digest", "*", "test", 0, "pwtest");
-    acfg.sipConfig.authCreds.append( cred );
-    # Create the account
-    acc = Account();
-    acc.create(acfg);
-    # Here we don't have anything else to do..
-    time.sleep(10);
-
-    # Destroy the library
-    ep.libDestroy()
-
-  #
-  # main()
-  #
-  if __name__ == "__main__":
-    pjsua2_test()
-
-
-Using in Java Application
-=========================
-The equivalence of the C++ sample code above in Java is as follows:
-
-.. code-block:: java
-
-  import org.pjsip.pjsua2.*;
-
-  // Subclass to extend the Account and get notifications etc.
-  class MyAccount extends Account {
-    @Override
-    public void onRegState(OnRegStateParam prm) {
-        System.out.println("*** On registration state: " + prm.getCode() + prm.getReason());
-    }
-  }
-
-  public class test {
-    static {
-        System.loadLibrary("pjsua2");
-        System.out.println("Library loaded");
-    }
-    
-    public static void main(String argv[]) {
-        try {
-            // Create endpoint
-            Endpoint ep = new Endpoint();
-            ep.libCreate();
-            // Initialize endpoint
-            EpConfig epConfig = new EpConfig();
-            ep.libInit( epConfig );
-            // Create SIP transport. Error handling sample is shown
-            TransportConfig sipTpConfig = new TransportConfig();
-            sipTpConfig.setPort(5060);
-            ep.transportCreate(pjsip_transport_type_e.PJSIP_TRANSPORT_UDP, sipTpConfig);
-            // Start the library
-            ep.libStart();
-
-            AccountConfig acfg = new AccountConfig();
-            acfg.setIdUri("sip:test@pjsip.org");
-            acfg.getRegConfig().setRegistrarUri("sip:pjsip.org");
-            AuthCredInfo cred = new AuthCredInfo("digest", "*", "test", 0, "secret");
-            acfg.getSipConfig().getAuthCreds().add( cred );
-            // Create the account
-            MyAccount acc = new MyAccount();
-            acc.create(acfg);
-            // Here we don't have anything else to do..
-            Thread.sleep(10000);
-            /* Explicitly delete the account.
-             * This is to avoid GC to delete the endpoint first before deleting
-             * the account.
-             */
-            acc.delete();
-            
-            // Explicitly destroy and delete endpoint
-            ep.libDestroy();
-            ep.delete();
-            
-        } catch (Exception e) {
-            System.out.println(e);
-            return;
-        }
-    }
-  }
-
-
Index: pjproject/trunk/doc/pjsip-book/index.rst
===================================================================
--- pjproject/trunk/doc/pjsip-book/index.rst	(revision 4762)
+++ pjproject/trunk/doc/pjsip-book/index.rst	(revision 4763)
@@ -1,8 +1,8 @@
-.. The PJSIP Book documentation master file, created by
+.. PJSUA2 documentation master file, created by
    sphinx-quickstart on Sat Nov 30 06:36:26 2013.
    You can adapt this file completely to your liking, but it should at least
    contain the root `toctree` directive.
 
-The PJSIP Book
+PJSUA2 Documentation
 ==========================================
 
@@ -16,5 +16,4 @@
    consider
    intro_pjsua2
-   getting_started
    endpoint
    account
@@ -23,8 +22,8 @@
    presence
    samples
-   optimization
    media_quality
    network_problems
    reference
+   breathe
 
    
Index: pjproject/trunk/doc/pjsip-book/intro.rst
===================================================================
--- pjproject/trunk/doc/pjsip-book/intro.rst	(revision 4762)
+++ pjproject/trunk/doc/pjsip-book/intro.rst	(revision 4763)
@@ -1,8 +1,8 @@
 
-Introduction to PJSUA2
+Introduction
 *******************************
 This documentation is intended for developers looking to develop Session Initiation Protocol (SIP) based client application. Some knowledge on SIP is definitely required, and of course some programming experience. Prior knowledge of PJSUA C API is not needed, although it will probably help.
 
-This PJSUA2 module provides very high level C++ API to do SIP calls, presence, and instant messaging, as well as handling media and NAT traversal. Knowledge of SIP protocol details (such as the grammar, transaction, dialog, and whatnot) are not required, however you should know how SIP works in general and particularly how to configure SIP clients to, e.g. register to a SIP provider, specify SIP URI to make call to, and so on, to use the module.
+PJSIP libraries provide multi-level APIs to do SIP calls, presence, and instant messaging, as well as handling media and NAT traversal. Knowledge of SIP protocol details (such as the grammar, transaction, dialog, and whatnot) are not required (but it will help a lot!), however you should know how SIP works in general and particularly how to configure SIP clients to, e.g. register to a SIP provider, specify SIP URI to make call to, and so on, to use the module.
 
 Getting Started with PJSIP
@@ -12,5 +12,5 @@
 .. _`PJSIP's Features List`: http://trac.pjsip.org/repos/wiki/PJSIP-Datasheet
 
-Then to begin using PJSIP, the `Getting Started Guide`_ contains instructions to acquire and build PJSIP on various platforms that we support.
+To start using PJSIP, the `Getting Started Guide`_ contains instructions to acquire and build PJSIP on various platforms that we support.
 
 .. _`Getting Started Guide`: http://trac.pjsip.org/repos/wiki/Getting-Started 
@@ -28,10 +28,4 @@
 .. _`PJSIP Reference Manual`: http://trac.pjsip.org/repos/wiki
 
-Building PJSUA2
-=================
-PJSUA2 API declaration can be found in ``pjsip/include/pjsua2`` while the source codes are located in ``pjsip/src/pjsua2``. It will be automatically built when you compile PJSIP.
 
-PJSUA2 Language Binding Support
-===================================
-The PJSUA2 API is also available for other programming languages via SWIG binding, such as Java and Python.
 
Index: pjproject/trunk/doc/pjsip-book/intro_pjsua2.rst
===================================================================
--- pjproject/trunk/doc/pjsip-book/intro_pjsua2.rst	(revision 4762)
+++ pjproject/trunk/doc/pjsip-book/intro_pjsua2.rst	(revision 4763)
@@ -5,10 +5,5 @@
 PJSUA2 is implemented on top of PJSUA-LIB API. The SIP and media features and object modelling follows what PJSUA-LIB provides (for example, we still have accounts, call, buddy, and so on), but the API to access them is different. These features will be described later in this chapter. PJSUA2 is a C++ library, which you can find under ``pjsip`` directory in the PJSIP distribution. The C++ library can be used by native C++ applications directly. But PJSUA2 is not just a C++ library. From the beginning, it has been designed to be accessible from high level non-native languages such as Java and Python. This is achieved by SWIG binding. And thanks to SWIG, binding to other languages can be added relatively easily in the future.
 
-
-Building PJSUA2
-======================
-The PJSUA2 C++ library will be built by default by PJSIP build system.
-
-The SWIG modules for Python and Java are built by invoking ``make`` manually from ``pjsip-apps/src/swig`` directory.
+PJSUA2 API declaration can be found in ``pjsip/include/pjsua2`` while the source codes are located in ``pjsip/src/pjsua2``. It will be automatically built when you compile PJSIP.
 
 
@@ -100,2 +95,208 @@
 
 
+Building PJSUA2
+======================
+The PJSUA2 C++ library will be built by default by PJSIP build system.
+
+Building Python and Java SWIG Modules
+======================================
+The SWIG modules for Python and Java are built by invoking ``make`` and ``make install`` manually from ``pjsip-apps/src/swig`` directory. The ``make install`` will install the Python SWIG module to user's ``site-packages`` directory.
+
+Requirements
+------------
+
+#. ``JDK``.
+#. ``Python``, version 2.7 or above is required.
+   For **Linux/UNIX**, you will also need ``Python developent package`` (called ``python-devel`` (e.g. on Fedora) or ``python2.7-dev`` (e.g. on Ubuntu)). For **Windows**, you will need MinGW and ``Python SDK`` such as `ActivePython-2.7.5`_ from `ActiveState`_.
+
+.. _`ActivePython-2.7.5`: http://www.activestate.com/activepython/downloads
+.. _`ActiveState`: http://www.activestate.com
+
+Testing The Installation
+------------------------
+To test the installation, simply run python and import ``pjsua2`` module::
+
+  $ python
+  > import pjsua2
+  > ^Z
+
+
+Using in C++ Application
+========================
+As mentioned in previous chapter, a C++ application can use *pjsua2* natively, while at the same time still has access to the lower level objects and the ability to extend the libraries if it needs to. Using the API will be exactly the same as the API reference that is written in this book.
+
+Here is a sample complete C++ application to give you some idea about the API. The snippet below initializes the library and creates an account that registers to our pjsip.org SIP server.
+
+.. code-block:: c++
+    
+  #include <pjsua2.hpp>
+  #include <iostream>
+  
+  using namespace pj;
+  
+  // Subclass to extend the Account and get notifications etc.
+  class MyAccount : public Account {
+  public:
+      virtual void onRegState(OnRegStateParam &prm) {
+          AccountInfo ai = getInfo();
+          std::cout << (ai.regIsActive? "*** Register:" : "*** Unregister:")
+                    << " code=" << prm.code << std::endl;
+      }
+  };
+
+  int main()
+  {
+      Endpoint ep;
+      
+      ep.libCreate();
+      
+      // Initialize endpoint
+      EpConfig ep_cfg;
+      ep.libInit( ep_cfg );
+      
+      // Create SIP transport. Error handling sample is shown
+      TransportConfig tcfg;
+      tcfg.port = 5060;
+      try {
+          ep.transportCreate(PJSIP_TRANSPORT_UDP, tcfg);
+      } catch (Error &err) {
+          std::cout << err.info() << std::endl;
+          return 1;
+      }
+      
+      // Start the library (worker threads etc)
+      ep.libStart();
+      std::cout << "*** PJSUA2 STARTED ***" << std::endl;
+      
+      // Configure an AccountConfig
+      AccountConfig acfg;
+      acfg.idUri = "sip:test@pjsip.org";
+      acfg.regConfig.registrarUri = "sip:pjsip.org";
+      AuthCredInfo cred("digest", "*", "test", 0, "secret");
+      acfg.sipConfig.authCreds.push_back( cred );
+      
+      // Create the account
+      MyAccount *acc = new MyAccount;
+      acc->create(acfg);
+      
+      // Here we don't have anything else to do..
+      pj_thread_sleep(10000);
+      
+      // Delete the account. This will unregister from server
+      delete acc;
+      
+      // This will implicitly shutdown the library
+      return 0;
+  }
+
+
+Using in Python Application
+===========================
+The equivalence of the C++ sample code above in Python is as follows:
+
+.. code-block:: python
+
+  # Subclass to extend the Account and get notifications etc.
+  class Account(pj.Account):
+    def onRegState(self, prm):
+        print "***OnRegState: " + prm.reason
+
+  # pjsua2 test function
+  def pjsua2_test():
+    # Create and initialize the library
+    ep_cfg = pj.EpConfig()
+    ep = pj.Endpoint()
+    ep.libCreate()
+    ep.libInit(ep_cfg)
+    
+    # Create SIP transport. Error handling sample is shown
+    sipTpConfig = pj.TransportConfig();
+    sipTpConfig.port = 5060;
+    ep.transportCreate(pj.PJSIP_TRANSPORT_UDP, sipTpConfig);
+    # Start the library
+    ep.libStart();
+    
+    acfg = pj.AccountConfig();
+    acfg.idUri = "sip:test@pjsip.org";
+    acfg.regConfig.registrarUri = "sip:pjsip.org";
+    cred = pj.AuthCredInfo("digest", "*", "test", 0, "pwtest");
+    acfg.sipConfig.authCreds.append( cred );
+    # Create the account
+    acc = Account();
+    acc.create(acfg);
+    # Here we don't have anything else to do..
+    time.sleep(10);
+
+    # Destroy the library
+    ep.libDestroy()
+
+  #
+  # main()
+  #
+  if __name__ == "__main__":
+    pjsua2_test()
+
+
+Using in Java Application
+=========================
+The equivalence of the C++ sample code above in Java is as follows:
+
+.. code-block:: java
+
+  import org.pjsip.pjsua2.*;
+
+  // Subclass to extend the Account and get notifications etc.
+  class MyAccount extends Account {
+    @Override
+    public void onRegState(OnRegStateParam prm) {
+        System.out.println("*** On registration state: " + prm.getCode() + prm.getReason());
+    }
+  }
+
+  public class test {
+    static {
+        System.loadLibrary("pjsua2");
+        System.out.println("Library loaded");
+    }
+    
+    public static void main(String argv[]) {
+        try {
+            // Create endpoint
+            Endpoint ep = new Endpoint();
+            ep.libCreate();
+            // Initialize endpoint
+            EpConfig epConfig = new EpConfig();
+            ep.libInit( epConfig );
+            // Create SIP transport. Error handling sample is shown
+            TransportConfig sipTpConfig = new TransportConfig();
+            sipTpConfig.setPort(5060);
+            ep.transportCreate(pjsip_transport_type_e.PJSIP_TRANSPORT_UDP, sipTpConfig);
+            // Start the library
+            ep.libStart();
+
+            AccountConfig acfg = new AccountConfig();
+            acfg.setIdUri("sip:test@pjsip.org");
+            acfg.getRegConfig().setRegistrarUri("sip:pjsip.org");
+            AuthCredInfo cred = new AuthCredInfo("digest", "*", "test", 0, "secret");
+            acfg.getSipConfig().getAuthCreds().add( cred );
+            // Create the account
+            MyAccount acc = new MyAccount();
+            acc.create(acfg);
+            // Here we don't have anything else to do..
+            Thread.sleep(10000);
+            /* Explicitly delete the account.
+             * This is to avoid GC to delete the endpoint first before deleting
+             * the account.
+             */
+            acc.delete();
+            
+            // Explicitly destroy and delete endpoint
+            ep.libDestroy();
+            ep.delete();
+            
+        } catch (Exception e) {
+            System.out.println(e);
+            return;
+        }
+    }
+  }
Index: pjproject/trunk/doc/pjsip-book/reference.rst
===================================================================
--- pjproject/trunk/doc/pjsip-book/reference.rst	(revision 4762)
+++ pjproject/trunk/doc/pjsip-book/reference.rst	(revision 4763)
@@ -1,19 +1,58 @@
+
 
 PJSUA2 API Reference Manuals
 ****************************
 
-Endpoint
-========
+endpoint.hpp
+=============
+.. doxygenfile:: endpoint.hpp
+        :path: xml
 
-Account
-=======
+account.hpp
+===========
+.. doxygenfile:: account.hpp
+        :path: xml
 
-Media
-=====
 
-Call
-====
+media.hpp
+=========
+.. doxygenfile:: media.hpp
+        :path: xml
 
-Buddy
-=====
 
+call.hpp
+=========
+.. doxygenfile:: call.hpp
+        :path: xml
+
+
+presence.hpp
+============
+.. doxygenfile:: presence.hpp
+        :path: xml
+
+persistent.hpp
+================
+.. doxygenfile:: persistent.hpp
+        :path: xml
+
+json.hpp
+================
+.. doxygenfile:: json.hpp
+        :path: xml
+
+siptypes.hpp
+================
+.. doxygenfile:: siptypes.hpp
+        :path: xml
+
+types.hpp
+================
+.. doxygenfile:: types.hpp
+        :path: xml
+
+config.hpp
+================
+.. doxygenfile:: config.hpp
+        :path: xml
+
