Hi,<div><br></div><div>I&#39;m analyzing the way the Monitor application works in Asterisk 1.4. At first it seems very simple, however the code in channel.c (__ast_read function around line 2390):</div><div><br></div><div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>int jump = chan-&gt;outsmpl - chan-&gt;insmpl - 4 * f-&gt;samples;</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>if (jump &gt;= 0) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                </span>jump = chan-&gt;outsmpl - chan-&gt;insmpl;</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>if (ast_seekstream(chan-&gt;monitor-&gt;read_stream, jump, SEEK_FORCECUR) == -1)</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                        </span>ast_log(LOG_WARNING, &quot;Failed to perform seek in monitoring read stream, synchronization between the files may be broken\n&quot;);</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>chan-&gt;insmpl += jump + f-&gt;samples;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>} else</div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>chan-&gt;insmpl+= f-&gt;samples;</div><div><br></div><div>seems confusing to me. What is being done here?</div>
<div><br></div><div>Is it a way to keep the in and out files synchronized? If yes, how does it work? Is it possible that one file can present chunks of silence (80ms long for example) if this way of the call doesn&#39;t receive samples in the same rate of the other?</div>
<div><br></div><div>Thanks in advance</div><div><br></div><div>Paulo Garcia</div>
</div>