Ignore:
Timestamp:
Feb 24, 2014 11:00:15 AM (10 years ago)
Author:
bennylp
Message:

More re #1715: doxygen integration into the book

Location:
pjproject/trunk/doc/pjsip-book
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/doc/pjsip-book

    • Property svn:ignore set to
      xml
  • pjproject/trunk/doc/pjsip-book/endpoint.rst

    r4704 r4762  
    1  
    21 
    32Endpoint 
    43************ 
    5 The ​Endpoint class is a singleton class, and application MUST create one and at most one of this class instance before it can do anything else. This class is the core class of PJSUA2, and it provides the following functions: 
     4The Endpoint class is a singleton class, and application MUST create one and at most one of this class instance before it can do anything else, and similarly, once this class is destroyed, application must NOT call any library API. This class is the core class of PJSUA2, and it provides the following functions: 
    65 
    76- Starting up and shutting down 
    87- Customization of configurations, such as core UA (User Agent) SIP configuration, media configuration, and logging configuration 
    98 
    10 This section will describe the functions above. 
     9This chapter will describe the functions above. 
    1110 
    1211To use the Endpoint class, normally application does not need to subclass it unless: 
    1312 
    14 - application wants to implement/override Endpoint’s callback methods to get the events such as transport state change or NAT detection completion, or 
     13- application wants to implement/override Endpoints callback methods to get the events such as transport state change or NAT detection completion, or 
    1514- application schedules a timer using Endpoint.utilTimerSchedule() API. In this case, application needs to implement the onTimer() callback to get the notification when the timer expires. 
    1615 
     
    2524Creating the Library 
    2625---------------------- 
    27 Create the library by calling its libCreate() method:: 
     26Create the library by calling its libCreate() method: 
     27 
     28.. code-block:: c++ 
    2829 
    2930    try { 
    3031        ep->libCreate(); 
    3132    } catch(Error& err) { 
    32         cout << "Startup error: " << err.reason << endl; 
     33        cout << "Startup error: " << err.info() << endl; 
    3334    } 
    3435 
     
    4142 
    4243- UAConfig, to specify core SIP user agent settings. 
    43 - MediaConfig, to specify various media settings, including ICE and TURN. 
     44- MediaConfig, to specify various media *global* settings 
    4445- LogConfig, to customize logging settings. 
    4546 
    46 To customize the settings, create instance of EpConfig class and specify them during the endpoint initialization (will be explained more later), for example:: 
     47Note that some settings can be further specified on per account basis, in the AccountConfig. 
     48 
     49To customize the settings, create instance of EpConfig class and specify them during the endpoint initialization (will be explained more later), for example: 
     50 
     51.. code-block:: c++ 
    4752 
    4853    EpConfig ep_cfg; 
     
    5156    ep_cfg.mediaConfig.sndClockRate = 16000; 
    5257 
    53 Next, you can initialize the library by calling libInit():: 
     58Next, you can initialize the library by calling libInit(): 
     59 
     60.. code-block:: c++ 
    5461 
    5562    try { 
     
    5865        ep->libInit(ep_cfg); 
    5966    } catch(Error& err) { 
    60         cout << "Initialization error: " << err.reason << endl; 
     67        cout << "Initialization error: " << err.info() << endl; 
    6168    } 
    6269 
     
    6572Creating One or More Transports 
    6673-------------------------------------------------- 
    67 Application needs to create one or more ​transports before it can send or receive SIP messages:: 
     74Application needs to create one or more transports before it can send or receive SIP messages: 
     75 
     76.. code-block:: c++ 
    6877 
    6978    try { 
     
    7281        TransportId tid = ep->transportCreate(PJSIP_TRANSPORT_UDP, tcfg); 
    7382    } catch(Error& err) { 
    74         cout << "Transport creation error: " << err.reason << endl; 
     83        cout << "Transport creation error: " << err.info() << endl; 
    7584    } 
    7685 
    77 The transportCreate() method returns the newly created ​Transport ID and it takes the transport type and ​TransportConfig object to customize the transport settings like bound address and listening port number. Without this, by default the transport will be bound to INADDR_ANY and any available port. 
     86The transportCreate() method returns the newly created Transport ID and it takes the transport type and TransportConfig object to customize the transport settings like bound address and listening port number. Without this, by default the transport will be bound to INADDR_ANY and any available port. 
    7887 
    79 There is no real use of the ​Transport ID, except to create userless account (with ​Account.create(), as will be explained later), and perhaps to display the list of transports to user if the application wants it. 
     88There is no real use of the Transport ID, except to create userless account (with Account.create(), as will be explained later), and perhaps to display the list of transports to user if the application wants it. 
    8089 
    8190Starting the Library 
    8291-------------------- 
    83 Now we're ready to start the library. We need to start the library to finalize the initialization phase, e.g. to complete the initial STUN address resolution, initialize/start the sound device, etc. To start the library, call ​libStart() method:: 
     92Now we're ready to start the library. We need to start the library to finalize the initialization phase, e.g. to complete the initial STUN address resolution, initialize/start the sound device, etc. To start the library, call libStart() method: 
     93 
     94.. code-block:: c++ 
    8495 
    8596    try { 
    8697        ep->libStart(); 
    8798    } catch(Error& err) { 
    88         cout << "Startup error: " << err.reason << endl; 
     99        cout << "Startup error: " << err.info() << endl; 
    89100    } 
    90101 
    91102Shutting Down the Library 
    92103-------------------------------------- 
    93 Once the application exits, the library needs to be shutdown so that resources can be released back to the operating system. This is done by deleting the Endpoint instance, which will internally call ​libDestroy():: 
     104Once the application exits, the library needs to be shutdown so that resources can be released back to the operating system. Although this can be done by deleting the Endpoint instance, which will internally call libDestroy(), it is better to call it manually because on Java or Python there are problems with garbage collection as explained earlier: 
    94105 
     106.. code-block:: c++ 
     107 
     108    ep->libDestroy(); 
    95109    delete ep; 
    96110 
     111 
     112Class Reference 
     113--------------- 
     114The Endpoint 
     115++++++++++++ 
     116.. doxygenclass:: pj::Endpoint 
     117        :path: xml 
     118        :members: 
     119 
     120Endpoint Configurations 
     121+++++++++++++++++++++++ 
     122Endpoint 
     123~~~~~~~~ 
     124.. doxygenstruct:: pj::EpConfig 
     125        :path: xml 
     126 
     127Media 
     128~~~~~ 
     129.. doxygenstruct:: pj::MediaConfig 
     130        :path: xml 
     131 
     132Logging 
     133~~~~~~~ 
     134.. doxygenstruct:: pj::LogConfig 
     135        :path: xml 
     136 
     137.. doxygenclass:: pj::LogWriter 
     138        :path: xml 
     139        :members: 
     140 
     141.. doxygenstruct:: pj::LogEntry 
     142        :path: xml 
     143 
     144User Agent 
     145~~~~~~~~~~ 
     146.. doxygenstruct:: pj::UaConfig 
     147        :path: xml 
     148 
     149 
     150Callback Parameters 
     151+++++++++++++++++++ 
     152.. doxygenstruct:: pj::OnNatDetectionCompleteParam 
     153        :path: xml 
     154 
     155.. doxygenstruct:: pj::OnNatCheckStunServersCompleteParam 
     156        :path: xml 
     157 
     158.. doxygenstruct:: pj::OnTimerParam 
     159        :path: xml 
     160 
     161.. doxygenstruct:: pj::OnTransportStateParam 
     162        :path: xml 
     163 
     164.. doxygenstruct:: pj::OnSelectAccountParam 
     165        :path: xml 
     166 
     167 
     168Other 
     169+++++ 
     170.. doxygenstruct:: pj::PendingJob 
     171        :path: xml 
     172 
Note: See TracChangeset for help on using the changeset viewer.