diff --git a/src/include/switch_core_media.h b/src/include/switch_core_media.h index 508981027c..50605b445b 100644 --- a/src/include/switch_core_media.h +++ b/src/include/switch_core_media.h @@ -111,6 +111,7 @@ typedef struct switch_core_media_params_s { char *inbound_codec_string; char *outbound_codec_string; + switch_bool_t disable_video_codecs; char *timer_name; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index cd83749db7..89fd37931e 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -712,6 +712,7 @@ struct sofia_profile { unsigned int tls_timeout; char *inbound_codec_string; char *outbound_codec_string; + switch_bool_t disable_video_codecs; int running; int dtmf_duration; uint8_t flags[TFLAG_MAX]; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 899f70c578..d6c4a544d2 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6076,6 +6076,8 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name) profile->inbound_codec_string = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "outbound-codec-prefs")) { profile->outbound_codec_string = switch_core_strdup(profile->pool, val); + } else if (!strcasecmp(var, "disable-video-codecs")) { + profile->disable_video_codecs = switch_true(val); } else if (!strcasecmp(var, "challenge-realm")) { profile->challenge_realm = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "challenge-opaque")) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 36a0b114fd..9dadf35553 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -171,6 +171,7 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t * tech_pvt->mparams.ndlb = tech_pvt->profile->mndlb; tech_pvt->mparams.inbound_codec_string = profile->inbound_codec_string; tech_pvt->mparams.outbound_codec_string = profile->outbound_codec_string; + tech_pvt->mparams.disable_video_codecs = profile->disable_video_codecs; tech_pvt->mparams.auto_rtp_bugs = profile->auto_rtp_bugs; tech_pvt->mparams.timer_name = profile->timer_name; tech_pvt->mparams.vflags = profile->vflags; diff --git a/src/switch_core_media.c b/src/switch_core_media.c index e91516f6bb..936a4385f2 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -4505,6 +4505,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_add_ice_acl(switch_core_sessio SWITCH_DECLARE(void) switch_core_media_check_video_codecs(switch_core_session_t *session) { switch_media_handle_t *smh; + const char *disable_video; switch_assert(session); @@ -4512,16 +4513,20 @@ SWITCH_DECLARE(void) switch_core_media_check_video_codecs(switch_core_session_t return; } - if (smh->mparams->num_codecs && !switch_channel_test_flag(session->channel, CF_VIDEO_POSSIBLE)) { + if (!zstr(disable_video = switch_channel_get_variable(session->channel, "disable_video_codecs"))) { + if (switch_true(disable_video)) { + switch_channel_set_flag(session->channel, CF_NOVIDEO); + } + } else if (smh->mparams->disable_video_codecs) { + switch_channel_set_flag(session->channel, CF_NOVIDEO); + } + + if (smh->mparams->num_codecs && !switch_channel_test_flag(session->channel, CF_VIDEO_POSSIBLE) && !switch_channel_test_flag(session->channel, CF_NOVIDEO)) { int i; smh->video_count = 0; for (i = 0; i < smh->mparams->num_codecs; i++) { if (smh->codecs[i]->codec_type == SWITCH_CODEC_TYPE_VIDEO) { - if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_INBOUND && - switch_channel_test_flag(session->channel, CF_NOVIDEO)) { - continue; - } smh->video_count++; } }