Two application models are provided in this section to illustrate building an echo-cancelled connection via the SCbus.
This application model uses two Modular Station Interface (MSI/SC) station devices connected via the SCbus to two voice channel devices. The voice channel devices are operating in ECR mode. Two telephones are connected to the MSI/SC stations for providing input and for listening to the echo-cancelled output of each voice device.
1. Get SCbus transmit time slots of both MSI/SC devices and the ECR transmit time slots of the two voice channel devices.
ms_getxmitslot (MS1, &MS1_TX); ms_getxmitslot (MS2, &MS2_TX); dx_getxmitslotecr (CH1, &CH1_ECR_TX); dx_getxmitslotecr (CH2, &CH2_ECR_TX);
2. Have both MSI/SC stations listen to the ECR transmit of the opposite voice channel.
ms_listen (MS1, &CH2_ECR_TX); ms_listen (MS2, &CH1_ECR_TX);
3. Have both voice channel devices listen to their corresponding MSI/SC station device.
dx_listen (CH1, &MS1_TX); dx_listen (CH2, &MS2_TX);
4. Have each voice channel connect its echo canceller's receive time slot to the opposite echo canceller's ECR transmit. These signals are used as echo-reference signals.
dx_listenecr (CH1, & CH2_ECR_TX); dx_listenecr (CH2, & CH1_ECR_TX);
Figure 21. ECR Bridge Example Diagram

Example#include <stdio.h>
#include <windows.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <msilib.h>
#include <errno.h>
main()
{
int chdev1, chdev2; /* Voice channel device handles */
int msdev1, msdev2; /* MSI/SC station device handles */
SC_TSINFO sc_tsinfo; /* SCbus time slot information structure */
long scts; /* Pointer to SCbus time slot */
long ms1txts, ms2txts, /* Transmit time slots of stations 1 & 2 */
ch1ecrtxts, ch2ecrtxts; /* Transmit time slots of echo cancellers on voice channels 1 & 2 */
/* Open voice board 1 channel 1 device */
if ((chdev1 = dx_open("dxxxB1C1", 0)) == -1) {
printf("Cannot open channel dxxxB1C1. errno = %d", errno);
exit(1);
}
/* Open voice board 1 channel 2 device */
if ((chdev2 = dx_open("dxxxB1C2", 0)) == -1) {
printf("Cannot open channel dxxxB1C2. errno = %d", errno);
exit(1);
}
/* Open MSI/SC board 1 station 1 device */
if ((msdev1 = ms_open("msiB1C1", 0)) == -1) {
printf("Cannot open station msiB1C1. errno = %d", errno);
exit(1);
}
/* Open MSI/SC board 1 station 2 device */
if ((msdev2 = ms_open("msiB1C2", 0)) == -1) {
printf("Cannot open station msiB1C2. errno = %d", errno);
exit(1);
}
/* Initialize an SCbus time slot information */
sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarrayp = &scts;
/* Get SCbus time slot connected to transmit of MSI/SC station 1 on board 1 */
if (ms_getxmitslot(msdev1, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev1), ATDV_NAMEP(msdev1));
exit(1);
}
ms1txts = scts;
/* Get SCbus time slot connected to transmit of MSI/SC station 2 on board 1 */
if (ms_getxmitslot(msdev2, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev2), ATDV_NAMEP(msdev2));
exit(1);
}
ms2txts = scts;
/* Get SCbus time slot connected to transmit of voice channel 1 on board 1 */
if (dx_getxmitslotecr(chdev1, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev1), ATDV_NAMEP(chdev1));
exit(1);
}
ch1ecrtxts = scts;
/* Get SCbus time slot connected to transmit of voice channel 2 on board 1 */
if (dx_getxmitslotecr(chdev2, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev2), ATDV_NAMEP(chdev2));
exit(1);
}
ch2ecrtxts = scts;
/* Have MSI/SC station 1 listen to channel 2's echo-cancelled transmit */
if (ms_listen(msdev1, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev1), ATDV_NAMEP(msdev1));
exit(1);
}
scts = ch1ecrtxts;
/* Have MSI/SC station 2 listen to channel 1's echo-cancelled transmit */
if (ms_listen(msdev2, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev2), ATDV_NAMEP(msdev2));
exit(1);
}
scts = ms1txts;
/* Have channel 1 listen to station 1's transmit */
if (dx_listen(chdev1, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev1), ATDV_NAMEP(chdev1));
exit(1);
}
scts = ms2txts;
/* Have channel 2 listen to station 2's transmit */
if (dx_listen(chdev2, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev2), ATDV_NAMEP(chdev2));
exit(1);
}
scts = ch2ecrtxts;
/* Have channel 1's echo canceller listen to channel 2's echo-cancelled transmit */
if (dx_listenecr(chdev1, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev1), ATDV_NAMEP(chdev1));
exit(1);
}
scts = ch1ecrtxts;
/* Have channel 2's echo canceller listen to channel 1's echo-cancelled transmit */
if (dx_listenecr(chdev2, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev2), ATDV_NAMEP(chdev2));
exit(1);
}
/* Bridge connected, both stations receive echo-cancelled signal */
/*
*
* Continue
*
*/
/* Then perform xx_unlisten() and dx_unlistenecr(), plus all necessary xx_close()s */
if (ms_unlisten(msdev2) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev2), ATDV_NAMEP(msdev2));
exit(1);
}
if (ms_unlisten(msdev1) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev1), ATDV_NAMEP(msdev1));
exit(1);
}
if (dx_unlistenecr(chdev2) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev2), ATDV_NAMEP(chdev2));
exit(1);
}
if (dx_unlistenecr(chdev1) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev1), ATDV_NAMEP(chdev1));
exit(1);
}
if (dx_unlisten(chdev2) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev2), ATDV_NAMEP(chdev2));
exit(1);
}
if (dx_unlisten(chdev1) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev1), ATDV_NAMEP(chdev1));
exit(1);
}
if (dx_close(chdev1) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev1), ATDV_NAMEP(chdev1));
exit(1);
}
if (dx_close(chdev2) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev2), ATDV_NAMEP(chdev2));
exit(1);
}
if (ms_close(msdev1) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev1), ATDV_NAMEP(chdev1));
exit(1);
}
if (ms_close(msdev2) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev2), ATDV_NAMEP(msdev2));
exit(1);
}
return(0);
}
8.4.2. How to Set Up an ECR Play Over the SCbusIn this model, two MSI/SC station devices are connected via the SCbus to two voice channel devices. The second voice channel device is operating in ECR mode. Two telephones are connected to the MSI/SC stations for providing input and listening to the echo-cancelled output of the second voice device, and to the non-echo-cancelled output of the first voice device.
1. Get SCbus transmit time slots of both MSI/SC devices and the ECR transmit time slots of the two voice channel devices.
ms_getxmitslot (MS1, &MS1_TX); dx_getxmitslot (CH1, &CH1_TX); dx_getxmitslotecr (CH2, &CH2_ECR_TX);
2. Have the MSI/SC station 1 listen to the transmit (TX) of channel 1.
ms_listen (MS1, & CH1_TX);
3. Have MSI/SC station 2 listen to the ECR transmit of channel 2.
ms_listen (MS2, & CH2_ECR_TX);
4. Have voice channel 2 listen to MSI/SC station 1's transmit.
dx_listen (CH2, & MS1_TX);
5. Have voice channel 2 connect its echo canceller's receive time slot to transmit of channel 1. This signal is used as the echo-reference signal.
dx_listenecr (CH2, & CH1_TX);
Figure 22. An ECR Play Over the SCbus

Example#include <stdio.h>
#include <windows.h>
#include <srllib.h>
#include <dxxxlib.h>
#include <msilib.h>
#include <errno.h>
main()
{
int chdev1, chdev2; /* Voice channel device handles */
int msdev1, msdev2; /* MSI/SC station device handles */
SC_TSINFO sc_tsinfo; /* SCbus time slot information structure */
long scts; /* Pointer to SCbus time slot */
long ms1txts, /* Transmit time slots of stations 1 & 2 */
ch1txts, ch2ecrtxts; /* Transmit time slots of echo cancellers on
voice channels 1 & 2 */
/* Open voice board 1 channel 1 device */
if ((chdev1 = dx_open("dxxxB1C1", 0)) == -1) {
printf("Cannot open channel dxxxB1C1. errno = %d", errno);
exit(1);
}
/* Open voice board 1 channel 2 device */
if ((chdev2 = dx_open("dxxxB1C2", 0)) == -1) {
printf("Cannot open channel dxxxB1C2. errno = %d", errno);
exit(1);
}
/* Open MSI/SC board 1 station 1 device */
if ((msdev1 = ms_open("msiB1C1", 0)) == -1) {
printf("Cannot open station msiB1C1. errno = %d", errno);
exit(1);
}
/* Open MSI/SC board 1 station 2 device */
if ((msdev2 = ms_open("msiB1C2", 0)) == -1) {
printf("Cannot open station msiB1C2. errno = %d", errno);
exit(1);
}
/* Initialize an SCbus time slot information */
sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarrayp = &scts;
/* Get SCbus time slot connected to transmit of voice channel 1 on board 1 */
if (ms_getxmitslot(msdev1, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev1), ATDV_NAMEP(msdev1));
exit(1);
}
ms1txts = scts;
/* Get SCbus time slot connected to transmit of voice channel 1 on board 1*/
if (dx_getxmitslot(chdev1, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev1), ATDV_NAMEP(chdev1));
exit(1);
}
ch1txts = scts;
/* Get SCbus time slot connected to transmit of voice channel 1 on board 1 */
if (dx_getxmitslotecr(chdev2, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev2), ATDV_NAMEP(chdev2));
exit(1);
}
ch2ecrtxts = scts;
/* Have station 1 listen to file played by voice channel 1 */
scts = ch1txts;
if (ms_listen(msdev1, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev1), ATDV_NAMEP(msdev1));
exit(1);
}
/* Have station 2 listen to echo-cancelled output of voice channel 2 */
scts = ch2ecrtxts;
if (ms_listen(msdev2, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev2), ATDV_NAMEP(msdev2));
exit(1);
}
/* Have voice channel 2 listen to echo-carrying signal from station 1 */
scts = ms1txts;
if (dx_listen(chdev2, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev1), ATDV_NAMEP(chdev1));
exit(1);
}
/* And activate the ECR feature on voice channel 2, with the echo-reference signal
coming from voice channel 1 */
scts = ch1txts;
if (dx_listenecr(chdev2, &sc_tsinfo) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev2), ATDV_NAMEP(chdev2));
exit(1);
}
/* Setup completed, any signal transmitted from channel device 1,
* will a) be received by station 1,
* b) contribute echo to the transmit of station 1,
* c) will be heard AFTER echo cancellation (on channel 2) by
* station 2.*/
/*
.
. Continue
.
*/
/* Then perform xx_unlisten() and dx_unlistenecr(), plus all necessary xx_close()s */
if (ms_unlisten(msdev2) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev2), ATDV_NAMEP(msdev2));
exit(1);
}
if (ms_unlisten(msdev1) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev1), ATDV_NAMEP(msdev1));
exit(1);
}
if (dx_unlistenecr(chdev2) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev2), TDV_NAMEP(chdev2));
exit(1);
}
if (dx_unlisten(chdev2) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev2), ATDV_NAMEP(chdev2));
exit(1);
}
if (dx_close(chdev1) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev1), ATDV_NAMEP(chdev1));
exit(1);
}
if (dx_close(chdev2) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(chdev2), ATDV_NAMEP(chdev2));
exit(1);
}
if (ms_close(msdev1) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev1), ATDV_NAMEP(msdev1));
exit(1);
}
if (ms_close(msdev2) == -1) {
printf("Error message = %s, on %s", ATDV_ERRMSGP(msdev2), ATDV_NAMEP(msdev2));
exit(1);
}
return(0);
}
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation