[Freeswitch-users] using keypress to stop a recording.

Wes wes-fs at 499x.com
Fri Jun 17 01:29:37 MSD 2011


I'm writing a lua script, that link you mention doesn't seem like 
something I can do in LUA...

the problem is in this function:

function onInput(s, type, obj)
   if (type == "dtmf" and obj['digit'] == '#') then
       return "break";
   end
end

which seems to break on any keypress, so the check for # doesn't work as 
expected.

is there a different way to do this with a lua script?  Ideally, I'd 
like to do more than just break, I'd like the user to be able to review 
the message more than once, and then finally hit another key to submit 
it for real.  Like a voicemail system, actually.

On 6/16/2011 3:55 PM, Michael Collins wrote:
> How about setting this only to #?
> http://wiki.freeswitch.org/wiki/Channel_Variables#playback_terminators
>
> -MC
>
> On Thu, Jun 16, 2011 at 11:54 AM, Wes <wes-fs at 499x.com 
> <mailto:wes-fs at 499x.com>> wrote:
>
>     I'm using the following script to record, and I"m hoping to take a
>     user
>     keypress to trigger the end of the recording and then play it back:
>
>     (the problem is that it stops on ANY keypress, while it seems like it
>     should only break on a "#" keypress)
>
>     I found this example at:
>     http://wiki.freeswitch.org/wiki/Mod_lua#session:recordFile
>
>     local numberToCall = 1234
>     local session =
>     freeswitch.Session("sofia/xxx.xxx.xxx.xxx/"..numberToCall);
>     session:set_tts_parms("flite", "kal");
>     session:speak("Thank you for using my recording service, press the
>     pound
>     key to stop the recording."  );
>
>     function onInput(s, type, obj)
>       if (type == "dtmf" and obj['digit'] == '#') then
>           return "break";
>       end
>     end
>
>     session:setInputCallback("onInput", "");
>     session:recordFile("/tmp/luatest.wav");
>     freeswitch.consoleLog("info", "recording stopped by user keypress
>     \n");
>     session:speak("your voicehas been recorded, i will play it for you
>     now");
>     session:streamFile("/tmp/luatest.wav");
>     session:speak("that's it, goodbye.");
>     freeswitch.consoleLog("info", "hanging up... \n");
>     session:hangup();
>
>
>     _______________________________________________
>     FreeSWITCH-users mailing list
>     FreeSWITCH-users at lists.freeswitch.org
>     <mailto: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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20110616/d915f35a/attachment-0001.html 


More information about the FreeSWITCH-users mailing list