From fccbba53c37a3681cae2b441a9cdf12150b6bbce Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 18 May 2011 19:00:42 -0400 Subject: [PATCH] added FTDM_SILENCE_VALUE macro --- libs/freetdm/src/ftdm_io.c | 4 ++-- libs/freetdm/src/include/freetdm.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 5ae5344745..b57292c5b0 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3923,7 +3923,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data ftdm_mutex_unlock(ftdmchan->pre_buffer_mutex); - memset(data, 255, *datalen); + memset(data, FTDM_SILENCE_VALUE(ftdmchan), *datalen); if (ftdmchan->skip_read_frames > 0) { ftdmchan->skip_read_frames--; @@ -3935,7 +3935,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data if (ftdm_buffer_inuse(ftdmchan->pre_buffer) >= ftdmchan->pre_buffer_size) { ftdm_buffer_read(ftdmchan->pre_buffer, data, *datalen); } else { - memset(data, 255, *datalen); + memset(data, FTDM_SILENCE_VALUE(ftdmchan), *datalen); } } ftdm_mutex_unlock(ftdmchan->pre_buffer_mutex); diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index dfd18456e0..253f256ffa 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -320,6 +320,8 @@ FTDM_STR2ENUM_P(ftdm_str2ftdm_calling_party_category, ftdm_calling_party_categor /*! \brief Digit limit used in DNIS/ANI */ #define FTDM_DIGITS_LIMIT 25 +#define FTDM_SILENCE_VALUE(fchan) (fchan)->native_codec == FTDM_CODEC_ULAW ? 255 : (fchan)->native_codec == FTDM_CODEC_ALAW ? 0xD5 : 0x00 + /*! \brief Number abstraction */ typedef struct { char digits[FTDM_DIGITS_LIMIT];