<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"><<a href="mailto:daveh@beachdognet.com" target="_blank">daveh@beachdognet.com</a>></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>
<configuration name="http_cache.conf" description="HTTP GET cache"><br>
<settings><br>
<!-- set to true if you want to enable http:// and https:// formats. Do not use if mod_httapi is also loaded --><br>
<param name="enable-file-formats" value="true"/><br>
<param name="max-urls" value="10000"/><br>
<param name="location" value="$${cache_dir}"/><br>
<param name="default-max-age" value="86400"/><br>
<param name="prefetch-thread-count" value="8"/><br>
<param name="prefetch-queue-size" value="100"/><br>
<!-- absolute path to CA bundle file --><br>
<param name="ssl-cacert" value="$${certs_dir}/cacert.pem"/><br>
<!-- verify certificates --><br>
<param name="ssl-verifypeer" value="true"/><br>
<!-- verify host name matches certificate --><br>
<param name="ssl-verifyhost" value="true"/><br>
<!-- default is 300 seconds, override here --><br>
<!--param name="connect-timeout" value="300"/--><br>
<!-- default is 300 seconds, override here --><br>
<!--param name="download-timeout" value="300"/--><br>
</settings><br>
<br>
<profiles><br>
<!-- amazon s3 security credentials --><br>
<profile name="s3"><br>
<aws-s3><br>
<!-- 20 character key identifier --><br>
<access-key-id><![CDATA[my-access-key-here]]></access-key-id><br>
<!-- 40 character secret --><br>
<secret-access-key><![CDATA[my-secret-access-key-here]]></secret-access-key><br>
</aws-s3><br>
<!-- optional list of domains that this profile will automatically be applied to --><br>
<!-- 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>.. --><br>
<domains><br>
<domain name=“<a href="http://my-bucket.s3.amazonaws.com" rel="noreferrer" target="_blank">my-bucket.s3.amazonaws.com</a>"/><br>
</domains><br>
</profile><br>
</profiles><br>
</configuration><br>
—————————————<br>
<br>
My dialplan looks like this:<br>
<br>
——————————————<br>
<extension name="announcement"><br>
<condition field="${sip_req_user}" expression="^annc$"/><br>
<condition field="${sip_req_params}" expression="^play=(.*)$"><br>
<action application="log" data=“file to play: $1"/><br>
<action application="answer"/><br>
<action application="sleep" data="1000"/><br>
<action application="playback" data="{profile=s3}http_cache://https://my-bucket.s3.amazonaws.com:/$1"/><br>
<action application="hangup"/><br>
</condition><br>
</extension><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>