freetdm: added mixaudio parameter to ftmod_pritap per Orecx request
This commit is contained in:
parent
f12ab59e88
commit
cce0289874
|
@ -275,5 +275,37 @@ with the signaling protocols that you can run on top of your I/O interfaces.
|
|||
-->
|
||||
</span>
|
||||
</r2_spans>
|
||||
|
||||
<!--
|
||||
PRI passive tapping spans. Requires patched version from libpri at http://svn.digium.com/svn/libpri/team/moy/tap-1.4
|
||||
You must also configure FreeTDM with "-with-pritap" (see ./configure help for details)
|
||||
-->
|
||||
<pritap_spans>
|
||||
<span name="tapped1">
|
||||
<!-- The peer span name used to tap the link -->
|
||||
<param name="peerspan" value="tapped2"/>
|
||||
|
||||
<!--
|
||||
Whether to mix the audio from the peerspan with the audio from this span
|
||||
This is most likely what you want (and therefore the default) so you can hear
|
||||
the full conversation being tapped instead of just one side
|
||||
-->
|
||||
<!-- <param name="mixaudio" value="yes"/> -->
|
||||
|
||||
<!-- switch parameters (required), where to send calls to -->
|
||||
<param name="dialplan" value="XML"/>
|
||||
<param name="context" value="default"/>
|
||||
</span>
|
||||
|
||||
<span name="tapped2">
|
||||
<!-- This span is linked to "tapped1" through its peerspan parameter -->
|
||||
<param name="peerspan" value="tapped1"/>
|
||||
<!-- <param name="mixaudio" value="yes"/> -->
|
||||
|
||||
<!-- switch parameters (required), where to send calls to -->
|
||||
<param name="dialplan" value="XML"/>
|
||||
<param name="context" value="default"/>
|
||||
</span>
|
||||
</pritap_spans>
|
||||
</configuration>
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue