[Freeswitch-users] session.recordFile create empy wav in while loop

Steven Ayre steveayre at gmail.com
Thu Jul 14 01:27:52 MSD 2011


I'd need to set up a testcase to confirm it, but I think it's probably
that recordFile blocks and doesn't return until it's finished
recording at the end of the call. As a result on the next loop
iteration there'll be no call so nothing to record.

-Steve



On 13 July 2011 22:17, Daniel Knoll <daniel at danielknoll.de> wrote:
> Any Ideas for my problem?
> The question is, why is the audio file empty if i re-run in while loop?
>
> Thanks
> Daniel
>
>
> Am 13.07.2011 um 11:24 schrieb Daniel Knoll:
>
>> Hi Steve, thanks for fast answer. The Channel is't hung up, because I
>> stream in the same loop an Audio File
>>
>> here is the code, the session.recordFile is executed in the second
>> run, because, the filesize is changing for the file at first run.
>>
>> do {
>>       var rd = session.uuid;
>>       session.streamFile("/dev/shm/freeswitch/sounds/conf-asrintro.wav", "");
>>       session.recordFile("/dev/shm/"+rd+".wav", "", "", 10, 500, 3);
>>               system("sox -v 1.7 /dev/shm/"+rd+".wav -r 16000 /dev/shm/"+rd+".flac");
>>       var fd = new File("|/usr/bin/googlespeech.sh /dev/shm/"+rd+".flac");
>>       fd.open("read");
>>       var dtmf = fd.read("8");
>>       dtmf = dtmf.replace(/[^0-9]/g, '');
>>       console_log("notice", "DTMF: "+ dtmf +"\n");
>>       roomExists = checkRoom(dtmf);
>>       if(!roomExists){
>>               retry_count++;
>>               session.streamFile("/dev/shm/freeswitch/sounds/conf-invalid.wav", "");
>>               var dtmf = "";
>>       }
>> } while(!roomExists && retry_count < 5);
>>
>>
>> I googled at this and found some guys he has also the same problem
>> http://asterisk.voicemeup.com/viewtopic.php?p=62294&sid=8360229099e219df50bbb016cd43cbfd
>>
>> Can you help me ?
>>
>> Thanx Daniel
>>
>>
>>
>>
>>
>> 2011/7/13, Steven Ayre <steveayre at gmail.com>:
>>> Are you able to share the code?
>>>
>>> Are you checking session.ready in the while loop's condition? Might the
>>> channel be hung up when it reaches the 2nd recordFile?
>>>
>>> -Steve
>>>
>>>
>>> On 13 July 2011 10:01, Daniel Knoll <daniel at danielknoll.de> wrote:
>>>
>>>> Hey Guys,
>>>>
>>>> i have a strange Problem with session.recordFile in a while loop and i
>>>> don't know how to solve it.
>>>> The first run in the loop is absolutly ok, session.recordFile is
>>>> creating a good clean wavefile.
>>>> but in the second, third ..  run, every wav file has a size of 47724
>>>> byte and no audio content.
>>>>
>>>> Please help me, because it is an urgent case.
>>>>
>>>> Thankx for getting help.
>>>> Daniel
>>>>
>>>> _______________________________________________
>>>> Join us at ClueCon 2011, Aug 9-11, Chicago
>>>> http://www.cluecon.com 877-7-4ACLUE
>>>>
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org
>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>> http://www.freeswitch.org
>>>>
>>>
>>
>>
>> --
>> Daniel Knoll
>> Liberdastr.. 9
>> 12047 Berlin
>>
>> fon +49 (0)179 20 16 50 8
>> mail daniel at danielknoll.de
>> web www.danielknoll.de
>
>
> _______________________________________________
> Join us at ClueCon 2011, Aug 9-11, Chicago
> http://www.cluecon.com 877-7-4ACLUE
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>



More information about the FreeSWITCH-users mailing list