mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
xmas presence 2009
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16053 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
@@ -467,6 +467,7 @@ SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const ch
|
||||
{
|
||||
switch_event_t *event;
|
||||
switch_event_types_t type = SWITCH_EVENT_PRESENCE_IN;
|
||||
const char *call_info = NULL;
|
||||
|
||||
if (!status) {
|
||||
type = SWITCH_EVENT_PRESENCE_OUT;
|
||||
@@ -480,6 +481,8 @@ SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const ch
|
||||
return;
|
||||
}
|
||||
|
||||
call_info = switch_channel_get_variable(channel, "presence_call_info");
|
||||
|
||||
if (switch_event_create(&event, type) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(channel, event);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", __FILE__);
|
||||
@@ -494,6 +497,29 @@ SWITCH_DECLARE(void) switch_channel_presence(switch_channel_t *channel, const ch
|
||||
}
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
|
||||
|
||||
if (call_info) {
|
||||
char *call_info_state = "active";
|
||||
|
||||
if (!switch_channel_up(channel)) {
|
||||
call_info_state = "idle";
|
||||
} else if (!strcasecmp(status, "hold")) {
|
||||
call_info_state = "held";
|
||||
} else if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
|
||||
if (channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
||||
call_info_state = "progressing";
|
||||
} else {
|
||||
call_info_state = "alerting";
|
||||
}
|
||||
}
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-info-state", call_info_state);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-info", call_info);
|
||||
}
|
||||
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction",
|
||||
channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound");
|
||||
|
||||
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", channel->event_count++);
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
@@ -2191,6 +2217,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan
|
||||
free(stream.data);
|
||||
}
|
||||
|
||||
switch_channel_presence(channel, "unknown", "answered", NULL);
|
||||
|
||||
switch_channel_audio_sync(channel);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
Reference in New Issue
Block a user