diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index cc9e054258..16ac94a6a8 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -4379,8 +4379,6 @@ void sofia_presence_handle_sip_i_message(int status, } if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { - event->flags |= EF_UNIQ_HEADERS; - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); @@ -4410,10 +4408,13 @@ void sofia_presence_handle_sip_i_message(int status, switch_event_add_body(event, "%s", msg); } - if (switch_event_dup(&event_dup, event) == SWITCH_STATUS_SUCCESS) { - event_dup->event_id = SWITCH_EVENT_RECV_MESSAGE; - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Name", switch_event_name(event->event_id)); - switch_event_fire(&event_dup); + if (sofia_test_pflag(profile, PFLAG_FIRE_MESSAGE_EVENTS)) { + if (switch_event_dup(&event_dup, event) == SWITCH_STATUS_SUCCESS) { + event_dup->event_id = SWITCH_EVENT_RECV_MESSAGE; + event_dup->flags |= EF_UNIQ_HEADERS; + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Name", switch_event_name(event->event_id)); + switch_event_fire(&event_dup); + } }