|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cnrg.itx.gtwy.Gateway
This class contains the main Gateway control. It also creates instances of other classes needed for controlling individual Gateway channels, data flow, and the interface with signaling.
Inner Class Summary | |
private class |
Gateway.ThreadWait
Inner private class that waits for keyboard input. |
Field Summary | |
protected static int |
BUFFERSIZE
Size of voice packets transferred from phone to Gateway. |
private static int |
CHANNELCOUNT
Number of channels on the Gateway. |
private java.lang.Object[] |
DTMFMutex
Object used for mutex in stopping and restarting the thread responsible for playout on a phone. |
private Line[] |
gateLine
Array of Line objects. |
private ListenChannel[] |
gateListen
Thread that listens for incoming phone calls. |
private java.lang.Thread[] |
gatePlay
Thread for playing out voice packets to a phone. |
private java.lang.Thread[] |
gateRecord
Thread that sends voice packets from a phone to a computer. |
private SignalInterface |
gateSignal
Instance of SignalInterface. |
private static int |
LINECOUNT
Number of lines on the Gateway. |
private java.lang.Thread |
myThreadWait
Thread that waits for user input. |
private static java.lang.String[] |
PHONENUMBER
Extension numbers used to call each line. |
protected static int |
PXFERFACTOR
Factor BUFFERSIZE is multiplied by to determine the size of voice packets transferred
from Gateway to phone. |
Constructor Summary | |
private |
Gateway(boolean usePBX)
|
Method Summary | |
(package private) static void |
|
private void |
channelOffHook(int chDev)
Sets the channel off hook to allow for passing voice data through. |
private void |
channelOnHook(int chDev)
Sets the channel on hook. |
private int |
channelSetUp(int channelNum,
int xferFactor)
Used for channel initialization. |
protected cnrg.itx.datax.Connection |
dialComputer(Line lineInfo,
java.lang.String ext)
Dials an computer application extension from ListenChannel. |
protected void |
dialPhone(java.lang.String digits,
Line lineInfo)
Dials a phone. |
private void |
endPlayConnection(int lineNumber)
Stops audio playout from computer to phone |
private void |
endRecordConnection(int lineNumber)
Terminates the data flow from phone to computer. |
protected void |
freeLine(Line lineInfo)
Resets and unreserves a line for a future connection. |
protected Line |
getAvailableLine()
Finds a line that can be used for a connection between a computer and a phone. |
protected void |
hangup(Line lineInfo)
Called by a RecordChannel. |
private void |
initialize(int numLines,
int bufferSize,
int pXferFactor)
Initializes parameters in the .cpp file. |
static void |
main(java.lang.String[] args)
The main entry point for the Gateway. |
protected void |
playDTMF(java.lang.String digits,
Line lineInfo,
cnrg.itx.datax.Connection c)
Used by SignalInterface to play DTMF tones onto the connected phone. |
private void |
playTones(java.lang.String digits,
int chDev)
Plays DTMF tones to the telephone connected to the line. |
private void |
reroute(int chDev,
int secDev)
Reroutes the second channel's playout to the primary channel's playout. |
private void |
resetPlaySequence(int lineNumber,
boolean isStartCall)
Resets handlers for a playout on a phone. |
private void |
resetRecordSequence(int lineNumber,
boolean isStartCall)
Resets handlers for sending data from phone to computer. |
protected void |
resetSequence(Line lineInfo)
Reinitializes a line for data flow. |
protected void |
sendDTMF(java.lang.String digits,
Line lineInfo)
RecordChannel calls this to send any DTMF digits it received while sending voice data from a phone to a computer. |
protected void |
setUpConnection(Line lineInfo,
cnrg.itx.datax.Connection c)
Sets up a data connection between phone and computer. |
private void |
shutDown(int[] chDevArray)
Closes all Gateway channels and cleans up memory. |
private void |
startListen(int index)
Starts a thread for a Gateway channel. |
private void |
startThreadWait()
Starts the ThreadWait instance. |
protected void |
tearDownConnection(Line lineInfo)
Used by SignalInterface to take down a data connection between computer and phone. |
protected void |
tearDownPlayConnection(Line lineInfo)
Used by RecordChannel after a hangup to stop playout on a phone. |
private void |
unroute(int chDev)
"Releases" the second channel from playing out on the primary channel. |
protected boolean |
useLine(Line lineInfo)
Checks if the specified line can be used for a connection between a phone and computer. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
Field Detail |
protected static final int BUFFERSIZE
protected static final int PXFERFACTOR
BUFFERSIZE
is multiplied by to determine the size of voice packets transferred
from Gateway to phone.private static final int LINECOUNT
private static final int CHANNELCOUNT
private static final java.lang.String[] PHONENUMBER
private java.lang.Object[] DTMFMutex
private ListenChannel[] gateListen
private java.lang.Thread[] gateRecord
private java.lang.Thread[] gatePlay
private SignalInterface gateSignal
private Line[] gateLine
private java.lang.Thread myThreadWait
Constructor Detail |
private Gateway(boolean usePBX) throws GatewayException
usePBX
- true if the gateway uses the PBX; false otherwise.Method Detail |
static void()
private void startThreadWait()
Gateway.ThreadWait
private void startListen(int index)
index
- corresponds with each channel number. index 0 is for channel 1.ListenChannel.run()
protected Line getAvailableLine()
Line
instance of the available line. Contains information concerning
that line.Line
protected boolean useLine(Line lineInfo)
lineInfo
- the Line
instance of the specific line being reserved. Contains
information concerning that line.protected void freeLine(Line lineInfo)
lineInfo
- the Line
instance of the line being freed. Contains information
concerning that line.protected void resetSequence(Line lineInfo)
lineInfo
- the Line
instance of the line being reinitialized. Contains
information concerning that line.protected void setUpConnection(Line lineInfo, cnrg.itx.datax.Connection c)
lineInfo
- the Line
instance of the line where the connection is set up.
Contains information concerning that line.c
- the Connection
instance associated with the connection. Provides the means
to transfer voice data.Connection
protected void tearDownConnection(Line lineInfo)
SignalInterface
to take down a data connection between computer and phone.
The connection is always through a line.lineInfo
- the Line
instance of the line where the connection currently exists.
Contains information concerning the line.protected void tearDownPlayConnection(Line lineInfo)
RecordChannel
after a hangup to stop playout on a phone. The connection on
the line is terminated.lineInfo
- the Line
instance of the line where the connection currently exists.
Contains information concerning that line.protected cnrg.itx.datax.Connection dialComputer(Line lineInfo, java.lang.String ext) throws GatewayException
lineInfo
- The Line
instance of the line from which the phone dial is being
made. Contains information concerning that line.ext
- extension number to dial.Connection
instance used to service data flow on a line. Provides the
means necessary for voice data transfer.protected void hangup(Line lineInfo) throws GatewayException
lineInfo
- the Line
instance of the line that is disconnected. Contains
information concerning that line.protected void sendDTMF(java.lang.String digits, Line lineInfo) throws GatewayException
digits
- the DTMF digits that were detected from the phone.lineInfo
- the Line
instance of the line on which the DTMF tones were detected.protected void playDTMF(java.lang.String digits, Line lineInfo, cnrg.itx.datax.Connection c)
digits
- the DTMF tones being played.lineInfo
- the Line
instance of the line where the DTMF tones are being played.
Contains information concerning the line.c
- the Connection
instance associated with the connection the line is on.public static void main(java.lang.String[] args)
args
- Array of parameters passed to the application via the command line.private void initialize(int numLines, int bufferSize, int pXferFactor)
numLines
- the number of lines in the gateway.bufferSize
- the packet transfer rate between the gateway and phone.pXferFactor
- factor bufferSize is multiplied by to define size of packets played to phone.private void shutDown(int[] chDevArray)
chDevArray
- array of all channel device handlers.private int channelSetUp(int channelNum, int xferFactor)
channelNum
- the channel's designated number.xferFactor
- to be multiplied with the packet transfer rate. Meant to increase transfer
rate if desired.private void reroute(int chDev, int secDev)
chDev
- the primary channel's device handler.secDev
- the second channel's device handler. This channel is responsible for playout.private void unroute(int chDev)
chDev
- the primary channel's device handler.private void channelOnHook(int chDev)
chDev
- the channel's device handler.private void channelOffHook(int chDev)
chDev
- the channel's device handler.protected void dialPhone(java.lang.String digits, Line lineInfo) throws GatewayException
digits
- the phone number being dialed.lineInfo
- the Line
instance of the line where the connection is to be made.private void playTones(java.lang.String digits, int chDev)
digits
- the DTMF digits being played.chDev
- the channel's device handler.private void resetRecordSequence(int lineNumber, boolean isStartCall)
lineNumber
- the channel's corresponding line number.isStartCall
- true if this is the beginning of a connection session; false otherwise.private void resetPlaySequence(int lineNumber, boolean isStartCall)
lineNumber
- the channel's corresponding line number.isStartCall
- true if this is the beginning of a connection session; false otherwise.private void endRecordConnection(int lineNumber)
lineNumber
- the channel's corresponding line number.private void endPlayConnection(int lineNumber)
lineNumber
- the channel's corresponding line number.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |