FS-3794 more fun

This commit is contained in:
Anthony Minessale 2012-02-14 18:59:37 -06:00
parent eb4cac9b5e
commit 303de52bad
2 changed files with 59 additions and 59 deletions

View File

@ -1563,7 +1563,7 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-id", call_id);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "resub", "true");
//switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "resub", "true");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", status);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
@ -1595,12 +1595,9 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
}
}
switch_event_fire(&event);
}
switch_safe_free(free_me);
@ -2415,7 +2412,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
char *clean_from_user = NULL;
int force_status = 0;
const char *call_state = switch_event_get_header(helper->event, "channel-state");
char *call_info_state = switch_event_get_header(helper->event, "presence-call-info-state");
if (user_agent && switch_stristr("snom", user_agent) && uuid) {
default_dialog = "full" ;
@ -2532,7 +2529,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
}
if (sofia_test_pflag(profile, PFLAG_PRESENCE_DISABLE_EARLY) && !strcasecmp(astate, "early")) {
if (sofia_test_pflag(profile, PFLAG_PRESENCE_DISABLE_EARLY) &&
(!zstr(call_info_state) && (!strcasecmp(call_info_state, "alterting") || !strcasecmp(call_info_state, "progressing")))) {
goto end;
}
@ -3552,14 +3550,16 @@ void sofia_presence_handle_sip_i_subscribe(int status,
switch_event_fire(&sevent);
}
} else if (!strcasecmp(event, "presence")) {
if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "login", profile->name);
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "presence-source", "subscribe");
switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host);
switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host);
switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, to_host);
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "rpid", "unknown");
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "status", "Registered");
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "call-id", call_id);
switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "sub-call-id", call_id);
switch_event_fire(&sevent);
}
}

View File

@ -604,6 +604,7 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel,
switch_event_t *event;
switch_event_types_t type = SWITCH_EVENT_PRESENCE_IN;
const char *call_info = NULL;
char *call_info_state = "active";
if (!status) {
type = SWITCH_EVENT_PRESENCE_OUT;
@ -634,8 +635,6 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel,
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_nosig(channel)) {
call_info_state = "idle";
@ -652,13 +651,14 @@ SWITCH_DECLARE(void) switch_channel_perform_presence(switch_channel_t *channel,
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-info-state", call_info_state);
if (call_info) {
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_add_header_string(event, SWITCH_STACK_BOTTOM, "Presence-Calling-File", file);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Presence-Calling-Function", func);