Changes between Version 7 and Version 8 of Python_SIP_Tutorial


Ignore:
Timestamp:
Jul 15, 2008 11:52:43 AM (16 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Python_SIP_Tutorial

    v7 v8  
    11 
    22= Getting Started = 
    3 ---- 
    43 
    54This tutorial replaces the older [wiki:Py_PJSUA py_pjsua] tutorial. 
     
    1110The Python wrapper is implemented in two modules: 
    1211 
    13  '''_pjsua''' module :: 
     12 '''_pjsua''' module: :: 
    1413  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. 
    1514 
    16  '''pjsua''' module :: 
     15 '''pjsua''' module: :: 
    1716  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. 
    1817 
     
    4039 
    4140= Developing Python SIP Application = 
    42 ---- 
    4341 
    4442== Introduction == 
     
    4644The pjsua module only contains few classes so it should be straightforward to use. 
    4745 
    48 === Error Handling === 
     46== Error Handling == 
    4947 
    5048By 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. 
    5149 
    5250 
    53 [[BR]] 
    54  
    55 === Lib Class === 
    56 ---- 
     51== Lib Class == 
    5752 
    5853The [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]] 
    5956 
    6057==== Initializing the Library ==== 
     
    8885[[BR]] 
    8986 
    90 === Transport === 
    91 ---- 
     87== Transport == 
    9288 
    9389Application needs to create one or more [http://www.pjsip.org/python/pjsua.htm#Transport Transport] objects before it can send or receive SIP messages: 
     
    105101[[BR]] 
    106102 
    107 === Accounts === 
    108 ---- 
     103== Accounts == 
    109104 
    110105Application 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. 
     
    115110 
    116111There can be more than one accounts in an application. 
     112 
     113[[BR]] 
    117114 
    118115==== Creating Accounts ==== 
     
    160157 }}} 
    161158 
     159[[BR]] 
    162160 
    163161==== Getting Events from Account ==== 
     
    194192 }}} 
    195193 
     194[[BR]] 
    196195 
    197196=== Account Sample Application === 
     
    202201[[BR]] 
    203202 
    204 === Calls === 
    205 ---- 
     203== Calls == 
    206204 
    207205==== Creating Calls ==== 
     
    222220 
    223221Note 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]] 
    224224 
    225225==== Getting Events from Call ==== 
     
    241241        if self.call.info().media_state == pj.MediaState.ACTIVE: 
    242242            # Connect the call to sound device 
     243 
    243244            call_slot = self.call.info().conf_slot 
    244245            pj.Lib.instance().conf_connect(call_slot, 0) 
     
    259260 }}} 
    260261 
     262[[BR]] 
    261263 
    262264=== Call Sample Application === 
     
    267269[[BR]] 
    268270 
    269 === Presence and Instant Messaging === 
    270 ---- 
     271== Presence and Instant Messaging == 
     272 
     273(The doc is TBD) 
     274 
     275An [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 
     277To 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. 
    271278 
    272279For a complete presence and instant messaging sample application, please see source:pjproject/trunk/pjsip-apps/src/python/samples/presence.py 
     
    276283 
    277284= Reference Documentation = 
    278 ---- 
    279285 
    280286Please see [http://www.pjsip.org/python/pjsua.htm pjsua] Python module documentation for reference.