0

我正在尝试将我的录音存储在 s3 上。

这是我的 rayo.conf.xml:

<configuration name="rayo.conf">
  <settings>
    <param name="max-idle-sec" value="300"/>
  </settings>
  <domain name="localhost" shared-secret="itsasecret">
    <listen type="c2s" port="5222" address="0.0.0.0" acl=""/>
    <users><user name="adhearsion" password="foo"/></users>
  </domain>

  <record>
    <param name="record-file-prefix" value="{profile=s3}http://bucket.domain.com.s3.amazonaws.com/records/"/>
  </record>

</configuration>

这是我的 http_cache.conf.xml

<configuration name="http_cache.conf" description="HTTP GET cache">
  <settings>
    <!-- set to true if you want to enable http:// and https:// formats.  Do not use if mod_httapi is also loaded -->
    <param name="enable-file-formats" value="true"/>
    <param name="max-urls" value="10000"/>
    <param name="location" value="$${base_dir}/http_cache"/>
    <param name="default-max-age" value="86400"/>
    <param name="prefetch-thread-count" value="8"/>
    <param name="prefetch-queue-size" value="100"/>
    <!-- absolute path to CA bundle file -->
    <param name="ssl-cacert" value="$${base_dir}/conf/cacert.pem"/>
    <!-- verify certificates -->
    <param name="ssl-verifypeer" value="true"/>
    <!-- verify host name matches certificate -->
    <param name="ssl-verifyhost" value="true"/>
  </settings>
<profiles>
    <profile name='s3'>
        <aws-s3>
            <access-key-id>
                <![CDATA[AWS_KEY_ID]]>
            </access-key-id>
            <secret-access-key>
                <![CDATA[AWS_KEY_SECRET]]>
            </secret-access-key>
        </aws-s3>
        <domains>
          <domain name='bucket.domain.com.s3.amazonaws.com' />
        </domains>
    </profile>
</profiles>
</configuration>

这是调试日志:

2014-08-10 01:03:19.405172 [ERR] mod_http_cache.c:351 Received HTTP error 403 trying to save /usr/http_cache/64/6ee5dd-bb6d-49a4-96cc-34bd54ab9827.wav to http://bucket.domain.com.s3.amazonaws.com/records/b5ffe577-c8c1-48c5-847e-a330ddc7b6b9-2.wav

2014-08-10 01:03:19.405172 [ERR] mod_http_cache.c:351 Received HTTP error 403 trying to save /usr/http_cache/64/6ee5dd-bb6d-49a4-96cc-34bd54ab9827.wav to http://bucket.domain.com.s3.amazonaws.com/records/b5ffe577-c8c1-48c5-847e-a330ddc7b6b9-2.wav
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Content-Type] = [log/data]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Content-Length] = [116]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Level] = [5]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Text-Channel] = [3]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-File] = [switch_core_session.c]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Func] = [switch_core_session_thread]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [Log-Line] = [1632]
[DEBUG] esl.c:1316 esl_recv_event() RECV HEADER [User-Data] = [b5ffe577-c8c1-48c5-847e-a330ddc7b6b9]
[DEBUG] esl.c:1480 esl_recv_event() RECV MESSAGE
Event-Name: SOCKET_DATA
Content-Type: log/data
Content-Length: 116
Log-Level: 5
Text-Channel: 3
Log-File: switch_core_session.c
Log-Func: switch_core_session_thread
Log-Line: 1632
User-Data: b5ffe577-c8c1-48c5-847e-a330ddc7b6b9
Content-Length: 116

2014-08-10 01:03:19.425141 [NOTICE] switch_core_session.c:1632 Session 2 (sofia/internal/1001@192.168.59.103) Ended

我试图将它指向本地服务器,结果我得到的唯一参数是文件名:audio_file.wav。看起来它没有正确发送文件......

我仔细检查了我的凭据,所以我很确定这不是问题。此外,records 目录现在可以被世界写入。

4

2 回答 2

1

发现此配置存在两个问题:

  1. FreeSWITCH 未正确解析虚拟主机 URL。
  2. S3 密钥配置周围的空白没有被剥离。

FreeSWITCH 的主分支已修复:请参阅提交 b60df39b96 和 3b45ef90a。

另外 - 确保你没有加载 mod_htapi。

于 2014-08-12T20:46:20.883 回答
0

我在这里看到的唯一明显错误的是你在 rayo.conf.xml 中有“bucker.domain.com.s3.amazonaws.com”,但是在 rayo.conf.xml 中有“bucket.domain.com.s3.amazonaws.com” http_cache.conf.xml。拥有错误的域可能会导致 HTTP 403 Forbidden 响应。

于 2014-08-11T17:53:48.227 回答