|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectprotocol.CallContext
public class CallContext
CallContext deals with all the packets that are part of a specific call. The thing to remember is that a received message contains fields with the senders viewpoint so source is the far end and dest is us. in the reply the oposite is true: source is us and dest is them.
Field Summary | |
---|---|
(package private) AudioInterface |
audioInterface
The audio interface used to play/record for our voice PDUs |
private boolean |
callEstablished
The flag that indicates that the call is established |
private int |
destinationCallNumber
Represents the Destination Call Number in the PDU header |
private int |
inSeqNo
The inbound stream sequence number |
private int |
outSeqNo
The outbound stream sequence number |
private boolean |
receivedFirstVoicePDU
Used by onReceivedVoicePDU() to stop ringing |
private RemotePeer |
remotePeer
The remote peer; owner of the call |
private int |
sourceCallNumber
Represents the Source Call Number in the PDU header |
private long |
startTimestamp
The start time-stamp of the call |
Constructor Summary | |
---|---|
CallContext(RemotePeer remotePeer,
AudioInterface audioInterface)
The outbound constructor for Call. |
Method Summary | |
---|---|
ProtocolDataUnit |
addIn(ProtocolDataUnit pdu)
Passed a newly arrived PDU. |
void |
audioWrite(byte[] bs,
long timestamp)
Writes audio data to the speaker. |
void |
cleanUp()
Cleans up and detaches call from peer |
int |
getAudioSampleSize()
Returns the audio interface sample size (used to determine size of the VoicePDU). |
int |
getDestinationCallNumber()
Returns the remote call number. |
int |
getInSeqNo()
Returns the inbound stream sequence number. |
int |
getOutSeqNo()
Returns the outbound stream sequence number, oSeqno. |
int |
getOutSeqNoInc()
Generates a new outbound stream sequence number. |
int |
getSourceCallNumber()
Returns the local call number. |
long |
getStartTimestamp()
Returns the start time-stamp of the call. |
int |
getTimestamp()
Returns the timestamp of this call. |
boolean |
isEstablished()
Returns if this call has been callAnswered. |
void |
onReceivedVoicePDU(long timestamp,
byte[] audioSample)
Notifies us that a Voice PDU has been received. |
void |
resetClock()
Resets the clock. |
void |
send(OctetBuffer pdu)
Sends a PDU to our peer. |
void |
setCallEstablished(boolean established)
Sets if this call is established. |
void |
setDestinationCallNumber(int callNo)
Sets the remote call number as a character. |
void |
setInSeqNo(int next)
Sets the inbound stream sequence number. |
void |
setSourceCallNumber(int callNo)
Sets the local call number as a character. |
private void |
startAudioRecording()
Starts sending our audio interface recording. |
void |
stopAudioRecording()
Stops sending audio |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private int sourceCallNumber
private int destinationCallNumber
private int outSeqNo
private int inSeqNo
private long startTimestamp
private RemotePeer remotePeer
AudioInterface audioInterface
private boolean callEstablished
private boolean receivedFirstVoicePDU
Constructor Detail |
---|
public CallContext(RemotePeer remotePeer, AudioInterface audioInterface)
Method Detail |
---|
public int getOutSeqNoInc()
public int getOutSeqNo()
public int getInSeqNo()
public void setInSeqNo(int next)
public void send(OctetBuffer pdu)
pdu
- The PDU (in bytes)public int getTimestamp()
private void startAudioRecording()
public void stopAudioRecording()
public void setCallEstablished(boolean established)
public boolean isEstablished()
public void audioWrite(byte[] bs, long timestamp) throws java.io.IOException
bs
- The incoming audio payloadtimestamp
- The time-stamp
java.io.IOException
- Description of Exceptionpublic void onReceivedVoicePDU(long timestamp, byte[] audioSample)
public void setSourceCallNumber(int callNo)
public int getSourceCallNumber()
public void setDestinationCallNumber(int callNo)
public int getDestinationCallNumber()
public void resetClock()
public long getStartTimestamp()
public ProtocolDataUnit addIn(ProtocolDataUnit pdu)
public void cleanUp()
public int getAudioSampleSize()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |