[Freeswitch-users] Running a BASH script within a dialplan

Brian Foster bdfoster at endigotech.com
Fri Jan 20 06:20:18 MSK 2012


Solved.

Thanks SwK!

For anyone else who runs into this problem, you need to make sure that the
pwd is /usr/local/freeswitch/scripts if you plan on putting your script in
the scripts folder. to check this, open up fs_cli and do:

system /bin/pwd >/tmp/fs_pwd

...then go and look at /tmp/fs_pwd. That should tell you what you need to
know!

You can always run the script from somewhere else by doing:

system /path/to/script.sh arg1

-BDF

On Thu, Jan 19, 2012 at 9:50 PM, Brian Foster <bdfoster at endigotech.com>wrote:

> Hola,
>
> I'm trying to run a BASH script which turns sends a message to Google's
> Transcription API. It's a modified version of the example posted on the
> wiki. Here we go:
>
>
> !. #!/bin/sh
> 2. sox $1 message.flac pad .1 0 rate 16k
> 3. wget -q -U "Mozilla/5.0" --post-file message.flac
> --header="Content-Type: audio/x-flac; rate=16000" -O - "
> http://www.google.com/speech-api/v1/recognize?lang=en-us&client=chromium"
> > message.ret
> 4. echo "$(cat message.ret | sed 's/.*utterance":"//' | sed
> 's/","confidence.*//')"
> 5. rm message.flac
> 6. rm message.ret
> 7. # rm $1
>
> Before I stick that in a dialplan, I've been trying to run it within
> fs_cli to make sure it works. However, I get:
>
> -ERR no reply
>
> ...every time I run it. Is there some fundamental flaw that FreeSWITCH
> doesn't recognize as an output? I plan on putting together a few BASH
> scripts and a dialplan to basically do the same thing that Mundy has done
> with "Siriously".
>
> -BDF
> --
>
> This message contains confidential information and is intended for those
> listed in the "To:", "CC:", and/or "BCC:" fields of the message header.If
> you are not the intended recipient you are notified that disclosing,
> copying, distributing or taking any action in reliance on the contents of
> this information is strictly prohibited. E-mail transmission cannot be
> guaranteed to be secure or error-free as information could be intercepted,
> corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.
> The sender therefore does not accept liability for any errors or omissions
> in the contents of this message, which arise as a result of e-mail
> transmission. If verification is required please request a hard-copy
> version.
>
>


-- 
Brian D. Foster
Endigo Computer LLC
Email: bdfoster at endigotech.com
Phone: 317-429-1069
Indianapolis, Indiana, USA

This message contains confidential information and is intended for those
listed in the "To:", "CC:", and/or "BCC:" fields of the message header.If
you are not the intended recipient you are notified that disclosing,
copying, distributing or taking any action in reliance on the contents of
this information is strictly prohibited. E-mail transmission cannot be
guaranteed to be secure or error-free as information could be intercepted,
corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.
The sender therefore does not accept liability for any errors or omissions
in the contents of this message, which arise as a result of e-mail
transmission. If verification is required please request a hard-copy
version.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120119/0e57e6d3/attachment-0001.html 


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