Changes between Version 7 and Version 8 of Python_SIP_Tutorial
- Timestamp:
- Jul 15, 2008 11:52:43 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Python_SIP_Tutorial
v7 v8 1 1 2 2 = Getting Started = 3 ----4 3 5 4 This tutorial replaces the older [wiki:Py_PJSUA py_pjsua] tutorial. … … 11 10 The Python wrapper is implemented in two modules: 12 11 13 '''_pjsua''' module ::12 '''_pjsua''' module: :: 14 13 This is the low-level C Python module which provides Python binding to [http://www.pjsip.org/pjsip/docs/html/group__PJSUA__LIB.htm PJSUA API]. This module is the successor of [wiki:Py_PJSUA py_pjsua] module which now has been deprecated. 15 14 16 '''pjsua''' module ::15 '''pjsua''' module: :: 17 16 This is the higher level abstraction for [http://www.pjsip.org/pjsip/docs/html/group__PJSUA__LIB.htm PJSUA API]. It is object oriented and implemented purely on Python, on top of {{{_pjsua}}} module. 18 17 … … 40 39 41 40 = Developing Python SIP Application = 42 ----43 41 44 42 == Introduction == … … 46 44 The pjsua module only contains few classes so it should be straightforward to use. 47 45 48 == = Error Handling ===46 == Error Handling == 49 47 50 48 By convention, we use exceptions as means to report error. Operations which yields error will raise [http://www.pjsip.org/python/pjsua.htm#Error pjsua.Error] exception. 51 49 52 50 53 [[BR]] 54 55 === Lib Class === 56 ---- 51 == Lib Class == 57 52 58 53 The [http://www.pjsip.org/python/pjsua.htm#Lib Lib] class provides the base API's to communicate with PJSUA-API and to create objects (such as [http://www.pjsip.org/python/pjsua.htm#Account Account] and [http://www.pjsip.org/python/pjsua.htm#Transport Transport]). 54 55 [[BR]] 59 56 60 57 ==== Initializing the Library ==== … … 88 85 [[BR]] 89 86 90 === Transport === 91 ---- 87 == Transport == 92 88 93 89 Application needs to create one or more [http://www.pjsip.org/python/pjsua.htm#Transport Transport] objects before it can send or receive SIP messages: … … 105 101 [[BR]] 106 102 107 === Accounts === 108 ---- 103 == Accounts == 109 104 110 105 Application must create at least one [http://www.pjsip.org/python/pjsua.htm#Account Account] before it can send and receive SIP messages. An account specifies the '''From:''' URI, so it's needed before you can send SIP messages. … … 115 110 116 111 There can be more than one accounts in an application. 112 113 [[BR]] 117 114 118 115 ==== Creating Accounts ==== … … 160 157 }}} 161 158 159 [[BR]] 162 160 163 161 ==== Getting Events from Account ==== … … 194 192 }}} 195 193 194 [[BR]] 196 195 197 196 === Account Sample Application === … … 202 201 [[BR]] 203 202 204 === Calls === 205 ---- 203 == Calls == 206 204 207 205 ==== Creating Calls ==== … … 222 220 223 221 Note that as with all PJSIP operations, the {{{make_call()}}} function is asynchronous; it will not block until the call is connected, but rather it will return immediately as soon as the initial INVITE request is sent. Application is then informed about the call completion via [http://www.pjsip.org/python/pjsua.htm#CallCallback CallCallback] object (see below). 222 223 [[BR]] 224 224 225 225 ==== Getting Events from Call ==== … … 241 241 if self.call.info().media_state == pj.MediaState.ACTIVE: 242 242 # Connect the call to sound device 243 243 244 call_slot = self.call.info().conf_slot 244 245 pj.Lib.instance().conf_connect(call_slot, 0) … … 259 260 }}} 260 261 262 [[BR]] 261 263 262 264 === Call Sample Application === … … 267 269 [[BR]] 268 270 269 === Presence and Instant Messaging === 270 ---- 271 == Presence and Instant Messaging == 272 273 (The doc is TBD) 274 275 An [http://www.pjsip.org/python/pjsua.htm#Account Account] has a presence status associated with it, and when the presence status is changed (with {{{set_basic_status()}}} or {{{set_presence_status()}}}), the changes will be propagated to presence subscriber with using either PUBLISH or NOTIFY SIP methods. 276 277 To subscribe to buddy's presence status, application creates [http://www.pjsip.org/python/pjsua.htm#Buddy Buddy] object using account's {{{add_buddy()}}} method. Changes in buddy's presence status will be reported via [http://www.pjsip.org/python/pjsua.htm#BuddyCallback BuddyCallback] class, which must be derived and then installed to the Buddy object. 271 278 272 279 For a complete presence and instant messaging sample application, please see source:pjproject/trunk/pjsip-apps/src/python/samples/presence.py … … 276 283 277 284 = Reference Documentation = 278 ----279 285 280 286 Please see [http://www.pjsip.org/python/pjsua.htm pjsua] Python module documentation for reference.