re-arrange location of events
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16871 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
686efff6d2
commit
b7fb24cdff
|
@ -37,6 +37,8 @@
|
||||||
|
|
||||||
static void switch_core_media_bug_destroy(switch_media_bug_t *bug)
|
static void switch_core_media_bug_destroy(switch_media_bug_t *bug)
|
||||||
{
|
{
|
||||||
|
switch_event_t *event = NULL;
|
||||||
|
|
||||||
if (bug->raw_read_buffer) {
|
if (bug->raw_read_buffer) {
|
||||||
switch_buffer_destroy(&bug->raw_read_buffer);
|
switch_buffer_destroy(&bug->raw_read_buffer);
|
||||||
}
|
}
|
||||||
|
@ -44,6 +46,13 @@ static void switch_core_media_bug_destroy(switch_media_bug_t *bug)
|
||||||
if (bug->raw_write_buffer) {
|
if (bug->raw_write_buffer) {
|
||||||
switch_buffer_destroy(&bug->raw_write_buffer);
|
switch_buffer_destroy(&bug->raw_write_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (switch_event_create(&event, SWITCH_EVENT_MEDIA_BUG_STOP) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Media-Bug-Function", "%s", bug->function);
|
||||||
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Media-Bug-Target", "%s", bug->target);
|
||||||
|
if (bug->session) switch_channel_event_set_data(bug->session->channel, event);
|
||||||
|
switch_event_fire(&event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(void) switch_core_media_bug_pause(switch_core_session_t *session)
|
SWITCH_DECLARE(void) switch_core_media_bug_pause(switch_core_session_t *session)
|
||||||
|
@ -357,13 +366,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t
|
||||||
*new_bug = bug;
|
*new_bug = bug;
|
||||||
|
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_MEDIA_BUG_START) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_create(&event, SWITCH_EVENT_MEDIA_BUG_START) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_channel_event_set_data(session->channel, event);
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Media-Bug-Function", "%s", bug->function);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Media-Bug-Function", "%s", bug->function);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Media-Bug-Target", "%s", bug->target);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Media-Bug-Target", "%s", bug->target);
|
||||||
|
switch_channel_event_set_data(session->channel, event);
|
||||||
switch_event_fire(&event);
|
switch_event_fire(&event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,19 +469,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session
|
||||||
}
|
}
|
||||||
switch_thread_rwlock_unlock(session->bug_rwlock);
|
switch_thread_rwlock_unlock(session->bug_rwlock);
|
||||||
if (bp) {
|
if (bp) {
|
||||||
switch_event_t *event = NULL;
|
status = switch_core_media_bug_close(&bp);
|
||||||
|
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_MEDIA_BUG_STOP) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_channel_event_set_data(session->channel, event);
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Media-Bug-Function", "%s", bp->function);
|
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Media-Bug-Target", "%s", bp->target);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((status = switch_core_media_bug_close(&bp)) == SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_event_fire(&event);
|
|
||||||
} else {
|
|
||||||
switch_event_destroy(&event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue