From cce0289874b40431a1cb78882737e0a9eaa0eb30 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 28 Jun 2011 11:28:58 -0400 Subject: [PATCH] freetdm: added mixaudio parameter to ftmod_pritap per Orecx request --- libs/freetdm/conf/freetdm.conf.xml | 32 +++++++++++++++++++ .../src/ftmod/ftmod_pritap/ftmod_pritap.c | 11 +++++++ 2 files changed, 43 insertions(+) diff --git a/libs/freetdm/conf/freetdm.conf.xml b/libs/freetdm/conf/freetdm.conf.xml index 29232d927b..dd426b089a 100644 --- a/libs/freetdm/conf/freetdm.conf.xml +++ b/libs/freetdm/conf/freetdm.conf.xml @@ -275,5 +275,37 @@ with the signaling protocols that you can run on top of your I/O interfaces. --> + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c b/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c index 48a2f012eb..53afebc77e 100644 --- a/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c +++ b/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c @@ -57,6 +57,7 @@ typedef struct pritap { int32_t flags; struct pri *pri; int debug; + uint8_t mixaudio; ftdm_channel_t *dchan; ftdm_span_t *span; ftdm_span_t *peerspan; @@ -752,6 +753,7 @@ static ftdm_status_t ftdm_pritap_sig_read(ftdm_channel_t *ftdmchan, void *data, ftdm_status_t status; fio_codec_t codec_func; ftdm_channel_t *peerchan = ftdmchan->call_data; + pritap_t *pritap = ftdmchan->span->signal_data; int16_t chanbuf[size]; int16_t peerbuf[size]; int16_t mixedbuf[size]; @@ -762,6 +764,11 @@ static ftdm_status_t ftdm_pritap_sig_read(ftdm_channel_t *ftdmchan, void *data, return FTDM_SUCCESS; } + if (!pritap->mixaudio) { + /* No mixing requested */ + return FTDM_SUCCESS; + } + if (ftdmchan->native_codec != peerchan->native_codec) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Invalid peer channel with format %d, ours = %d\n", peerchan->native_codec, ftdmchan->native_codec); @@ -829,6 +836,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_pritap_configure_span) uint32_t i; const char *var, *val; const char *debug = NULL; + uint8_t mixaudio = 1; ftdm_channel_t *dchan = NULL; pritap_t *pritap = NULL; ftdm_span_t *peerspan = NULL; @@ -857,6 +865,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_pritap_configure_span) if (!strcasecmp(var, "debug")) { debug = val; + } else if (!strcasecmp(var, "mixaudio")) { + mixaudio = ftdm_true(val); } else if (!strcasecmp(var, "peerspan")) { if (ftdm_span_find_by_name(val, &peerspan) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "Invalid tapping peer span %s\n", val); @@ -880,6 +890,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_pritap_configure_span) pritap->debug = parse_debug(debug); pritap->dchan = dchan; pritap->peerspan = peerspan; + pritap->mixaudio = mixaudio; span->start = ftdm_pritap_start; span->stop = ftdm_pritap_stop;