[Freeswitch-users] say phrase into recordFile using lua script

Jesse Cloutier jesse at cronomagic.com
Tue Apr 27 11:04:01 PDT 2010


Hello, I am having trouble with a lua script that i am trying to put 
together.

The script basically makes a recording using the "session:recordFile()" 
function, and is terminated by a callback function that returns "break" 
on dtmf "#"

What I would like to do is have the system say the date and time ( 
session:say() ) into the recording at the end of the recording. It 
should be triggered by
the call back.

When I try it out it works great, I hear the system say the date / time, 
except that it is never recorded into the recording.

I have been searching the docs for something that might clear up why its 
not recording but I can't find anything. I thought maybe doing a 
uuid_broadcast would fix the problem
but there is no builtin function for that in the lua api and I was not 
able to make it work using the "session:execute" function either.

Any help would be really appreaciated!

This is the relavent code, for testing purposes I am having the date 
spoken using an alternative digit, you can also see my attempt to do a 
uuid_broadcast and sched_broadcast commented out:

######################
--call back function
function onInputRecord(s, type, obj) -- function to end recording

   if (type == "dtmf") then
       if ( obj['digit'] == '1') then
       curDate = os.date();
         session:say(curDate, "en", "CURRENT_DATE_TIME", "pronounced");

         --uuidBroadcast = " say::en CURRENT_DATE_TIME pronounced " .. 
os.date() .. " both";
         --session:execute("uuid_broadcast ".. UUID, uuidBroadcast);
         --session:execute("sched_broadcast", "data=\"+1 
/usr/local/freeswitch/sounds/en/us/callie/ivr/8000/ivr-hello.wav both\"");

         return true;
       elseif ( obj['digit'] == '#' ) then
         return "break";
       end
   end
end

session:setInputCallback("onInputRecord", "");
RECORD_PATH = /parth/to/file
session:recordFile(RECORD_PATH, 30000, 10, 10); -- pressing # ends the 
recording
####################

Thanks alot!

JC



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100427/47c0cfde/attachment-0001.html 


More information about the FreeSWITCH-users mailing list