Changes between Version 3 and Version 4 of Python_SIP/Settings
- Timestamp:
- Jul 24, 2008 2:55:39 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Python_SIP/Settings
v3 v4 25 25 }}} 26 26 27 Once the library is instantiated, you can retrieve the Lib instance using Lib.instance()static method.27 Once the library is instantiated, you can retrieve the Lib instance using [http://www.pjsip.org/python/pjsua.htm#Lib-instance Lib.instance()] static method. 28 28 29 29 30 30 === Initialize the Library === 31 31 32 Initialize the library by calling its {{{init()}}}method:32 Initialize the library by calling its [http://www.pjsip.org/python/pjsua.htm#Lib-init init()] method: 33 33 34 34 {{{ … … 42 42 The snippet above initializes the library with the default settings. The {{{init()}}} method will raise exception if error occurs, so we need to trap the exception using try/except clause as above. 43 43 44 The {{{init()}}}method takes three optional arguments to specify various core settings:44 The [http://www.pjsip.org/python/pjsua.htm#Lib-init init()] method takes three optional arguments to specify various core settings: 45 45 - [http://www.pjsip.org/python/pjsua.htm#UAConfig UAConfig], to specify core SIP user agent settings 46 46 - [http://www.pjsip.org/python/pjsua.htm#MediaConfig MediaConfig], to specify various media settings, including ICE and TURN. 47 47 - [http://www.pjsip.org/python/pjsua.htm#LogConfig LogConfig], to customize logging settings. 48 48 49 To customize the settings, you would do something like this:49 To customize the settings, create instance of the above configuration class(es) and specify them to {{{init()}}}, for example: 50 50 51 51 {{{ … … 78 78 }}} 79 79 80 The {{{create_transport()}}} method returns the newly created [http://www.pjsip.org/python/pjsua.htm#Transport Transport] instance and it takes an optional [http://www.pjsip.org/python/pjsua.htm#TransportConfig TransportConfig] object to customize the transport settings like bound address and listening port number. Without this, by default the transport will be bound to "0.0.0.0"and any available port.80 The {{{create_transport()}}} method returns the newly created [http://www.pjsip.org/python/pjsua.htm#Transport Transport] instance and it takes an optional [http://www.pjsip.org/python/pjsua.htm#TransportConfig 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. 81 81 82 There is no real use of the [http://www.pjsip.org/python/pjsua.htm#Transport Transport] instance, except to create '' account-less'' account (with {{{lib.create_account_for_transport()}}}, as will be explained in later chapter), and perhaps to display list of transport infos to user if the application wants it.82 There is no real use of the [http://www.pjsip.org/python/pjsua.htm#Transport Transport] instance, except to create ''userless'' account (with [http://www.pjsip.org/python/pjsua.htm#Lib-create_account_for_transport lib.create_account_for_transport()], as will be explained in later chapter), and perhaps to display the list of transports to user if the application wants it. 83 83 84 84 85 85 === Starting the Library === 86 86 87 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 :87 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 [http://www.pjsip.org/python/pjsua.htm#Lib-start lib.start()] method: 88 88 89 89 {{{ … … 98 98 == Shutting Down the Library == 99 99 100 Once the application exits, the library needs to be shutdown so that resources can be released back to the operating system. This is done like this:100 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 calling [http://www.pjsip.org/python/pjsua.htm#Lib-destroy lib.destroy()]: 101 101 102 102 {{{