From e5cc0539ffcbf660637198c698e90c2e30b05c2f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 30 Apr 2010 19:14:39 -0500 Subject: [PATCH] add disable_hold var or disable-hold profile param --- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 12 ++++++++++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 7fe7c5fe2b..cc999cdf9b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -200,6 +200,7 @@ typedef enum { PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE, PFLAG_MANUAL_REDIRECT, + PFLAG_DISABLE_HOLD, PFLAG_AUTO_NAT, PFLAG_SIPCOMPACT, PFLAG_SQL_IN_TRANS, diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c405822fcf..bbc0321d78 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2156,6 +2156,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_PASS_CALLEE_ID); } + } else if (!strcasecmp(var, "disable-hold")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_DISABLE_HOLD); + } else { + sofia_clear_pflag(profile, PFLAG_DISABLE_HOLD); + } } else if (!strcasecmp(var, "sip-trace")) { if (switch_true(val)) { sofia_set_flag(profile, TFLAG_TPORT_LOG); @@ -2791,6 +2797,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL); } + } else if (!strcasecmp(var, "disable-hold")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_DISABLE_HOLD); + } else { + sofia_clear_pflag(profile, PFLAG_DISABLE_HOLD); + } } else if (!strcasecmp(var, "dtmf-type")) { if (!strcasecmp(val, "rfc2833")) { profile->dtmf_type = DTMF_2833; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 3875fd2154..a692ec275c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3392,6 +3392,11 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t * } } + if (sofia_test_flag(tech_pvt->profile, PFLAG_DISABLE_HOLD) || + ((val = switch_channel_get_variable(tech_pvt->channel, "sip_disable_hold")) && switch_true(val))) { + sendonly = 0; + } + if (!tech_pvt->hold_laps) { tech_pvt->hold_laps++; sofia_glue_toggle_hold(tech_pvt, sendonly);