Version

Figure 6. Call Center Example



void myInitialize(CTAHD ctahd, SWIHD *t1hd, SWIHD *cxhd)
{
SWI_TERMINUS inputs[24], outputs[24];
unsigned count;
/* Open a switch handle to the AG 4000 board */
swiOpenSwitch(ctahd, "AGSW", 0, SWI_ENABLE_RESTORE, t1hd);
/* Open a switch handle to the CX 2000 board */
swiOpenSwitch(ctahd, "CXSW", 0, SWI_ENABLE_RESTORE, cxhd);
/* Connect the DSPs to the line interfaces on the AG 4000: */
/* Connect the voice streams: */
/* Connect network XMIT to DSP RCV */
for (count = 0; count < 24; count++)
{
inputs[count].bus = MVIP95_LOCAL_BUS;
inputs[count].stream = 0;
inputs[count].timeslot = (DWORD)count;
outputs[count].bus = MVIP95_LOCAL_BUS;
outputs[count].stream = 17;
outputs[count].timeslot = (DWORD)count;
}
/* Make output address(es) read from input address(es) */
swiMakeConnection(*t1hd, inputs, outputs, count);
/* Connect DSP XMIT to network RCV */
for (count = 0; count < 24; count++)
{
inputs[count].bus = MVIP95_LOCAL_BUS;
inputs[count].stream = 16;
inputs[count].timeslot = (DWORD)count;
outputs[count].bus = MVIP95_LOCAL_BUS;
outputs[count].stream = 1;
outputs[count].timeslot = (DWORD)count;
}
swiMakeConnection(*t1hd, inputs, outputs, count);
/* Connect the signaling streams: */
/* Connect network XMIT to DSP RCV */
for (count = 0; count < 24; count++)
{
inputs[count].bus = MVIP95_LOCAL_BUS;
inputs[count].stream = 2;
inputs[count].timeslot = (DWORD)count;
outputs[count].bus = MVIP95_LOCAL_BUS;
outputs[count].stream = 19;
outputs[count].timeslot = (DWORD)count;
}
swiMakeConnection(*t1hd, inputs, outputs, count);
/* Connect DSP XMIT to network RCV */
for (count = 0; count < 24; count++)
{
inputs[count].bus = MVIP95_LOCAL_BUS;
inputs[count].stream = 18;
inputs[count].timeslot = (DWORD)count;
outputs[count].bus = MVIP95_LOCAL_BUS;
outputs[count].stream = 3;
outputs[count].timeslot = (DWORD)count;
}
swiMakeConnection(*t1hd, inputs, outputs, count);
}
/* Connect the DSPs to the line interfaces on the CX 2000 (signaling only)*/
/* Connect the signaling streams: */
/* Connect network XMIT to DSP RCV */
for (count = 0; count < 24; count++)
{
inputs[count].bus = MVIP95_LOCAL_BUS;
inputs[count].stream = 2;
inputs[count].timeslot = (DWORD)count;
outputs[count].bus = MVIP95_LOCAL_BUS;
outputs[count].stream = 7;
outputs[count].timeslot = (DWORD)count;
}
swiMakeConnection(*t1hd, inputs, outputs, count);
/* Connect DSP XMIT to network RCV */
for (count = 0; count < 24; count++)
{
inputs[count].bus = MVIP95_LOCAL_BUS;
inputs[count].stream = 6;
inputs[count].timeslot = (DWORD)count;
outputs[count].bus = MVIP95_LOCAL_BUS;
outputs[count].stream = 3;
outputs[count].timeslot = (DWORD)count;
}
/* Nails up CX 2000 lines to the MVIP bus */
void myConnectAgCx(SWIHD cxhd)
{
SWI_TERMINUS outputs[24], inputs[24];
unsigned count;
/* Connect Voice lines: */
/* Connect CX2000 local:0:0..23 to mvip:1:0..23 */
for (count = 0; count < 24; count++)
{
inputs[count].bus = MVIP95_LOCAL_BUS;
inputs[count].stream = 0;
inputs[count].timeslot = (DWORD)count;
outputs[count].bus = MVIP95_MVIP_BUS;
outputs[count].stream = 1;
outputs[count].timeslot = (DWORD)count;
}
swiMakeConnection(cxhd, inputs, outputs, count);
/* Connect CX2000 mvip:0:0..23 to local:1:0..23 */
for (count = 0; count < 24; count++)
{
inputs[count].bus = MVIP95_MVIP_BUS;
inputs[count].stream = 0;
inputs[count].timeslot = (DWORD)count;
outputs[count].bus = MVIP95_LOCAL_BUS;
outputs[count].stream = 1;
outputs[count].timeslot = (DWORD)count;
}
swiMakeConnection(cxhd, inputs, outputs, count);
}

The program returns to this state after each call.
/* Send Silence to incoming T1 call */
void mySendSilence(SWIHD t1hd, DWORD timeslot)
{
SWI_TERMINUS output;
BYTE pattern = 0x7F; /* Silence pattern for MU-law */
/* Send silence pattern to incoming call via local:1:timeslot */
output.bus = MVIP95_LOCAL_BUS;
output.stream = 1;
output.timeslot = timeslot;
swiSendPattern(t1hd, &pattern, &output, 1);
}
/* Connect T1 DSP to CX 2000 station, DUPLEX connection via the CT bus,
* in preparation for playing the "here comes a call" message.
*/
void myConnect4KCx(SWIHD t1hd, DWORD timeslot)
{
SWI_TERMINUS output, input;
/* Connect AG4000 T1 local:16:timeslot to mvip:0:timeslot */
input.bus = MVIP95_LOCAL_BUS;
input.stream = 16;
input.timeslot = timeslot;
output.bus = MVIP95_MVIP_BUS;
output.stream = 0;
output.timeslot = timeslot;
swiMakeConnection(t1hd, &input, &output, 1);
/* Connect AG4000 T1 mvip:1:timeslot to local:17:timeslot */
input.bus = MVIP95_MVIP_BUS;
input.stream = 1;
input.timeslot = timeslot;
output.bus = MVIP95_LOCAL_BUS;
output.stream = 17;
output.timeslot = timeslot;
swiMakeConnection(t1hd, &input, &output, 1);
}

/* Connect Voice paths of CX 2000 station and
* the incoming call, DUPLEX connection.
*/
void myConnectVoice(SWIHD t1hd, DWORD timeslot)
{
SWI_TERMINUS output, input;
/* Connect AG 4000 T1 local:0:timeslot to mvip:0:timeslot */
input.bus = MVIP95_LOCAL_BUS;
input.stream = 0;
input.timeslot = timeslot;
output.bus = MVIP95_MVIP_BUS;
output.stream = 0;
output.timeslot = timeslot;
swiMakeConnection(t1hd, &input, &output, 1);
/* Connect AG 4000 T1 mvip:1:timeslot to local:1:timeslot */
input.bus = MVIP95_MVIP_BUS;
input.stream = 1;
input.timeslot = timeslot;
output.bus = MVIP95_LOCAL_BUS;
output.stream = 1;
output.timeslot = timeslot;
swiMakeConnection(t1hd, &input, &output, 1);
}

/* Reset paths to get ready for next incoming call.
*/
void myResetT1Line(SWIHD t1hd, DWORD timeslot)
{
SWI_TERMINUS output, input;
/* Disable outputs of switch to mvip:0:timeslot */
output.bus = MVIP95_MVIP_BUS;
output.stream = 0;
output.timeslot = timeslot;
swiDisableOutput(t1hd, &output, 1);
/* Disable outputs of switch to local:1:timeslot */
output.bus = MVIP95_LOCAL_BUS;
output.stream = 1;
output.timeslot = timeslot;
swiDisableOutput(t1hd, &output, 1);
/* Reconnect voice streams */
input.bus = MVIP95_LOCAL_BUS;
input.stream = 0;
input.timeslot = timeslot;
output.bus = MVIP95_LOCAL_BUS;
output.stream = 17;
output.timeslot = timeslot;
swiMakeConnection(t1hd, &input, &output, 1);
input.bus = MVIP95_LOCAL_BUS;
input.stream = 16;
input.timeslot = timeslot;
output.bus = MVIP95_LOCAL_BUS;
output.stream = 1;
output.timeslot = timeslot;
swiMakeConnection(t1hd, &input, &output, 1);
/* Close open switches */
void myShutdown(SWIHD t1hd, SWIHD cxhd)
{
swiCloseSwitch(t1hd);
swiCloseSwitch(cxhd);
}
Version