Changes between Version 1 and Version 2 of Python_SIP/Media


Ignore:
Timestamp:
Jul 23, 2008 3:08:34 PM (11 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Python_SIP/Media

    v1 v2  
    1616In pjsua Python module and in [http://www.pjsip.org/pjsip/docs/html/group__PJSUA__LIB.htm PJSUA API] in general, all media objects are terminated in the central conference bridge so that they are easier to manipulate. When objects are plugged-in to the conference bridge, they will be given a ''slot number'' that identifies the objects in the bridge. 
    1717 
    18 The conference bridge provides a simple but yet powerful API to manage audio routing between the audio objects. The principle is very simple, that is you connect audio source to audio destination, and that's it. If more than one sources are transmitting to the same destination, then the audio will be mixed. If one source is transmitting to more than one destinations, the bridge will take care of duplicating the audio from the source to the multiple destinations. 
     18The conference bridge provides a simple but yet powerful API to manage audio routing between the audio objects. The principle is very simple, that is you connect audio source to audio destination, and the bridge will make the audio flows from the source to destination, and that's it. If more than one sources are transmitting to the same destination, then the audio will be mixed. If one source is transmitting to more than one destinations, the bridge will take care of duplicating the audio from the source to the multiple destinations. 
    1919 
    2020Lets see a diagram of a conference bridge with several media objects. 
    2121 
     22[[Image(conference-bridge.jpg)]] 
    2223 
     24The diagram above shows the conference bridge with the following objects: 
     25 * sound device, which by convention is always attached at slot number 0 
     26 * a WAV file to be played back at slot 1 
     27 * a WAV file for recording at slot 2 
     28 * an active call to Alice at slot 3 
     29 * an active call to Bob at slot 4 
     30 
     31When a media object is plugged-in to the bridge, it will not be connected to anything, so media will not flow from/to the object. When no connections are made in the bridge (like the diagram above), then no media will be flowing in the bridge at all. 
     32 
     33=== Sample: WAV File Playback === 
     34 
     35To playback the WAV file to the speaker, just connect the WAV playback object to the sound device, and that's it. Simple isn't it! 
     36 
     37[[Image(conference-bridge-wav-playback.jpg)]] 
     38 
     39Here's the code to connect the WAV playback object to the speaker: 
     40 
     41 {{{ 
     42#!python 
     43  lib.conf_connect(1, 0) 
     44 }}} 
     45 
     46The [http://www.pjsip.org/python/pjsua.htm#Lib-conf_connect conf_connect()] method takes two arguments:  
     47 * the first argument is the slot number of the source media object, in this case one (1) for the WAV file playback, and  
     48 * the second argument is the slot number of the destination media object, in this case zero for the sound device 
     49 
     50Once you're done with the playback, just disconnect the connection to stop the playback: 
     51 
     52 {{{ 
     53#!python 
     54  lib.conf_disconnect(1, 0) 
     55 }}} 
     56