[Freeswitch-users] say phrase into recordFile using lua script
Michael Collins
msc at freeswitch.org
Wed Apr 28 15:02:39 PDT 2010
On Tue, Apr 27, 2010 at 11:04 AM, Jesse Cloutier <jesse at cronomagic.com>wrote:
> 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\"");
>
uuid_broadcast and sched_broadcast are not dialplan apps that you execute,
they are API commands. You need an API object. Try this:
http://wiki.freeswitch.org/wiki/Lua#For_making_API_calls
Try it out and let us know what happens.
-MC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100428/e6c0f7a3/attachment.html
More information about the FreeSWITCH-users
mailing list