Changes between Version 1 and Version 2 of Python_SIP/Media
- Timestamp:
- Jul 23, 2008 3:08:34 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Python_SIP/Media
v1 v2 16 16 In 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. 17 17 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 th at'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.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 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. 19 19 20 20 Lets see a diagram of a conference bridge with several media objects. 21 21 22 [[Image(conference-bridge.jpg)]] 22 23 24 The 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 31 When 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 35 To 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 39 Here's the code to connect the WAV playback object to the speaker: 40 41 {{{ 42 #!python 43 lib.conf_connect(1, 0) 44 }}} 45 46 The [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 50 Once 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