From 3dd9d5c0a399757059c60d9d8c751b97383da676 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 21 Jan 2011 14:35:23 -0600 Subject: [PATCH] FS-3007 --- src/mod/endpoints/mod_sofia/sofia_presence.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 94fef61181..19125c600b 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -630,6 +630,11 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) char *probe_user = NULL, *probe_euser, *probe_host, *p; struct dialog_helper dh = { { 0 } }; + if (strcasecmp(proto, SOFIA_CHAT_PROTO) != 0) { + goto done; + } + + if (!to || !(probe_user = strdup(to))) { goto done; } @@ -2405,6 +2410,20 @@ void sofia_presence_handle_sip_i_subscribe(int status, switch_event_fire(&sevent); } + } else if (to_user && (strcasecmp(proto, SOFIA_CHAT_PROTO) != 0)) { + if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto", proto); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "long", profile->name); + switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host); + switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "to", "%s%s%s@%s", proto, "+", to_user, to_host); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto-specific-event-name", event); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); + switch_event_fire(&sevent); + + } } else { 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);