tweak evnts

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9891 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-10-08 14:22:55 +00:00
parent 99a28acebb
commit e4dfe9ffd4
2 changed files with 22 additions and 40 deletions

View File

@ -1128,6 +1128,27 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", switch_str_nil(codec->implementation->iananame));
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", codec->implementation->actual_samples_per_second);
}
/* Index Caller's Profile */
if (caller_profile) {
switch_caller_profile_event_set_data(caller_profile, "Caller", event);
}
if (originator_caller_profile && originatee_caller_profile) {
/* Index Originator's Profile */
switch_caller_profile_event_set_data(originator_caller_profile, "Originator", event);
/* Index Originatee's Profile */
switch_caller_profile_event_set_data(originatee_caller_profile, "Originatee", event);
} else {
/* Index Originator's Profile */
if (originator_caller_profile) {
switch_caller_profile_event_set_data(originator_caller_profile, "Other-Leg", event);
} else if (originatee_caller_profile) { /* Index Originatee's Profile */
switch_caller_profile_event_set_data(originatee_caller_profile, "Other-Leg", event);
}
}
if (switch_test_flag(channel, CF_VERBOSE_EVENTS) ||
event->event_id == SWITCH_EVENT_CHANNEL_ORIGINATE ||
@ -1137,28 +1158,10 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw
event->event_id == SWITCH_EVENT_CHANNEL_HANGUP ||
event->event_id == SWITCH_EVENT_REQUEST_PARAMS ||
event->event_id == SWITCH_EVENT_CHANNEL_DATA ||
event->event_id == SWITCH_EVENT_SESSION_HEARTBEAT ||
event->event_id == SWITCH_EVENT_CUSTOM
) {
/* Index Caller's Profile */
if (caller_profile) {
switch_caller_profile_event_set_data(caller_profile, "Caller", event);
}
if (originator_caller_profile && originatee_caller_profile) {
/* Index Originator's Profile */
switch_caller_profile_event_set_data(originator_caller_profile, "Originator", event);
/* Index Originatee's Profile */
switch_caller_profile_event_set_data(originatee_caller_profile, "Originatee", event);
} else {
/* Index Originator's Profile */
if (originator_caller_profile) {
switch_caller_profile_event_set_data(originator_caller_profile, "Other-Leg", event);
} else if (originatee_caller_profile) { /* Index Originatee's Profile */
switch_caller_profile_event_set_data(originatee_caller_profile, "Other-Leg", event);
}
}
x = 0;
/* Index Variables */
if (channel->variables) {

View File

@ -106,7 +106,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
switch_status_t status;
int need_codec, perfect, do_bugs = 0, do_resample = 0, is_cng = 0;
unsigned int flag = 0;
switch_event_header_t *hi;
switch_assert(session != NULL);
@ -131,26 +130,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
switch_event_create(&event, SWITCH_EVENT_SESSION_HEARTBEAT);
switch_channel_event_set_data(session->channel, event);
if (!switch_channel_test_flag(session->channel, CF_VERBOSE_EVENTS)) {
if ((hi = switch_channel_variable_first(session->channel))) {
for (; hi; hi = hi->next) {
char buf[1024] = "";
char *vvar = NULL, *vval = NULL;
if (strncasecmp(hi->name, "hb_", 3)) {
continue;
}
vvar = (char *) hi->name;
vval = (char *) hi->value;
switch_assert(vvar && vval);
switch_snprintf(buf, sizeof(buf), "variable_%s", vvar);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, buf, vval);
}
switch_channel_variable_last(session->channel);
}
}
switch_event_fire(&event);
} else {
session->read_frame_count--;