add fire-message-events profile param

This commit is contained in:
Anthony Minessale 2012-08-29 15:34:17 -05:00
parent 5c00f6638c
commit fb9b69f469
3 changed files with 24 additions and 1 deletions

View File

@ -271,6 +271,7 @@ typedef enum {
PFLAG_CONFIRM_BLIND_TRANSFER, PFLAG_CONFIRM_BLIND_TRANSFER,
PFLAG_THREAD_PER_REG, PFLAG_THREAD_PER_REG,
PFLAG_MWI_USE_REG_CALLID, PFLAG_MWI_USE_REG_CALLID,
PFLAG_FIRE_MESSAGE_EVENTS,
/* No new flags below this line */ /* No new flags below this line */
PFLAG_MAX PFLAG_MAX
} PFLAGS; } PFLAGS;

View File

@ -3410,6 +3410,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
} else { } else {
sofia_clear_pflag(profile, PFLAG_IN_DIALOG_CHAT); sofia_clear_pflag(profile, PFLAG_IN_DIALOG_CHAT);
} }
} else if (!strcasecmp(var, "fire-message-events")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_FIRE_MESSAGE_EVENTS);
} else {
sofia_clear_pflag(profile, PFLAG_FIRE_MESSAGE_EVENTS);
}
} else if (!strcasecmp(var, "disable-hold")) { } else if (!strcasecmp(var, "disable-hold")) {
if (switch_true(val)) { if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_DISABLE_HOLD); sofia_set_pflag(profile, PFLAG_DISABLE_HOLD);
@ -4336,6 +4342,12 @@ switch_status_t config_sofia(int reload, char *profile_name)
} else { } else {
sofia_clear_pflag(profile, PFLAG_IN_DIALOG_CHAT); sofia_clear_pflag(profile, PFLAG_IN_DIALOG_CHAT);
} }
} else if (!strcasecmp(var, "fire-message-events")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_FIRE_MESSAGE_EVENTS);
} else {
sofia_clear_pflag(profile, PFLAG_FIRE_MESSAGE_EVENTS);
}
} else if (!strcasecmp(var, "t38-passthru")) { } else if (!strcasecmp(var, "t38-passthru")) {
if (switch_true(val)) { if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_T38_PASSTHRU); sofia_set_pflag(profile, PFLAG_T38_PASSTHRU);

View File

@ -4349,7 +4349,7 @@ void sofia_presence_handle_sip_i_message(int status,
if (nh) { if (nh) {
char hash_key[512]; char hash_key[512];
private_object_t *tech_pvt; private_object_t *tech_pvt;
switch_event_t *event; switch_event_t *event, *event_dup;
char *to_addr; char *to_addr;
char *from_addr; char *from_addr;
char *p; char *p;
@ -4379,6 +4379,8 @@ void sofia_presence_handle_sip_i_message(int status,
} }
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { 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, "login", profile->url);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
@ -4407,6 +4409,14 @@ void sofia_presence_handle_sip_i_message(int status,
if (msg) { if (msg) {
switch_event_add_body(event, "%s", msg); 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);
}
} else { } else {
abort(); abort();
} }