Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/mod/endpoints/mod_sofia/sofia_presence.c
Original file line number Diff line number Diff line change
Expand Up @@ -1954,6 +1954,7 @@ static int sofia_dialog_probe_callback(void *pArg, int argc, char **argv, char *
char *from_tag = switch_str_nil(argv[15]);
char *orig_proto = switch_str_nil(argv[16]);

switch_core_session_t *session;
const char *event_status = "";
char *data = NULL, *tmp;
char key[256] = "";
Expand All @@ -1968,6 +1969,7 @@ static int sofia_dialog_probe_callback(void *pArg, int argc, char **argv, char *
int bInternal = 0;
int i;
int skip_proto = 0;
int skip_dialog = 0;

if (mod_sofia_globals.debug_presence > 1) {
for (i = 0; i < argc; i++) {
Expand All @@ -1980,6 +1982,22 @@ static int sofia_dialog_probe_callback(void *pArg, int argc, char **argv, char *
return 0;
}

// If the dialog is in the "early" state check the presence_disable_early profile flag and channel variable.
// When presence_disable_early is set the dialog should not influence the result of the probe and resulting NOTIFY that is sent.
if (!strcasecmp(state, "early") && (session = switch_core_session_locate(uuid))) {
switch_channel_t *channel = switch_core_session_get_channel(session);

if (sofia_test_pflag(h->profile, PFLAG_PRESENCE_DISABLE_EARLY) ||
switch_true(switch_channel_get_variable(channel, "presence_disable_early"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sofia_dialog_probe_callback: presence_disable_early is set skipping dialog\n");
skip_dialog = 1;
}

switch_core_session_rwunlock(session);

if (skip_dialog) return 0;
}

// Usually we report the dialogs FROM the probed user. The exception is when the monitored endpoint is internal,
// and its presence_id is set in the dialplan. Reverse the direction if this is not a registered entity.
if (!strcmp(direction, "inbound") && strcmp(user, from_user) ) {
Expand Down