<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On 21 Dec 2005, at 22:31, Matt Roth wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">List users,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I have some additional information related to the dropped audio.<SPAN class="Apple-converted-space">  </SPAN>As always, I'd appreciate any help interpreting it.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I set up an extension that calls the Milliwatt() application and is digitally recorded by the Monitor() application.<SPAN class="Apple-converted-space">  </SPAN>Calls placed to it don't result in any of the custom warning messages and produce recordings free of skips/pops.<SPAN class="Apple-converted-space">  </SPAN>I know that the same code is being executed, because it is also where the digital recordings are streamed to file.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Therefore, it can be concluded that the problem lies somewhere in the differences between a SIP to SIP call and a SIP to Asterisk (in this case, the Milliwatt() application) call.<SPAN class="Apple-converted-space">  </SPAN>The most obvious of the differences is that a SIP to SIP call involves two active SIP channels that are bridged together.<SPAN class="Apple-converted-space">  </SPAN>A SIP to Asterisk call only involves one active SIP channel.<SPAN class="Apple-converted-space">  </SPAN>I confirmed this by placing calls of both types and observing the output of the "sip show channels" command in the CLI.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">To confirm that it is not simply a matter of the number of active SIP channels on the Asterisk server, I placed two simultaneous SIP to Asterisk calls and observed that no custom warning messages were generated.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">On a SIP to SIP call, a custom warning message is almost always generated from the ast_read() function as soon as the callee picks up the phone and the SIP channels are bridged.<SPAN class="Apple-converted-space">  </SPAN>The messages then appear sporadically throughout the call, and there is often a final message generated when the call is terminated.<SPAN class="Apple-converted-space">  </SPAN>Keep in mind, each of these messages is indicative of a short drop in the call audio which can be heard as a pop/click on the PCM format recording.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">All of this leads me to believe that the problem dwells somewhere in the code responsible for bridging the channels.<SPAN class="Apple-converted-space">  </SPAN>Does anyone have any ideas as to the specific cause or the direction that I should go to further pursue it?<SPAN class="Apple-converted-space">  </SPAN>I've heard that Asterisk's locking scheme is questionable, but I don't know if that would apply to this scenario.</DIV></BLOCKQUOTE><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I'd still like to hear if anyone else has replicated the problem, as well.</DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV>I have no experience of your problem, and I have never delved into the SIP code, but I think</DIV><DIV>I have come across a problem with a similar cause.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I was working on an IAX client, and experiencing increasing latency, such that one speech </DIV><DIV>was delayed by several seconds from one end to the other. </DIV><DIV>It turned out that the clock in one of my endpoints (an old laptop) </DIV><DIV>was running 2% slower than the other one (a new SNOM phone). The code in my laptop was using</DIV><DIV>the built-in clock to decide when to play received data. So it wasn't reading data quite as fast as it arrived,</DIV><DIV>slowly more and more data got buffered, and the audio got behind the other end.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I fixed this by getting the code to notice that the clocks were skewed, and then dropping </DIV><DIV>a few samples in an effort to catch up, which results in a click (sometimes).</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I think that the problem you are hearing is related to this, i.e. if the clocks are skewed, then</DIV><DIV>* has to drop some of the data from the faster source to keep them in sync, or make up</DIV><DIV>some data from the slower!</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The other strategy * tries to adopt is to time an entire call from the clock at one end, and have</DIV><DIV>the other end use that timing (your milliwatt case), but where there are 2 external parties involved</DIV><DIV>this isn't an option.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>The WARNING in the code you cite does give a hint as to what the programmer is attempting.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I'd say your best bet for a fix would be to try and get the gaps less perceptible by some</DIV><DIV>sort of linear interpolation.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Tim.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Thanks,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Matthew Roth</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">InterMedia Marketing Solutions</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Software Engineer and Systems Developer</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Matt Roth wrote:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV> <BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">List users,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Below is a bug report documenting Asterisk dropping call audio at very low loads (1 call).<SPAN class="Apple-converted-space">  </SPAN>I have personally reproduced it on three separate machines, multiple network architectures (including a 48-port Cisco Catalyst 3560 POE switch dedicated to an Asterisk server and two Snom 320 VoIP phones), and three versions of Asterisk.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Despite this effort, I would still like to insure that I am not experiencing an isolated problem.<SPAN class="Apple-converted-space">  </SPAN>That is where I need your help.<SPAN class="Apple-converted-space">  </SPAN>If you could follow the steps in the bug report and post your results to the list, it would be greatly appreciated.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Thank you,</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Matthew Roth</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">InterMedia Marketing Solutions</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Software Engineer and Systems Developer</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">================================================================================<SPAN class="Apple-converted-space"> </SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Description of problem:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Dropped audio during SIP to SIP, u-Law calls manifesting itself as clicks/pops in PCM format recordings.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Version-Release number of selected component (if applicable):</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">A.2-beta, A.2-1, SVN-branch-1.2-r7231</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">How reproducible:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Always</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Steps to Reproduce:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">1. Setup SIP to SIP calls to use the u-Law codec</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">2. Setup SIP to SIP calls to be recorded in PCM format via the Monitor application</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">3. Conduct a 5 to 10 minute SIP to SIP call</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">4. Mix the leg files with soxmix (soxmix -v 1.0 -t ul LEG-IN.PCM -t ul LEG-OUT.PCM -g -b MIXED.WAV)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">5. Listen to the mixed file</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Actual Results:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Periods of dropped audio in the call can be heard as clicks/pops in the recording.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Expected Results:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Clear call audio and recording.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Additional info:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">The format that the call is recorded in is relevant.<SPAN class="Apple-converted-space">  </SPAN>The PCM format accentuates the dropped audio as a click/pop, while the GSM format masks it as periods of (sometimes imperceptible) silence.<SPAN class="Apple-converted-space">  </SPAN>Therefore, it is extremely important to record in PCM format to diagnose the problem.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Adding an ast_log() call to the ast_read() and ast_write() functions in channel.c that logs calls to the ast_seekstream() function can be helpful in debugging the problem.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">For example:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>/* From ast_read() */</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>int jump = chan-&gt;outsmpl - chan-&gt;insmpl - 2 * f-&gt;samples;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>if (jump &gt;= 0) {</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>if (ast_seekstream(chan-&gt;monitor-&gt;read_stream, jump + f-&gt;samples, SEEK_FORCECUR) == -1)</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">           </SPAN>ast_log(LOG_WARNING, "Failed to perform seek in monitoring read stream, synchronization between the files may be broken\n");</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>chan-&gt;insmpl += jump + 2 * f-&gt;samples;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>/* Log calls to ast_seekstream */</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>ast_log(LOG_WARNING, "Performed %d sample jump in monitoring read stream to synchronize the leg files\n", jump + f-&gt;samples);</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">   </SPAN>} else</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>chan-&gt;insmpl+= f-&gt;samples;</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">       </SPAN>All dropped call audio will now be accompanied by the "Warning" statement that has been added.<SPAN class="Apple-converted-space">  </SPAN>Note these as they appear in the console (or messages log) then listen to the recording.<SPAN class="Apple-converted-space">  </SPAN>You will see that the drops in call audio, the</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">clicks/pops in the recording, and the warnings are occurring at precisely the same moment.</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--Bandwidth and Colocation provided by Easynews.com --</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Asterisk-Users mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">To UNSUBSCRIBE or update options visit:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">  </SPAN><A href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</A></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV> </BLOCKQUOTE><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">--Bandwidth and Colocation provided by Easynews.com --</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><BR></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Asterisk-Users mailing list</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">To UNSUBSCRIBE or update options visit:</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><SPAN class="Apple-converted-space">  </SPAN><A href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</A></DIV> </BLOCKQUOTE></DIV><BR><DIV> <P style="margin: 0.0px 0.0px 0.0px 0.0px"><FONT face="Helvetica" size="3" style="font: 12.0px Helvetica"><A href="http://www.westhawk.co.uk">http://www.westhawk.co.uk</A>/</FONT></P>  </DIV><BR></BODY></HTML>