<div dir="ltr">Given the example configuration, you can remove {profile=s3}http_cache:// from your playback URL.  Also, you can change the config / reload the module / and test using fs_cli http_get for rapid verification of your setup.<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 16, 2016 at 2:13 PM, Dave Horton <span dir="ltr">&lt;<a href="mailto:daveh@beachdognet.com" target="_blank">daveh@beachdognet.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I’m having trouble using http_cache to download and play a wave file from my amazon S3 bucket.<br>
I’m following the basic config at <a href="https://freeswitch.org/confluence/display/FREESWITCH/mod_http_cache" rel="noreferrer" target="_blank">https://freeswitch.org/confluence/display/FREESWITCH/mod_http_cache</a> but I must be missing something.<br>
<br>
My http_cache.conf.xml looks like this:<br>
<br>
———————————<br>
&lt;configuration name=&quot;http_cache.conf&quot; description=&quot;HTTP GET cache&quot;&gt;<br>
  &lt;settings&gt;<br>
    &lt;!-- set to true if you want to enable http:// and https:// formats.  Do not use if mod_httapi is also loaded --&gt;<br>
    &lt;param name=&quot;enable-file-formats&quot; value=&quot;true&quot;/&gt;<br>
    &lt;param name=&quot;max-urls&quot; value=&quot;10000&quot;/&gt;<br>
    &lt;param name=&quot;location&quot; value=&quot;$${cache_dir}&quot;/&gt;<br>
    &lt;param name=&quot;default-max-age&quot; value=&quot;86400&quot;/&gt;<br>
    &lt;param name=&quot;prefetch-thread-count&quot; value=&quot;8&quot;/&gt;<br>
    &lt;param name=&quot;prefetch-queue-size&quot; value=&quot;100&quot;/&gt;<br>
    &lt;!-- absolute path to CA bundle file --&gt;<br>
    &lt;param name=&quot;ssl-cacert&quot; value=&quot;$${certs_dir}/cacert.pem&quot;/&gt;<br>
    &lt;!-- verify certificates --&gt;<br>
    &lt;param name=&quot;ssl-verifypeer&quot; value=&quot;true&quot;/&gt;<br>
    &lt;!-- verify host name matches certificate --&gt;<br>
    &lt;param name=&quot;ssl-verifyhost&quot; value=&quot;true&quot;/&gt;<br>
    &lt;!-- default is 300 seconds, override here --&gt;<br>
    &lt;!--param name=&quot;connect-timeout&quot; value=&quot;300&quot;/--&gt;<br>
    &lt;!-- default is 300 seconds, override here --&gt;<br>
    &lt;!--param name=&quot;download-timeout&quot; value=&quot;300&quot;/--&gt;<br>
  &lt;/settings&gt;<br>
<br>
    &lt;profiles&gt;<br>
    &lt;!-- amazon s3 security credentials --&gt;<br>
    &lt;profile name=&quot;s3&quot;&gt;<br>
      &lt;aws-s3&gt;<br>
        &lt;!-- 20 character key identifier --&gt;<br>
        &lt;access-key-id&gt;&lt;![CDATA[my-access-key-here]]&gt;&lt;/access-key-id&gt;<br>
        &lt;!-- 40 character secret --&gt;<br>
        &lt;secret-access-key&gt;&lt;![CDATA[my-secret-access-key-here]]&gt;&lt;/secret-access-key&gt;<br>
      &lt;/aws-s3&gt;<br>
      &lt;!-- optional list of domains that this profile will automatically be applied to --&gt;<br>
      &lt;!-- if you wish to apply the s3 credentials to a domain not listed here, then use<br>
           {profile=s3}<a href="http://foo.s3." rel="noreferrer" target="_blank">http://foo.s3.</a>.. --&gt;<br>
      &lt;domains&gt;<br>
        &lt;domain name=“<a href="http://my-bucket.s3.amazonaws.com" rel="noreferrer" target="_blank">my-bucket.s3.amazonaws.com</a>&quot;/&gt;<br>
      &lt;/domains&gt;<br>
    &lt;/profile&gt;<br>
   &lt;/profiles&gt;<br>
&lt;/configuration&gt;<br>
—————————————<br>
<br>
My dialplan looks like this:<br>
<br>
——————————————<br>
   &lt;extension name=&quot;announcement&quot;&gt;<br>
      &lt;condition field=&quot;${sip_req_user}&quot; expression=&quot;^annc$&quot;/&gt;<br>
      &lt;condition field=&quot;${sip_req_params}&quot; expression=&quot;^play=(.*)$&quot;&gt;<br>
        &lt;action application=&quot;log&quot; data=“file to play: $1&quot;/&gt;<br>
        &lt;action application=&quot;answer&quot;/&gt;<br>
        &lt;action application=&quot;sleep&quot; data=&quot;1000&quot;/&gt;<br>
        &lt;action application=&quot;playback&quot; data=&quot;{profile=s3}http_cache://https://my-bucket.s3.amazonaws.com:/$1&quot;/&gt;<br>
        &lt;action application=&quot;hangup&quot;/&gt;<br>
      &lt;/condition&gt;<br>
   &lt;/extension&gt;<br>
_______________________<br>
<br>
The log file says this:<br>
<br>
   EXECUTE sofia/drachtio_mrf/<a href="mailto:5083084809@68.64.80.16">5083084809@68.64.80.16</a> playback({profile=s3}http_cache://http://wcs-icr.s3.amazonaws.com:/RBT-5762afa9991351886b295fbc/prompt/1466086249630-call-blocked.wav)<br>
   2016-06-16 14:02:59.173718 [DEBUG] mod_http_cache.c:569 Locked cache<br>
   2016-06-16 14:02:59.173718 [INFO] mod_http_cache.c:661 Cache MISS: size = 0 (0 MB), hit ratio = 0/1<br>
   2016-06-16 14:02:59.173718 [DEBUG] mod_http_cache.c:726 Adding http://wcs-icr.s3.amazonaws.com:/RBT-5762afa9991351886b295fbc/prompt/1466086249630-call-blocked.wav(/usr/local/freeswitch/cache/b6/456219-e1eb-43c2-bbd9-449cfb3af6ac.wav) to cache index 0<br>
   2016-06-16 14:02:59.173718 [DEBUG] mod_http_cache.c:580 Unlocked cache<br>
   2016-06-16 14:02:59.173718 [DEBUG] mod_http_cache.c:1077 opening /usr/local/freeswitch/cache/b6/456219-e1eb-43c2-bbd9-449cfb3af6ac.wav for URL cache<br>
   2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 HTTP/1.1 403 Forbidden<br>
   2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 x-amz-request-id: F27F3491740AC96E<br>
   2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 x-amz-id-2: 1LII609UCqdosrj+3tha2MrWfkoDjIgJ/wK2V47LDkgpn6/i8V4GFRxVzzoXRj9Rzbq6BMP15Po=<br>
   2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 Content-Type: application/xml<br>
   2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 Transfer-Encoding: chunked<br>
   2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 Date: Thu, 16 Jun 2016 18:02:58 GMT<br>
   2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 Server: AmazonS3<br>
   2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548<br>
   2016-06-16 14:02:59.233717 [ERR] mod_http_cache.c:1131 Received HTTP error 403 trying to fetch http://wcs-icr.s3.amazonaws.com:/RBT-5762afa9991351886b295fbc/prompt/1466086249630-call-blocked.wav<br>
   2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:569 Locked cache<br>
   2016-06-16 14:02:59.233717 [INFO] mod_http_cache.c:683 Failed to download URL http://wcs-icr.s3.amazonaws.com:/RBT-5762afa9991351886b295fbc/prompt/1466086249630-call-blocked.wav<br>
   2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:580 Unlocked cache<br>
   EXECUTE sofia/drachtio_mrf/<a href="mailto:5083084809@68.64.80.16">5083084809@68.64.80.16</a> hangup()<br>
<br>
<br>
————————<br>
<br>
I’ve fiddled with a bunch of different things, but no luck.  I took a tshark of the outgoing http get and I can see it is not putting in the headers to authenticate, so it seems it is not getting into<br>
the S3 code in http_cache.  The docs do not include a complete S3 working example, unfortunately.<br>
<br>
Any help or pointers from those who have gotten this working would be appreciated…<br>
<br>
Dave<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a></blockquote></div><br></div>