[Freeswitch-users] curl.run data field post file

Daniel Knoll daniel at danielknoll.de
Wed Jul 6 15:36:47 MSD 2011


Hi Group,

I figured the right syntax of curl.run out. and now I have a question.
How can I post the Content of a File into the "data" Field of curl.run()
If i set the Option to "@/tmp/filename.flac" or
"filename=@/tmp/filename.flac" the Content-Length is allways the
number of the Characters in the "data" Field.

my code line is:

curl.run("POST",
"http://www.google.com/speech-api/v1/recognize?xjerr=1&client=chromium&lang=de-DEc",
"filename=@/tmp/90.flac", my_callback, "my arg\n","","","audio/x-flac;
rate=16000");

The sniffing of HTTP Traffic look like this:


interface: eth0 (xxx.xxx.xxx.xxx/255.255.255.192)
filter: (ip or ip6) and ( port 80 )
####
T xxx.xxx.xxx.xxx:45159 -> 209.85.149.105:80 [AP]
  POST /speech-api/v1/recognize?xjerr=1&client=chromium&lang=de-DEc
HTTP/1.1..User-Agent:
   freeswitch-spidermonkey-curl/1.0..Host: www.google.com..Accept:
*/*..Content-Type: aud
  io/x-flac; rate=16000..Content-Length: 22....filename=@/tmp/90.flac
##
T 209.85.149.105:80 -> xxx.xxx.xxx.xxx:45159 [AP]
  HTTP/1.1 200 OK..Content-Type: application/json;
charset=utf-8..Content-Disposition: at
  tachment..Date: Wed, 06 Jul 2011 11:23:35 GMT..Expires: Wed, 06 Jul
2011 11:23:35 GMT..
  Cache-Control: private, max-age=0..X-Content-Type-Options:
nosniff..X-Frame-Options: SA
  MEORIGIN..X-XSS-Protection: 1; mode=block..Server:
GSE..Transfer-Encoding: chunked....4
  7..{"status":5,"id":"ec8d60cb80800296297afe166dee826c-1","hypotheses":[]}...0....
####exit
11 received, 0 dropped



any ideas?

Thanks for helping me.
Daniel



More information about the FreeSWITCH-users mailing list