Freeswitch ESL中的RECORD_START | STOP事件

时间:2017-09-07 12:12:25

标签: freeswitch

我已经设置了NodeJS应用程序(带有node_esl),并将其与部署在Amazon AWS上的Freeswitch服务器的事件套接字层(ESL)连接起来。请参阅以下代码:

var esl = require('modesl'),
conn = new esl.Connection('SERVER_IP', PORT, 'PASSWORD', function() {
        conn.api('status', function(res) {
            //res is an esl.Event instance
            console.log(res.getBody());
        });


    conn.subscribe([
        'RECORD_START',
        'RECORD_STOP'
    ], function(evt) {
        console.log(evt)    
    });

    conn.on('esl::event::RECORD_START::*', function(evt) {
        console.log(evt);
    });

    conn.on('esl::event::RECORD_STOP::*', function(evt) {
        console.log(evt);
    });
});

我正在使用以下命令在Freeswitch中录制视频会议,我希望上面的接口能够接收RECORD_START | STOP事件。然而,上述事件从未收到过。

# To start recording
conference <conf_id> recording start
# To stop recording
conference <conf_id> recording stop

以下是我正在录制的会议的Freeswitch个人资料:

<profile name="cp">
  <param name="domain" value="$${domain}"/>
  <param name="rate" value="8000"/>
  <param name="video-mode" value="transcode"/>
  <param name="interval" value="20"/>
  <param name="caller-controls" value="default"/>
  <param name="energy-level" value="0"/>
  <param name="conference-flags" value="wait-mod|audio-always|livearray-sync|livearray-json-status"/>
  <param name="max-members" value="25"/>
  <param name="sound-prefix" value="/usr/local/freeswitch/conf/sounds/"/>
  <param name="enter-sound" value="tone_stream://%(200,0,500,600,700)"/>
  <param name="exit-sound" value="tone_stream://%(500,0,300,200,100,50,25)"/>
</profile>

我通过此界面接收了大部分ESL事件,但没有收到RECORD_START | STOP。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

我测试了这个,看起来RECORD_START | STOP事件只为record应用程序(可能是record_session应用程序发出。我没有测试过这个),但是没有用于会议录制。

为了排除故障,我从freeswitch命令行运行了fs_cli> /event plain all,当我运行conference <conf_id> recording startconference <conf_id> recording stop时,这些事件就显示出来了。

这是开始事件:

RECV EVENT
Event-Subclass: conference::maintenance
Event-Name: CUSTOM
Core-UUID: fe0ebcc0-0c43-44ed-adb3-ce4e7ee8f48b
FreeSWITCH-Hostname: freeswitch
FreeSWITCH-Switchname: freeswitch
FreeSWITCH-IPv4: 192.168.1.114
FreeSWITCH-IPv6: ::1
Event-Date-Local: 2017-09-14 17:38:22
Event-Date-GMT: Thu, 14 Sep 2017 17:38:22 GMT
Event-Date-Timestamp: 1505410702748201
Event-Calling-File: conference_record.c
Event-Calling-Function: conference_record_thread_run
Event-Calling-Line-Number: 278
Event-Sequence: 990
Conference-Name: conference
Conference-Size: 1
Conference-Ghosts: 0
Conference-Profile-Name: cp
Conference-Unique-ID: a431361f-a59b-4319-bec1-fa76f8630197
Action: start-recording
Path:{channels=1,samplerate=8000,vw=0,vh=0,fps=0.00}/usr/local/freeswitch/log/conference_recording_1.mp3
Error: File could not be opened for recording

这是停止事件:

RECV EVENT
Event-Subclass: conference::maintenance
Event-Name: CUSTOM
Core-UUID: fe0ebcc0-0c43-44ed-adb3-ce4e7ee8f48b
FreeSWITCH-Hostname: freeswitch
FreeSWITCH-Switchname: freeswitch
FreeSWITCH-IPv4: 192.168.1.114
FreeSWITCH-IPv6: ::1
Event-Date-Local: 2017-09-14 17:38:22
Event-Date-GMT: Thu, 14 Sep 2017 17:38:22 GMT
Event-Date-Timestamp: 1505410702748201
Event-Calling-File: conference_record.c
Event-Calling-Function: conference_record_thread_run
Event-Calling-Line-Number: 418
Event-Sequence: 991
Conference-Name: conference
Conference-Size: 1
Conference-Ghosts: 0
Conference-Profile-Name: cp
Conference-Unique-ID: a431361f-a59b-4319-bec1-fa76f8630197
Action: stop-recording
Path: {channels=1,samplerate=8000,vw=0,vh=0,fps=0.00}/usr/local/freeswitch/log/conference_recording_1.mp3
Other-Recordings: true
Samples-Out: 0
Samplerate: 8000
Milliseconds-Elapsed: 0

对于您的节点应用,您可以尝试这样的方法来获得所需内容:

&#13;
&#13;
var esl = require('modesl'),

conn = new esl.Connection('127.0.0.1', 8021, 'ClueCon', function() {
  conn.api('status', function(res) {
    //res is an esl.Event instance
    console.log(res.getBody());
  });

  conn.subscribe('CUSTOM conference::maintenance', function() {
    conn.on('esl::event::CUSTOM::**', function(evt) {
       console.log(evt);
       // now do something
    });
  });
});
&#13;
&#13;
&#13;