[Freeswitch-users] Running sox from within lua

Areski areski at gmail.com
Tue Feb 19 19:51:20 MSK 2013


Here an example of how I execute sox from lua, to get the recording length :
https://github.com/Star2Billing/newfies-dialer/blob/master/lua/libs/texttospeech.lua#L113

You might need something like this :

function simple_command(command)
    --
    local file = assert(io.popen(command, 'r'))
    local output = file:read('*all')
    file:close()
    return output
end

res = simple_command(string.format([[sox --norm %s %s.new]],
file_to_normalise, file_to_normalise))


On Tue, Feb 19, 2013 at 5:21 PM, Alex Lake <alex at digitalmail.com> wrote:
> Having a spot of bother with this bit of lua:
>
> result = os.execute(string.format([[sox --norm %s %s.new]],
> file_to_normalise, file_to_normalise))
>
> It's returning -1. I believe freeswitch is running as root and that the
> sox file is in that location and is runnable.
>
> Any ideas?
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> 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



-- 
Kind regards,
/Areski

----
Arezqui Belaid,
areski at gmail.com / +34650784355

Founder at Star2Billing (www.star2billing.com)
Author @ A2Billing (www.a2billing.net), @ Newfies-Dialer
(www.newfies-dialer.org), @ CDR-Stats (www.cdr-stats.org)
----
Twitter : http://twitter.com/areskib / LinkedIN :
http://www.linkedin.com/in/areski



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