[Freeswitch-users] session.recordFile create empy wav in whileloop
Jason Moran
jmoran at secureachsystems.com
Thu Jul 14 17:21:08 MSD 2011
I thought you could stop the record via an action in your callback
function?
For example if you used this format:
session.recordFile(fileName, callbackFunction, "", maxreclen,
silencethreshold, silencehits);
Let's say you passed in "onRecordDTMF" as your callbackFunction:
session.recordFile("/dev/shm/"+rd+".wav", onRecordDTMF, "", 10, 500, 3);
function onRecordDTMF(session, type, digits, arg)
{
if (digits.digit == "#") {
return false;
}
else {
return true;
}
}
The recording would end in 2 possible ways: Let it have the silence
timeout or allow a force recording end with the "#" DTMF symbol. Your
recording message could indicate to hit the "#" to end recording (or
allow the silence to stop it).
-Jason
-----Original Message-----
From: Daniel Knoll [mailto:daniel at danielknoll.de]
Sent: Wednesday, July 13, 2011 6:28 PM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] session.recordFile create empy wav in
whileloop
Hi Steve,
Thanx for helping me,
the call is established and the loop can be re-run and re-run. but the
new audio file that is created is empty.
i have the same issue if i use session.execute("record",
"/dev/shm/"+rd+".wav 10 150");
unfortunately there is no function to stop the record.
If you can help me I would be very thankful
Daniel
Am 13.07.2011 um 23:27 schrieb Steven Ayre:
> 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=8360229099e219df
50bbb016cd43cbfd
>>>
>>> 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
>>
>
> _______________________________________________
> 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