<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><font class="Apple-style-span" color="#010001">Hello Jason,</font><div><font class="Apple-style-span" color="#010001"><br></font></div><div><font class="Apple-style-span" color="#010001">Thank you for your help. Both of them improved the code. Closing the open file handle is very good, because i saw in the process view many "sh" processes.</font></div><div><font class="Apple-style-span" color="#010001">But the error is another. </font></div><div><font class="Apple-style-span" color="#010001"><br></font></div><div><font class="Apple-style-span" color="#010001">I increase the time of silence to 7 instead of 3.</font></div><div><font class="Apple-style-span" color="#010001">it seems to be that in this time that session.streamFile is executed (3sec. audio file) , the next instruction session.recordFile is executed, because the first 5 seconds of audio files in the second run are silence.</font></div><div><font class="Apple-style-span" color="#010001"><br></font></div><div><font class="Apple-style-span" color="#010001">I have no answer about this control.</font></div><div><font class="Apple-style-span" color="#010001">for the first my changes works for me, but with a little bit more waiting time. </font><span class="Apple-style-span" style="color: rgb(1, 0, 1); "> </span></div><div><br></div><div><br></div><div>Daniel</div><div><br></div><div><div><div>Am 14.07.2011 um 15:26 schrieb Jason Moran:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>One other thing to check - make sure you aren't having problems with<br>open file handles. You might have to play around with issuing an<br>fd.close() at the appropriate time or else try incrementing the file<br>name (and other permutations) to ensure you aren't blocking yourself<br>from writing the same file.<br><br>-Jason<br><br>-----Original Message-----<br>From: Daniel Knoll [mailto:daniel@danielknoll.de] <br>Sent: Wednesday, July 13, 2011 6:28 PM<br>To: FreeSWITCH Users Help<br>Subject: Re: [Freeswitch-users] session.recordFile create empy wav in<br>whileloop<br><br>Hi Steve,<br>Thanx for helping me,<br>the call is established and the loop can be re-run and re-run. but the<br>new audio file that is created is empty.<br>i have the same issue if i use session.execute("record",<br>"/dev/shm/"+rd+".wav 10 150");<br><br>unfortunately there is no function to stop the record.<br><br>If you can help me I would be very thankful<br><br>Daniel<br><br><br>Am 13.07.2011 um 23:27 schrieb Steven Ayre:<br><br><blockquote type="cite">I'd need to set up a testcase to confirm it, but I think it's probably<br></blockquote><blockquote type="cite">that recordFile blocks and doesn't return until it's finished<br></blockquote><blockquote type="cite">recording at the end of the call. As a result on the next loop<br></blockquote><blockquote type="cite">iteration there'll be no call so nothing to record.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">-Steve<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On 13 July 2011 22:17, Daniel Knoll <<a href="mailto:daniel@danielknoll.de">daniel@danielknoll.de</a>> wrote:<br></blockquote><blockquote type="cite"><blockquote type="cite">Any Ideas for my problem?<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">The question is, why is the audio file empty if i re-run in while<br></blockquote></blockquote>loop?<br><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Thanks<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Daniel<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Am 13.07.2011 um 11:24 schrieb Daniel Knoll:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Hi Steve, thanks for fast answer. The Channel is't hung up, because<br></blockquote></blockquote></blockquote>I<br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">stream in the same loop an Audio File<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">here is the code, the session.recordFile is executed in the second<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">run, because, the filesize is changing for the file at first run.<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">do {<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> var rd = session.uuid;<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote>session.streamFile("/dev/shm/freeswitch/sounds/conf-asrintro.wav", "");<br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> session.recordFile("/dev/shm/"+rd+".wav", "", "", 10, 500, 3);<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> system("sox -v 1.7 /dev/shm/"+rd+".wav -r 16000<br></blockquote></blockquote></blockquote>/dev/shm/"+rd+".flac");<br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> var fd = new File("|/usr/bin/googlespeech.sh<br></blockquote></blockquote></blockquote>/dev/shm/"+rd+".flac");<br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> fd.open("read");<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> var dtmf = fd.read("8");<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> dtmf = dtmf.replace(/[^0-9]/g, '');<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> console_log("notice", "DTMF: "+ dtmf +"\n");<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> roomExists = checkRoom(dtmf);<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> if(!roomExists){<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> retry_count++;<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote>session.streamFile("/dev/shm/freeswitch/sounds/conf-invalid.wav", "");<br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> var dtmf = "";<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"> }<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">} while(!roomExists && retry_count < 5);<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">I googled at this and found some guys he has also the same problem<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><a href="http://asterisk.voicemeup.com/viewtopic.php?p=62294&sid=8360229099e219df">http://asterisk.voicemeup.com/viewtopic.php?p=62294&sid=8360229099e219df</a><br>50bbb016cd43cbfd<br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Can you help me ?<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Thanx Daniel<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">2011/7/13, Steven Ayre <steveayre@gmail.com>:<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Are you able to share the code?<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Are you checking session.ready in the while loop's condition? Might<br></blockquote></blockquote></blockquote></blockquote>the<br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">channel be hung up when it reaches the 2nd recordFile?<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">-Steve<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">On 13 July 2011 10:01, Daniel Knoll <daniel@danielknoll.de> wrote:<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Hey Guys,<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">i have a strange Problem with session.recordFile in a while loop<br></blockquote></blockquote></blockquote></blockquote></blockquote>and i<br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">don't know how to solve it.<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">The first run in the loop is absolutly ok, session.recordFile is<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">creating a good clean wavefile.<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">but in the second, third .. run, every wav file has a size of<br></blockquote></blockquote></blockquote></blockquote></blockquote>47724<br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">byte and no audio content.<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Please help me, because it is an urgent case.<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Thankx for getting help.<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Daniel<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Join us at ClueCon 2011, Aug 9-11, Chicago<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">http://www.cluecon.com 877-7-4ACLUE<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">FreeSWITCH-users mailing list<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">FreeSWITCH-users@lists.freeswitch.org<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote></blockquote>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">http://www.freeswitch.org<br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">--<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Daniel Knoll<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Liberdastr.. 9<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">12047 Berlin<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">fon +49 (0)179 20 16 50 8<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">mail daniel@danielknoll.de<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">web www.danielknoll.de<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">_______________________________________________<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Join us at ClueCon 2011, Aug 9-11, Chicago<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">http://www.cluecon.com 877-7-4ACLUE<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">FreeSWITCH-users mailing list<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">FreeSWITCH-users@lists.freeswitch.org<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br><blockquote type="cite"><blockquote type="cite">http://www.freeswitch.org<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">Join us at ClueCon 2011, Aug 9-11, Chicago<br></blockquote><blockquote type="cite">http://www.cluecon.com 877-7-4ACLUE<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">FreeSWITCH-users mailing list<br></blockquote><blockquote type="cite">FreeSWITCH-users@lists.freeswitch.org<br></blockquote><blockquote type="cite">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br></blockquote><blockquote type="cite"><br></blockquote>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br><blockquote type="cite">http://www.freeswitch.org<br></blockquote><br><br><br><br>_______________________________________________<br>Join us at ClueCon 2011, Aug 9-11, Chicago<br>http://www.cluecon.com 877-7-4ACLUE<br><br>FreeSWITCH-users mailing list<br>FreeSWITCH-users@lists.freeswitch.org<br>http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br>UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br>http://www.freeswitch.org<br></div></blockquote></div><br></div></body></html>