[Freeswitch-users] Bug?: recordFile with input callback always ends recording

Michael Lutz mytemike72 at gmail.com
Fri Feb 17 17:11:49 MSK 2012


Hi All,

I am using the following peace of code, It should be able to set a
termination key with the cStopRecording variable, and inside the input
callback it should terminate if the dtmf key entered is valid and
should return "break".
However as soon as it gets inside the input callback function it
always terminates the recording? Based on the wiki example this should
work. By debugging I can see it never gets to the"return "break"". So
the evaluation is correct.

Can someone please tell me what I am doing wrong or is it a bug?


Regards,
Mike.

----------------------------------------------------
cStopRecordingKey = "#"		
cFile = "blah.wav"

session:setInputCallback("Record_onInput", "");		
session:recordFile(cFile, 120, 10, 10);
session:streamFile(cFile);

function Record_onInput(s, type, obj)
	if cRecordingStopkey == "-" then cRecordingStopkey = "" end
     -- None
	if cRecordingStopkey == "+" then cRecordingStopkey = "0123456789*#"
end    -- Any

	if type == "dtmf" then
		freeswitch.consoleLog("NOTICE", "Got recording input: ".. obj['digit']);
		freeswitch.consoleLog("NOTICE", "Stopkey            : ".. cRecordingStopkey);
		if (string.find(cRecordingStopkey, obj['digit'])~=nil) then   -- It
should only terminate when the key is in the list!
			return "break";
		end
	end
	
end
----------------------------------------------------



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list