<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Well, from looking at the code, part of the problem is that there is an additional — undocumented — configuration parameter called ‘base-domain’ which is required for the AWS stuff to kick in….still trying to figure out how this works, by reading the code……anyone who has knowledge please chime in<div class=""><br class=""></div><div class=""><br class=""><div><div class="">On Jun 16, 2016, at 2:42 PM, Christopher Rienzo <<a href="mailto:cmrienzo@gmail.com" class="">cmrienzo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">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 class=""><br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jun 16, 2016 at 2:13 PM, Dave Horton <span dir="ltr" class=""><<a href="mailto:daveh@beachdognet.com" target="_blank" class="">daveh@beachdognet.com</a>></span> wrote:<br class=""><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 class="">
I’m following the basic config at <a href="https://freeswitch.org/confluence/display/FREESWITCH/mod_http_cache" rel="noreferrer" target="_blank" class="">https://freeswitch.org/confluence/display/FREESWITCH/mod_http_cache</a> but I must be missing something.<br class="">
<br class="">
My http_cache.conf.xml looks like this:<br class="">
<br class="">
———————————<br class="">
<configuration name="http_cache.conf" description="HTTP GET cache"><br class="">
<settings><br class="">
<!-- set to true if you want to enable http:// and https:// formats. Do not use if mod_httapi is also loaded --><br class="">
<param name="enable-file-formats" value="true"/><br class="">
<param name="max-urls" value="10000"/><br class="">
<param name="location" value="$${cache_dir}"/><br class="">
<param name="default-max-age" value="86400"/><br class="">
<param name="prefetch-thread-count" value="8"/><br class="">
<param name="prefetch-queue-size" value="100"/><br class="">
<!-- absolute path to CA bundle file --><br class="">
<param name="ssl-cacert" value="$${certs_dir}/cacert.pem"/><br class="">
<!-- verify certificates --><br class="">
<param name="ssl-verifypeer" value="true"/><br class="">
<!-- verify host name matches certificate --><br class="">
<param name="ssl-verifyhost" value="true"/><br class="">
<!-- default is 300 seconds, override here --><br class="">
<!--param name="connect-timeout" value="300"/--><br class="">
<!-- default is 300 seconds, override here --><br class="">
<!--param name="download-timeout" value="300"/--><br class="">
</settings><br class="">
<br class="">
<profiles><br class="">
<!-- amazon s3 security credentials --><br class="">
<profile name="s3"><br class="">
<aws-s3><br class="">
<!-- 20 character key identifier --><br class="">
<access-key-id><![CDATA[my-access-key-here]]></access-key-id><br class="">
<!-- 40 character secret --><br class="">
<secret-access-key><![CDATA[my-secret-access-key-here]]></secret-access-key><br class="">
</aws-s3><br class="">
<!-- optional list of domains that this profile will automatically be applied to --><br class="">
<!-- if you wish to apply the s3 credentials to a domain not listed here, then use<br class="">
{profile=s3}<a href="http://foo.s3./" rel="noreferrer" target="_blank" class="">http://foo.s3.</a>.. --><br class="">
<domains><br class="">
<domain name=“<a href="http://my-bucket.s3.amazonaws.com/" rel="noreferrer" target="_blank" class="">my-bucket.s3.amazonaws.com</a>"/><br class="">
</domains><br class="">
</profile><br class="">
</profiles><br class="">
</configuration><br class="">
—————————————<br class="">
<br class="">
My dialplan looks like this:<br class="">
<br class="">
——————————————<br class="">
<extension name="announcement"><br class="">
<condition field="${sip_req_user}" expression="^annc$"/><br class="">
<condition field="${sip_req_params}" expression="^play=(.*)$"><br class="">
<action application="log" data=“file to play: $1"/><br class="">
<action application="answer"/><br class="">
<action application="sleep" data="1000"/><br class="">
<action application="playback" data="{profile=s3}http_cache://<a href="https://my-bucket.s3.amazonaws.com:/$1" class="">https://my-bucket.s3.amazonaws.com:/$1</a>"/><br class="">
<action application="hangup"/><br class="">
</condition><br class="">
</extension><br class="">
_______________________<br class="">
<br class="">
The log file says this:<br class="">
<br class="">
EXECUTE sofia/drachtio_mrf/<a href="mailto:5083084809@68.64.80.16" class="">5083084809@68.64.80.16</a> playback({profile=s3}http_cache://<a href="http://wcs-icr.s3.amazonaws.com:/RBT-5762afa9991351886b295fbc/prompt/1466086249630-call-blocked.wav" class="">http://wcs-icr.s3.amazonaws.com:/RBT-5762afa9991351886b295fbc/prompt/1466086249630-call-blocked.wav</a>)<br class="">
2016-06-16 14:02:59.173718 [DEBUG] mod_http_cache.c:569 Locked cache<br class="">
2016-06-16 14:02:59.173718 [INFO] mod_http_cache.c:661 Cache MISS: size = 0 (0 MB), hit ratio = 0/1<br class="">
2016-06-16 14:02:59.173718 [DEBUG] mod_http_cache.c:726 Adding <a href="http://wcs-icr.s3.amazonaws.com:/RBT-5762afa9991351886b295fbc/prompt/1466086249630-call-blocked.wav(/usr/local/freeswitch/cache/b6/456219-e1eb-43c2-bbd9-449cfb3af6ac.wav)" class="">http://wcs-icr.s3.amazonaws.com:/RBT-5762afa9991351886b295fbc/prompt/1466086249630-call-blocked.wav(/usr/local/freeswitch/cache/b6/456219-e1eb-43c2-bbd9-449cfb3af6ac.wav)</a> to cache index 0<br class="">
2016-06-16 14:02:59.173718 [DEBUG] mod_http_cache.c:580 Unlocked cache<br class="">
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 class="">
2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 HTTP/1.1 403 Forbidden<br class="">
2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 x-amz-request-id: F27F3491740AC96E<br class="">
2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 x-amz-id-2: 1LII609UCqdosrj+3tha2MrWfkoDjIgJ/wK2V47LDkgpn6/i8V4GFRxVzzoXRj9Rzbq6BMP15Po=<br class="">
2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 Content-Type: application/xml<br class="">
2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 Transfer-Encoding: chunked<br class="">
2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 Date: Thu, 16 Jun 2016 18:02:58 GMT<br class="">
2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548 Server: AmazonS3<br class="">
2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:548<br class="">
2016-06-16 14:02:59.233717 [ERR] mod_http_cache.c:1131 Received HTTP error 403 trying to fetch <a href="http://wcs-icr.s3.amazonaws.com:/RBT-5762afa9991351886b295fbc/prompt/1466086249630-call-blocked.wav" class="">http://wcs-icr.s3.amazonaws.com:/RBT-5762afa9991351886b295fbc/prompt/1466086249630-call-blocked.wav</a><br class="">
2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:569 Locked cache<br class="">
2016-06-16 14:02:59.233717 [INFO] mod_http_cache.c:683 Failed to download URL <a href="http://wcs-icr.s3.amazonaws.com:/RBT-5762afa9991351886b295fbc/prompt/1466086249630-call-blocked.wav" class="">http://wcs-icr.s3.amazonaws.com:/RBT-5762afa9991351886b295fbc/prompt/1466086249630-call-blocked.wav</a><br class="">
2016-06-16 14:02:59.233717 [DEBUG] mod_http_cache.c:580 Unlocked cache<br class="">
EXECUTE sofia/drachtio_mrf/<a href="mailto:5083084809@68.64.80.16" class="">5083084809@68.64.80.16</a> hangup()<br class="">
<br class="">
<br class="">
————————<br class="">
<br class="">
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 class="">
the S3 code in http_cache. The docs do not include a complete S3 working example, unfortunately.<br class="">
<br class="">
Any help or pointers from those who have gotten this working would be appreciated…<br class="">
<br class="">
Dave<br class="">
_________________________________________________________________________<br class="">
Professional FreeSWITCH Consulting Services:<br class="">
<a href="mailto:consulting@freeswitch.org" class="">consulting@freeswitch.org</a><br class="">
<a href="http://www.freeswitchsolutions.com/" rel="noreferrer" target="_blank" class="">http://www.freeswitchsolutions.com</a><br class="">
<br class="">
Official FreeSWITCH Sites<br class="">
<a href="http://www.freeswitch.org/" rel="noreferrer" target="_blank" class="">http://www.freeswitch.org</a><br class="">
<a href="http://confluence.freeswitch.org/" rel="noreferrer" target="_blank" class="">http://confluence.freeswitch.org</a><br class="">
<a href="http://www.cluecon.com/" rel="noreferrer" target="_blank" class="">http://www.cluecon.com</a><br class="">
<br class="">
FreeSWITCH-users mailing list<br class="">
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" class="">FreeSWITCH-users@lists.freeswitch.org</a><br class="">
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank" class="">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br class="">
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank" class="">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br class="">
<a href="http://www.freeswitch.org/" rel="noreferrer" target="_blank" class="">http://www.freeswitch.org</a></blockquote></div><br class=""></div>
_________________________________________________________________________<br class="">Professional FreeSWITCH Consulting Services: <br class=""><a href="mailto:consulting@freeswitch.org" class="">consulting@freeswitch.org</a><br class="">http://www.freeswitchsolutions.com<br class=""><br class="">Official FreeSWITCH Sites<br class="">http://www.freeswitch.org<br class="">http://confluence.freeswitch.org<br class="">http://www.cluecon.com<br class=""><br class="">FreeSWITCH-users mailing list<br class="">FreeSWITCH-users@lists.freeswitch.org<br class="">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br class="">UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br class="">http://www.freeswitch.org</div></div><br class=""></div></body></html>