[Freeswitch-users] long DTMF

Tihomir Culjaga tculjaga at gmail.com
Tue Aug 24 11:16:36 PDT 2010


It shouldn't be hard to do with a small lua script with an input
> callback handling DTMFs.
>
> You could even create a small DTMF editor with a digit for "backspace"
> character for example, that would erase the last digit, or a digit that
> would say the current sequence....
>
> Check out:
> http://wiki.freeswitch.org/wiki/Lua#session:setInputCallback
>
> François.
>
>
Nice!

 i wrote a small script:


function onInput(s, type, obj)
   if (type == "dtmf") then
      freeswitch.consoleLog("info", "DTMF Digit: " .. obj.digit .. "\n");
      freeswitch.consoleLog("info", "DTMF Duration: " .. obj.duration ..
"\n");
      if (obj.duration > 2000) then
        freeswitch.consoleLog("info", "we got long DTMF \n");
      end
   end
end


session:answer();
session:setInputCallback("onInput");
session:sleep(200);

while (session:ready() == true) do
   session:sleep(100);
end




i run it in dialplan as:


<include>
  <extension name="longPound">
    <condition field="destination_number" expression="^pound$">
      <action application="lua" data="Pound.lua"/>

      <action application="playback" data="bla1"/>
      <action application="playback" data="bla2"/>
      <action application="playback" data="bla3"/>


      <!-- <action application="sleep" data="10000"/> -->
    </condition>
  </extension>
</include>



but it seems the lua scripts is blocking .... i never get to playback part.
I need to make it run in background for the entire duration of the session

how can i do it?

T.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100824/0ca10085/attachment.html 


More information about the FreeSWITCH-users mailing list