Changes between Version 6 and Version 7 of Python_SIP/Media


Ignore:
Timestamp:
Jul 24, 2008 5:07:52 PM (16 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Python_SIP/Media

    v6 v7  
    1 = Media Concept = 
     1= Media Concepts = 
    22 
    33[[TracNav(Python_SIP/TOC)]] 
     
    66== Media Objects == 
    77 
    8 Media objects are objects that are capable to process media. In [http://www.pjsip.org/pjmedia/docs/html/index.htm PJMEDIA] terms, these objects re implemented as media ports (or [http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__PORT.htm pjmedia_port]).  
     8Media objects are objects that are capable to either produce media or takes media, with media in this case is audio. In [http://www.pjsip.org/pjmedia/docs/html/index.htm PJMEDIA] terms, these objects are implemented as media ports ([http://www.pjsip.org/pjmedia/docs/html/group__PJMEDIA__PORT.htm pjmedia_port]).  
    99 
    1010There are several type of media objects supported in pjsua: 
    11  * call, obviously, to transmit and receive media from remote person. 
     11 * call, obviously, to transmit and receive media to/from remote person. 
    1212 * WAV file player to play WAV file 
    1313 * WAV file recorder to record audio to a WAV file 
     
    1616More media objects may be added in the future. 
    1717 
    18 Operations about these media objects will be explained on later chapter. 
     18We will only discuss the basic concept about media in this chapter. Detailed operations on these media objects will be explained on the next chapter. 
    1919 
    2020== The Conference Bridge == 
     
    2323 
    2424Each object provides different API to fetch the slot number associated with it: 
    25  * for [http://www.pjsip.org/python/pjsua.htm#Call Call] object, the slot number is in the [http://www.pjsip.org/python/pjsua.htm#CallInfo CallInfo] structure, so it can be fetch with {{{call.info().conf_slot}}} (once the media is active of course). 
     25 * for [http://www.pjsip.org/python/pjsua.htm#Call Call] object, the slot number is in ''conf_slot'' of the [http://www.pjsip.org/python/pjsua.htm#CallInfo CallInfo] structure, so it can be fetch with {{{call.info().conf_slot}}} (once the media is active of course). 
    2626 * for WAV file player, use [http://www.pjsip.org/python/pjsua.htm#Lib-player_get_slot lib.player_get_slot()] 
    2727 * for WAV playlist, use [http://www.pjsip.org/python/pjsua.htm#Lib-playlist_get_slot lib.playlist_get_slot()] 
     
    2929 
    3030 
    31 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. 
     31The 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 from the sources 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. 
    3232 
    3333Lets see a diagram of a conference bridge with several media objects. 
     
    4242 * an active call to Bob at slot 4 
    4343 
    44 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. 
     44When a media object is plugged-in to the bridge, it will not be connected to anything, so media will not flow from/to any objects. 
    4545 
    46 === Sample: WAV File Playback === 
     46=== WAV File Playback === 
    4747 
    48 To playback the WAV file to the speaker, just connect the WAV playback object to the sound device, with the snippet below: 
     48To playback the WAV file to the speaker, just connect the WAV playback object to the sound device, to make a connection like this: 
    4949 
    5050[[Image(conference-bridge-wav-playback.jpg)]] 
     
    7171 
    7272 
    73 === Sample: Recording to WAV File === 
     73=== Recording to WAV File === 
    7474 
    7575Or if you want to record the microphone to the WAV file, simply do this: 
     
    9494 
    9595 
    96 === Sample: Normal Call === 
     96=== Normal Call === 
    9797 
    9898For a normal call, we would want to establish bidirectional audio with the remote person (with Alice, in this case), which can be done easily by connecting the sound device and the call and vice versa: 
     
    108108 }}} 
    109109 
    110 Of course on a real application, you would replace the number "3" above with the slot number of the call, which you can get with {{{call.info().conf_slot}}}. 
     110Of course on a real application, we will replace the number "3" above with the slot number of the call, which we can get with {{{call.info().conf_slot}}}. 
    111111 
    112112The diagram below shows the interconnection in the bridge now: 
     
    114114[[Image(conference-bridge-call.jpg)]] 
    115115 
     116You can see in the diagram above the bidirectional audio between sound device and the call as shown in red lines. 
    116117 
    117 === Sample: Second Call === 
     118=== Second Call === 
    118119 
    119120Suppose we want to talk with Alice and Bob at the same time. Since we already have bidirectional media connection with Alice, we just need to add  bidirectional connection with Bob using the code below. 
     
    132133Now we can talk to Alice and Bob at the same time, and we will hear audio from either party. But at this stage, Alice and Bob can't talk or hear each other (i.e. we're not in full conference mode yet). 
    133134 
    134 === Sample: Conference Call === 
     135=== Conference Call === 
    135136 
    136137To make Alice and Bob talk to each other, just establish bidirectional media between them: 
     
    149150Now the three parties (us, Alice, and Bob) will be able to talk to each other. 
    150151 
    151 === Sample: Recording the Conference === 
     152=== Recording the Conference === 
    152153 
    153154While doing the conference, it perfectly makes sense to want to record the conference to a WAV file, and all we need to do is to connect the microphone and both calls to the WAV recorder: 
     
    166167 
    167168That looks like a pretty intricate connections indeed, but the good thing is we don't need to worry about it as all will be taken care of by the bridge. We only need to care about what the audio routings that we want to achieve. 
     169