Hi there, I'm trying to make a playback of streamed sound data coming from a database. I could make the example included in documentation work (cat file.wav | sox -t wav - $@ -t raw -). However, I can't make it work with same sox options after having uploaded that same file into my PGSQL database and select it instead of a cat command. My shell script is #!/bin/bash psql -h <HOST> -U postgres -E -t -q -d <DATABASE> -c "select <BINARY COLUM DATA> from <TABLE> " | sox -t wav - $@ -t raw - Freeswitch gives me a "sox FAIL formats: can't open input `-': WAVE: RIFF header not found" error message. Has anybody streamed data from database into Freeswitch? Thank you. Bernard
I think you might need a script to strip the column header ? psql -c "select 1" |cat ?column? ---------- 1 (1 row) -- About: http://about.me/dujinfang Blog: http://www.dujinfang.com Proj: http://www.freeswitch.org.cn Sent with Sparrow (http://www.sparrowmailapp.com) On Saturday, March 3, 2012 at 10:17 PM, Bernard Fluixa wrote:
Hi there,
I'm trying to make a playback of streamed sound data coming from a database. I could make the example included in documentation work (cat file.wav | sox -t wav - $@ -t raw -). However, I can't make it work with same sox options after having uploaded that same file into my PGSQL database and select it instead of a cat command.
My shell script is
#!/bin/bash
psql -h <HOST> -U postgres -E -t -q -d <DATABASE> -c "select <BINARY COLUM DATA> from <TABLE> " | sox -t wav - $@ -t raw -
Freeswitch gives me a "sox FAIL formats: can't open input `-': WAVE: RIFF header not found" error message.
Has anybody streamed data from database into Freeswitch?
Thank you.
Bernard
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org (mailto:consulting@freeswitch.org) http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org (mailto:FreeSWITCH-users@lists.freeswitch.org) http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
That is already done with the -t option (tuples only) Thanks anyway Bernard On Mar 4, 2012, at 1:12 AM, Seven Du wrote:
I think you might need a script to strip the column header ?
psql -c "select 1" |cat ?column? ---------- 1 (1 row)
-- About: http://about.me/dujinfang Blog: http://www.dujinfang.com Proj: http://www.freeswitch.org.cn
Sent with Sparrow
On Saturday, March 3, 2012 at 10:17 PM, Bernard Fluixa wrote:
Hi there,
I'm trying to make a playback of streamed sound data coming from a database. I could make the example included in documentation work (cat file.wav | sox -t wav - $@ -t raw -). However, I can't make it work with same sox options after having uploaded that same file into my PGSQL database and select it instead of a cat command.
My shell script is
#!/bin/bash
psql -h <HOST> -U postgres -E -t -q -d <DATABASE> -c "select <BINARY COLUM DATA> from <TABLE> " | sox -t wav - $@ -t raw -
Freeswitch gives me a "sox FAIL formats: can't open input `-': WAVE: RIFF header not found" error message.
Has anybody streamed data from database into Freeswitch?
Thank you.
Bernard
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
On Sun, Mar 4, 2012 at 4:30 AM, Bernard Fluixa <fluixab@bellsouth.net>wrote:
That is already done with the -t option (tuples only)
Thanks anyway
Bernard
Does your script work if you do it in two steps, i.e. read from the database and drop into a file, then cat the file into sox? I'm just curious if something unexpected is happening on the command line when piping from psql to sox. -MC
Michael, Thanks for your reply. Yes it works in this case. Any thoughts? Bernard ________________________________ From: Michael Collins <msc@freeswitch.org> To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> Sent: Mon, March 5, 2012 10:18:44 PM Subject: Re: [Freeswitch-users] mod shell stream On Sun, Mar 4, 2012 at 4:30 AM, Bernard Fluixa <fluixab@bellsouth.net> wrote: That is already done with the -t option (tuples only)
Thanks anyway
Bernard
Does your script work if you do it in two steps, i.e. read from the database and drop into a file, then cat the file into sox? I'm just curious if something unexpected is happening on the command line when piping from psql to sox. -MC
I'm afraid I'll have to defer to those more knowledgeable than I in such matters. Any sox and/or cmd line gurus out there with some ideas? -MC On Thu, Mar 8, 2012 at 7:24 AM, Bernard Fluixa <fluixab@bellsouth.net>wrote:
Michael,
Thanks for your reply. Yes it works in this case.
Any thoughts?
Bernard
------------------------------ *From:* Michael Collins <msc@freeswitch.org> *To:* FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org> *Sent:* Mon, March 5, 2012 10:18:44 PM *Subject:* Re: [Freeswitch-users] mod shell stream
On Sun, Mar 4, 2012 at 4:30 AM, Bernard Fluixa <fluixab@bellsouth.net>wrote:
That is already done with the -t option (tuples only)
Thanks anyway
Bernard
Does your script work if you do it in two steps, i.e. read from the database and drop into a file, then cat the file into sox? I'm just curious if something unexpected is happening on the command line when piping from psql to sox.
-MC
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
FreeSWITCH-powered IP PBX: The CudaTel Communication Server http://www.cudatel.com
Official FreeSWITCH Sites http://www.freeswitch.org http://wiki.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (3)
-
Bernard Fluixa
-
Michael Collins
-
Seven Du