mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-13 04:36:42 +00:00
Merge pull request #1606 in FS/freeswitch from ~LAZEDO/freeswitch:feature/FS-11312 to master
* commit '0e0d5881444fa7af0730c56dc24ef7fc730870a1': FS-11312 [core] prevent double firing record_start event
This commit is contained in:
commit
e53c17ff68
@ -1145,6 +1145,7 @@ struct record_helper {
|
|||||||
uint32_t writes;
|
uint32_t writes;
|
||||||
uint32_t vwrites;
|
uint32_t vwrites;
|
||||||
const char *completion_cause;
|
const char *completion_cause;
|
||||||
|
int start_event_sent;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1188,6 +1189,7 @@ static void send_record_stop_event(switch_channel_t *channel, switch_codec_imple
|
|||||||
{
|
{
|
||||||
switch_event_t *event;
|
switch_event_t *event;
|
||||||
|
|
||||||
|
rh->start_event_sent = 0;
|
||||||
if (rh->fh) {
|
if (rh->fh) {
|
||||||
switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out);
|
switch_channel_set_variable_printf(channel, "record_samples", "%d", rh->fh->samples_out);
|
||||||
if (read_impl->actual_samples_per_second) {
|
if (read_impl->actual_samples_per_second) {
|
||||||
@ -1304,11 +1306,14 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(rh->start_event_sent == 0) {
|
||||||
|
rh->start_event_sent = 1;
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_RECORD_START) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create(&event, SWITCH_EVENT_RECORD_START) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file);
|
|
||||||
switch_channel_event_set_data(channel, event);
|
switch_channel_event_set_data(channel, event);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file);
|
||||||
switch_event_fire(&event);
|
switch_event_fire(&event);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rh->silence_time = switch_micro_time_now();
|
rh->silence_time = switch_micro_time_now();
|
||||||
rh->silence_timeout_ms = rh->initial_timeout_ms;
|
rh->silence_timeout_ms = rh->initial_timeout_ms;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user