Voice API Programming Guide — June 2005 111
Recording and Playback
/* 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 TDM bus time slot information */
sc_tsinfo.sc_numts = 1;
sc_tsinfo.sc_tsarrayp = &scts;
/* Get TDM bus 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 TDM bus 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 TDM bus 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.*/