From Idiotic Guinea Pig, 7 Years ago, written in Plain Text.
- go back
Embed
Viewing differences between and Untitled
  1. local function record_session()
  2.     recording_dir = '/tmp/'
  3.     filename = freeswitch_call_uuid .. '.wav'
  4.     recording_filename = string.format('%s%s', recording_dir, filename)
  5.     recording_filename_str = string.format('%s%s', recording_dir, filename)
  6.     if session:ready() then
  7.                 session:setInputCallback('onInputCBF', '')
  8.                 max_len_secs = 240
  9.                 silence_threshold = 500
  10.                 silence_secs = 3
  11.                 recording_file = session:recordFile(recording_filename, max_len_secs, silence_threshold, silence_secs);
  12.                 recording_ended = os.time()
  13.       currently_recording_session = false
  14.   end
  15. end
  16.  
  17. function onInputCBF(s, _type, obj, arg)
  18.     local k, v = nil, nil
  19.     local _debug = true
  20.     if _debug then
  21.         for k, v in pairs(obj) do
  22.             printSessionFunctions(obj)
  23.             print(string.format('obj k-> %s v->%s\n', tostring(k), tostring(v)))
  24.         end
  25.         if _type == 'table' then
  26.             for k, v in pairs(_type) do
  27.                 print(string.format('_type k-> %s v->%s\n', tostring(k), tostring(v)))
  28.             end
  29.         end
  30.         print(string.format('\n(%s == dtmf) and (obj.digit [%s])\n', _type, obj.digit))
  31.     end
  32.     if (_type == "dtmf") then
  33.         return 'break'
  34.     else
  35.         return ''
  36.     end
  37. end
  38.  
  39. Dial string is :         <action application="bridge" data="{record_waste_resources=true,ignore_early_media=true}sofia/external/${fwdno}"/>
  40.