switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_event_t *fsevent = NULL;
+ const char *var;
if (direction >= SWITCH_RTP_CRYPTO_MAX || keylen > SWITCH_RTP_MAX_CRYPTO_LEN) {
return SWITCH_STATUS_FALSE;
memset(policy, 0, sizeof(*policy));
- switch_channel_set_variable(channel, "send_silence_when_idle", "-1");
+ /* many devices can't handle gaps in SRTP streams */
+ if (!(var = switch_channel_get_variable(channel, "send_silence_when_idle"))
+ || !(atoi(var))) {
+ switch_channel_set_variable(channel, "send_silence_when_idle", "-1");
+ }
switch (crypto_key->type) {
case AES_CM_128_HMAC_SHA1_80: