[Freeswitch-users] Return raw file.

Mimiko vbvbrj at gmail.com
Sun Jun 30 13:24:42 MSD 2013


Hello.

I want to use mod_xml_rpc, or something else to return raw audio files 
which a recorded on file system using lua script to verify credentials 
and select file. For now I enable mod_xml_rpc and created a simple lua 
script:

local f=assert(io.open("/path/file.mp3","rb"))
io.write( f:read("*all"))
f:close()

Using http://freeswitch:ip:8080/api/luarun?script.lua
gives "+OK", but not the file content.
Using http://freeswitch:ip:8080/api/lua?script.lua
gives error. Instead I change:

local f=assert(io.open("/path/file.mp3","rb"))
stream:write( f:read("*all"))
f:close()

gives nothing thru mod_xml_rpc, but on console outputs the content of 
the file if file is text. If file is mp3, the output is just some rando 
three characters.

How to get the whole content fro an audio file using lua and some access 
method?

-- 
Mimiko desu.



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list