title: How to use IBM Blumix Watson Speech to Text as speech engine on Asterisk
body: <p>I followed the link below:
  <a href="http://zaf.github.io/asterisk-speech-recog/" rel="nofollow noreferrer">http://zaf.github.io/asterisk-speech-recog/</a></p>
  
  <p>Now I want to use IBM Blumix Watson Speech to Text instead of google speech-recog.
  Can anyone help me with this using the code provided on the link.</p>
  
  <p>It is working  using the google speech engine. but I want to use IBM Bluemix.</p>
  
  <pre><code> #!/usr/bin/perl
  
  use strict;
  use warnings;
  
  require LWP::UserAgent;
  use WWW::Curl::Easy;
  
  my $url = 'https://stream.watsonplatform.net/speech-to-text/api';
  
  my $ua;
  my $fh;
  my $audio;
  my $response;
  my $headers;
  my $username = 'username';
  my $password = 'password';
  
  local $ENV{'HTTPS_DEBUG'} = 1;
  open($fh, "&lt;", "test.flac") or die "Can't read file: $!";
  $audio = do { local $/; &lt;$fh&gt; };
  close($fh);
  
  $ua = LWP::UserAgent-&gt;new;
  
  $response = $ua-&gt;post($url, Content_Type =&gt; "audio/flac",Transfer_Encoding =&gt; "chunked", Content =&gt; $audio);
  $response-&gt;authorization_basic($username, $password);
  my $cont = $response-&gt;content;
  print $cont;
  </code></pre>
  
  <p>Then it gave me output </p>
  
  <pre><code>SSL_connect:before/connect initialization
  SSL_connect:SSLv2/v3 write client hello A
  SSL_connect:SSLv3 read server hello A
  SSL_connect:SSLv3 read server certificate A
  SSL_connect:SSLv3 read server done A
  SSL_connect:SSLv3 write client key exchange A
  SSL_connect:SSLv3 write change cipher spec A
  SSL_connect:SSLv3 write finished A
  SSL_connect:SSLv3 flush data
  SSL_connect:SSLv3 read finished A
  500 write failed:
  </code></pre>