Changes between Version 5 and Version 6 of pjsip-doc/endpoint
- Timestamp:
- Feb 6, 2014 9:36:33 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
pjsip-doc/endpoint
v5 v6 4 4 Endpoint 5 5 ************ 6 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:6 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, 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: 7 7 8 8 - Starting up and shutting down … … 26 26 Creating the Library 27 27 ---------------------- 28 Create the library by calling its libCreate() method:: 28 Create the library by calling its libCreate() method: 29 30 .. code-block:: c++ 29 31 30 32 try { … … 42 44 43 45 - UAConfig, to specify core SIP user agent settings. 44 - MediaConfig, to specify various media settings, including ICE and TURN.46 - MediaConfig, to specify various media *global* settings 45 47 - LogConfig, to customize logging settings. 46 48 47 To customize the settings, create instance of EpConfig class and specify them during the endpoint initialization (will be explained more later), for example:: 49 Note that some settings can be further specified on per account basis, in the AccountConfig. 50 51 To customize the settings, create instance of EpConfig class and specify them during the endpoint initialization (will be explained more later), for example: 52 53 .. code-block:: c++ 48 54 49 55 EpConfig ep_cfg; … … 52 58 ep_cfg.mediaConfig.sndClockRate = 16000; 53 59 54 Next, you can initialize the library by calling libInit():: 60 Next, you can initialize the library by calling libInit(): 61 62 .. code-block:: c++ 55 63 56 64 try { … … 66 74 Creating One or More Transports 67 75 -------------------------------------------------- 68 Application needs to create one or more transports before it can send or receive SIP messages:: 76 Application needs to create one or more transports before it can send or receive SIP messages: 77 78 .. code-block:: c++ 69 79 70 80 try { … … 82 92 Starting the Library 83 93 -------------------- 84 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:: 94 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: 95 96 .. code-block:: c++ 85 97 86 98 try { … … 92 104 Shutting Down the Library 93 105 -------------------------------------- 94 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()::106 Once 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: 95 107 96 // This will implicitly call libDestroy() 108 .. code-block:: c++ 109 110 ep->libDestroy(); 97 111 delete ep; 98 112