diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 1860c08290..0a2f672df6 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -262,6 +262,7 @@ typedef enum { PFLAG_SHUTDOWN, PFLAG_PRESENCE_MAP, PFLAG_OPTIONS_RESPOND_503_ON_BUSY, + PFLAG_PRESENCE_DISABLE_EARLY, /* No new flags below this line */ PFLAG_MAX } PFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 3dd28d7f60..0668eedf57 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3035,6 +3035,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_T38_PASSTHRU); } + } else if (!strcasecmp(var, "presence-disable-early")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_PRESENCE_DISABLE_EARLY); + } else { + sofia_clear_pflag(profile, PFLAG_PRESENCE_DISABLE_EARLY); + } } else if (!strcasecmp(var, "ignore-183nosdp")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_IGNORE_183NOSDP); @@ -3809,6 +3815,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_T38_PASSTHRU); } + } else if (!strcasecmp(var, "presence-disable-early")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_PRESENCE_DISABLE_EARLY); + } else { + sofia_clear_pflag(profile, PFLAG_PRESENCE_DISABLE_EARLY); + } } else if (!strcasecmp(var, "ignore-183nosdp")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_IGNORE_183NOSDP); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 75c663ef07..683903fc66 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -2499,11 +2499,17 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * if (!strcasecmp(astate, "answered")) { astate = "confirmed"; } - + if (!strcasecmp(astate, "hangup")) { astate = "terminated"; } + if (!sofia_test_pflag(profile, PFLAG_PRESENCE_DISABLE_EARLY)) { + if (!strcasecmp(astate, "ringing") || !strcasecmp(astate, "early")) { + astate = "confirmed"; + } + } + if (is_dialog) { if (!strcasecmp(astate, "ringing")) {