add fire-message-events profile param
This commit is contained in:
parent
5c00f6638c
commit
fb9b69f469
|
@ -271,6 +271,7 @@ typedef enum {
|
|||
PFLAG_CONFIRM_BLIND_TRANSFER,
|
||||
PFLAG_THREAD_PER_REG,
|
||||
PFLAG_MWI_USE_REG_CALLID,
|
||||
PFLAG_FIRE_MESSAGE_EVENTS,
|
||||
/* No new flags below this line */
|
||||
PFLAG_MAX
|
||||
} PFLAGS;
|
||||
|
|
|
@ -3410,6 +3410,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
|
|||
} else {
|
||||
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")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_DISABLE_HOLD);
|
||||
|
@ -4336,6 +4342,12 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
|||
} else {
|
||||
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")) {
|
||||
if (switch_true(val)) {
|
||||
sofia_set_pflag(profile, PFLAG_T38_PASSTHRU);
|
||||
|
|
|
@ -4349,7 +4349,7 @@ void sofia_presence_handle_sip_i_message(int status,
|
|||
if (nh) {
|
||||
char hash_key[512];
|
||||
private_object_t *tech_pvt;
|
||||
switch_event_t *event;
|
||||
switch_event_t *event, *event_dup;
|
||||
char *to_addr;
|
||||
char *from_addr;
|
||||
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) {
|
||||
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);
|
||||
|
||||
|
@ -4407,6 +4409,14 @@ void sofia_presence_handle_sip_i_message(int status,
|
|||
if (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 {
|
||||
abort();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue