2017-09-07 90 views
0

RECORD_START | STOP事件我已經設置了一個NodeJS應用程序(帶有node_esl),並將它連接到部署在Amazon AWS上的Freeswitch服務器的事件套接字層(ESL)。請參見下面的代碼: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。有任何想法嗎?

回答

0

我測試了這個,它看起來像RECORD_START | STOP事件只適用於record應用程序(可能是record_session應用程序,我沒有測試這個),但不適用於會議記錄。

爲了排除故障,我跑fs_cli> /event plain all從FreeSWITCH的命令行,這些事件都出現了,當我跑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 

爲了您的節點的應用程序,你可以嘗試這樣的事情,讓你需要的東西:

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 
 
    }); 
 
    }); 
 
});