提交 2c0eaac3 authored 作者: Anthony Minessale's avatar Anthony Minessale

add record_start and record_stop events

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14591 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 ee467481
差异被折叠。
......@@ -1902,7 +1902,7 @@ SWIG_ruby_failed(void)
}
/*@SWIG:/usr/share/swig/1.3.35/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
/*@SWIG:/usr/local/share/swig/1.3.35/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
{
VALUE obj = args[0];
......
......@@ -126,6 +126,8 @@ static const char *EVENT_NAMES[] = {
"RECV_INFO",
"CALL_SECURE",
"NAT",
"RECORD_START",
"RECORD_STOP",
"ALL"
};
......
......@@ -114,6 +114,8 @@ typedef enum {
ESL_EVENT_RECV_INFO,
ESL_EVENT_CALL_SECURE,
ESL_EVENT_NAT,
ESL_EVENT_RECORD_START,
ESL_EVENT_RECORD_STOP,
ESL_EVENT_ALL
} esl_event_types_t;
......
......@@ -1280,6 +1280,8 @@ typedef enum {
SWITCH_EVENT_RECV_INFO,
SWITCH_EVENT_CALL_SECURE,
SWITCH_EVENT_NAT,
SWITCH_EVENT_RECORD_START,
SWITCH_EVENT_RECORD_STOP,
SWITCH_EVENT_ALL
} switch_event_types_t;
......
......@@ -1365,6 +1365,8 @@ SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *ch
event->event_id == SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE ||
event->event_id == SWITCH_EVENT_SESSION_HEARTBEAT ||
event->event_id == SWITCH_EVENT_API ||
event->event_id == SWITCH_EVENT_RECORD_START ||
event->event_id == SWITCH_EVENT_RECORD_STOP ||
event->event_id == SWITCH_EVENT_CUSTOM
) {
......
......@@ -180,6 +180,8 @@ static char *EVENT_NAMES[] = {
"RECV_INFO",
"CALL_SECURE",
"NAT",
"RECORD_START",
"RECORD_STOP",
"ALL"
};
......
......@@ -432,9 +432,16 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
switch_core_session_t *session = switch_core_media_bug_get_session(bug);
switch_channel_t *channel = switch_core_session_get_channel(session);
struct record_helper *rh = (struct record_helper *) user_data;
switch_event_t *event;
switch (type) {
case SWITCH_ABC_TYPE_INIT:
if (switch_event_create(&event, SWITCH_EVENT_RECORD_START) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
}
break;
case SWITCH_ABC_TYPE_CLOSE:
{
......@@ -444,6 +451,11 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Stop recording file %s\n", rh->file);
switch_channel_set_private(channel, rh->file, NULL);
if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
}
if (rh->fh) {
if (switch_channel_test_flag(channel, CF_ANSWERED) || !switch_core_media_bug_test_flag(bug, SMBF_RECORD_ANSWER_REQ)) {
switch_size_t len;
......
......@@ -393,7 +393,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
switch_codec_implementation_t read_impl = {0};
switch_frame_t write_frame = { 0 };
unsigned char write_buf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
switch_event_t *event;
switch_core_session_get_read_impl(session, &read_impl);
......@@ -575,6 +575,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
}
}
if (switch_event_create(&event, SWITCH_EVENT_RECORD_START) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
}
for (;;) {
switch_size_t len;
......@@ -685,6 +691,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
}
if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
}
if (waste_resources) {
switch_core_codec_destroy(&write_codec);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论