Changes between Version 3 and Version 4 of Python_SIP/Media


Ignore:
Timestamp:
Jul 23, 2008 5:43:36 PM (16 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Python_SIP/Media

    v3 v4  
    5757 }}} 
    5858 
     59 
     60=== Sample: Recording to WAV File === 
     61 
     62Or if you want to record the microphone to the WAV file, simply do this: 
     63 
     64 {{{ 
     65#!python 
     66  lib.conf_connect(0, 2) 
     67 }}} 
     68 
     69And the media will flow from the sound device to the WAV record file, as shown in the diagram below: 
     70 
     71[[Image(conference-bridge-snd-rec.jpg)]] 
     72 
     73As usual, to stop or pause recording, just disconnect the connection: 
     74 
     75 {{{ 
     76#!python 
     77  lib.conf_disconnect(0, 2) 
     78 }}} 
     79 
     80(Note that disconnecting the WAV recorder as above does not close the WAV file, and you can resume recording by connecting a source to the WAV recorder again.) 
     81 
     82 
    5983=== Sample: Normal Call === 
    6084 
    61 For a normal call, we'd want to establish bidirectional audio with the remote person, as the diagram below shows. 
     85For a normal call, we'd want to establish bidirectional audio with the remote person, which can be done easily by establishing bidirectional connection between the call (with Alice, in this case) and the sound device: 
     86 
     87 {{{ 
     88#!python 
     89 
     90 lib.conf_connect(0, 3) 
     91 lib.conf_connect(3, 0) 
     92 }}} 
     93 
     94Of 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}}}. 
     95 
     96The diagram below shows the interconnection in the bridge now: 
    6297 
    6398[[Image(conference-bridge-call.jpg)]] 
     99 
     100 
     101=== Sample: Second Call === 
     102 
     103Suppose 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 the code below to establish bidirectional connection with Bob. 
     104 
     105 {{{ 
     106#!python 
     107 
     108  lib.conf_connect(0, 4) 
     109  lib.conf_connect(4, 0 
     110 }}} 
     111 
     112Now we can talk to Alice and Bob at the same time, and we will hear audio from either party. The interconnection diagram in the bridge will be like this: 
     113 
     114[[Image(conference-bridge-2-calls.jpg)]] 
     115 
     116At this stage, we can talk to both Alice and Bob, but Alice and Bob can't talk or hear each other. 
     117 
     118=== Sample: Conference Call === 
     119 
     120To make Alice and Bob talk to each other, just establish bidirectional media between them: 
     121 
     122 {{{ 
     123#!python 
     124 
     125 lib.conf_connect(3, 4) 
     126 lib.conf_connect(4, 3) 
     127 }}} 
     128 
     129The snippet above will add the new connections as shown as lines with black color below: 
     130 
     131[[Image(conference-bridge-conf-call.jpg)]] 
     132 
     133 
     134=== Sample: Recording the Conference === 
     135 
     136While 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: 
     137 
     138 {{{ 
     139#!python 
     140 
     141 lib.conf_connect(0, 2) 
     142 lib.conf_connect(3, 2) 
     143 lib.conf_connect(4, 2) 
     144 }}} 
     145 
     146The connections in the conference bridge now will look like the diagram below, with the snippet above adds the brown lines in the diagram: 
     147 
     148[[Image(conference-bridge-conf-call-record.jpg)]] 
     149