在freeswitch上使用mod_rayo和mod_http_cache将录音存储在s3上

时间:2014-08-10 01:13:39

标签: amazon-s3 freeswitch adhearsion

我试图让我的录音存储在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。看起来它没有正确发送文件......

我仔细检查了我的凭证,所以我非常确定这不是问题所在。此外,记录目录现在可以由世界写入。

2 个答案:

答案 0 :(得分:1)

此配置发现两个问题:

  1. FreeSWITCH未正确解析虚拟主机URL。
  2. 未删除S3密钥配置周围的空白。
  3. FreeSWITCH的主分支有修复:请参阅提交b60df39b96和3b45ef90a。

    另外 - 确保没有加载mod_httapi。

答案 1 :(得分:0)

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