[Freeswitch-users] Seeking in recordFIle

Brian West brian at freeswitch.org
Wed Sep 10 07:06:24 PDT 2008


You can use the inputCallback for this.

Example values you can return during that event callback to influence  
the playback:


pause
stop
speed:[-|+]1 (example speed:+2)
restart
seek:[-|+]samples  (example seek:+4000)

Here is an example in lua:

function all_done(s, how)
    --os.exit();
    --ex();
    io.write("done: " .. how .. "\n");

end

function my_cb(s, type, obj, arg)
    if (arg) then
       io.write("type: " .. type .. "\n" .. "arg: " .. arg .. "\n");
    else
       io.write("type: " .. type .. "\n");
    end

    if (type == "dtmf") then
       io.write("digit: [" .. obj['digit'] .. "]\nduration: [" ..  
obj['duration'] .. "]\n");

       if (obj['digit'] == "1") then
          return "pause";
       end

       if (obj['digit'] == "2") then
          return "seek:+3000";
       end

       if (obj['digit'] == "3") then
          return "seek:-3000";
       end

       if (obj['digit'] == "4") then
          return "seek:+3000";
       end

       if (obj['digit'] == "5") then
          return "speed:+1";
       end
       if (obj['digit'] == "6") then
          return "speed:0";
       end
       if (obj['digit'] == "7") then
          return "speed:-1";
       end

       if (obj['digit'] == "8") then
          return "stop";
       end

       if (obj['digit'] == "9") then
          return "break";
       end
    else
       io.write(obj:serialize("xml"));

	end
end


blah = "args";
session:setHangupHook("all_done");
session:setInputCallback("my_cb", "blah");
session:streamFile("/tmp/swimp.raw");



If you wish to stop playback or a recording and move on you just  
return "break" in the inputcallback.

/b




On Sep 10, 2008, at 8:40 AM, Robert Clayton wrote:

> All,
>
> Where streamFile allows you to seek forward and backward by samples.
> Is there anyway to seek backward and play a file to a user allowing  
> the user to pause and continue recording (I assume with recordFile)  
> a file at an intermediate point (not insert).
>
> Bob
> _______________________________________________
> 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

Brian West
sip:brian at freeswitch.org










More information about the FreeSWITCH-users mailing list