add channel events to message when its in-dialog
This commit is contained in:
parent
53e22518ea
commit
62ce2970c5
|
@ -983,7 +983,7 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n
|
||||||
sofia_dispatch_event_t *de,
|
sofia_dispatch_event_t *de,
|
||||||
tagi_t tags[]);
|
tagi_t tags[]);
|
||||||
void sofia_presence_handle_sip_i_message(int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh,
|
void sofia_presence_handle_sip_i_message(int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh,
|
||||||
sofia_private_t *sofia_private, sip_t const *sip,
|
switch_core_session_t *session, sofia_private_t *sofia_private, sip_t const *sip,
|
||||||
sofia_dispatch_event_t *de, tagi_t tags[]);
|
sofia_dispatch_event_t *de, tagi_t tags[]);
|
||||||
void sofia_presence_handle_sip_r_subscribe(int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh,
|
void sofia_presence_handle_sip_r_subscribe(int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh,
|
||||||
sofia_private_t *sofia_private, sip_t const *sip,
|
sofia_private_t *sofia_private, sip_t const *sip,
|
||||||
|
|
|
@ -1185,7 +1185,7 @@ static void our_sofia_event_callback(nua_event_t event,
|
||||||
sofia_handle_sip_i_state(session, status, phrase, nua, profile, nh, sofia_private, sip, de, tags);
|
sofia_handle_sip_i_state(session, status, phrase, nua, profile, nh, sofia_private, sip, de, tags);
|
||||||
break;
|
break;
|
||||||
case nua_i_message:
|
case nua_i_message:
|
||||||
sofia_presence_handle_sip_i_message(status, phrase, nua, profile, nh, sofia_private, sip, de, tags);
|
sofia_presence_handle_sip_i_message(status, phrase, nua, profile, nh, session, sofia_private, sip, de, tags);
|
||||||
break;
|
break;
|
||||||
case nua_i_info:
|
case nua_i_info:
|
||||||
sofia_handle_sip_i_info(nua, profile, nh, session, sip, de, tags);
|
sofia_handle_sip_i_info(nua, profile, nh, session, sip, de, tags);
|
||||||
|
|
|
@ -4268,7 +4268,9 @@ void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip)
|
||||||
|
|
||||||
void sofia_presence_handle_sip_i_message(int status,
|
void sofia_presence_handle_sip_i_message(int status,
|
||||||
char const *phrase,
|
char const *phrase,
|
||||||
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
|
nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh,
|
||||||
|
switch_core_session_t *session,
|
||||||
|
sofia_private_t *sofia_private, sip_t const *sip,
|
||||||
sofia_dispatch_event_t *de,
|
sofia_dispatch_event_t *de,
|
||||||
tagi_t tags[])
|
tagi_t tags[])
|
||||||
{
|
{
|
||||||
|
@ -4284,6 +4286,12 @@ void sofia_presence_handle_sip_i_message(int status,
|
||||||
const char *us;
|
const char *us;
|
||||||
char network_ip[80];
|
char network_ip[80];
|
||||||
int network_port = 0;
|
int network_port = 0;
|
||||||
|
switch_channel_t *channel = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
if (session) {
|
||||||
|
channel = switch_core_session_get_channel(session);
|
||||||
|
}
|
||||||
|
|
||||||
if ((us = sofia_glue_get_unknown_header(sip, "X-FS-Sending-Message")) && !strcmp(us, switch_core_get_uuid())) {
|
if ((us = sofia_glue_get_unknown_header(sip, "X-FS-Sending-Message")) && !strcmp(us, switch_core_get_uuid())) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not sending message to ourselves!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Not sending message to ourselves!\n");
|
||||||
|
@ -4380,6 +4388,11 @@ void sofia_presence_handle_sip_i_message(int status,
|
||||||
switch_event_add_body(event, "%s", msg);
|
switch_event_add_body(event, "%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (channel) {
|
||||||
|
switch_channel_event_set_data(channel, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (sofia_test_pflag(profile, PFLAG_FIRE_MESSAGE_EVENTS)) {
|
if (sofia_test_pflag(profile, PFLAG_FIRE_MESSAGE_EVENTS)) {
|
||||||
if (switch_event_dup(&event_dup, event) == SWITCH_STATUS_SUCCESS) {
|
if (switch_event_dup(&event_dup, event) == SWITCH_STATUS_SUCCESS) {
|
||||||
event_dup->event_id = SWITCH_EVENT_RECV_MESSAGE;
|
event_dup->event_id = SWITCH_EVENT_RECV_MESSAGE;
|
||||||
|
|
Loading…
Reference in New Issue