public interface SipStream extends Stream<SipPacket>
| Modifier and Type | Interface and Description |
|---|---|
static class |
SipStream.CallState
Even though SIP can be used for so much more than just establishing
"phone calls" (VoIP) it is commonly used for this very purpose.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addMessage(SipPacket message)
|
SipStream |
createEmptyClone()
Create an empty clone of this
SipStream. |
SDP |
get200OkSDP()
Convenience method for returning the
SDP found on the 200 OK to the first INVITE
request. |
SipStream.CallState |
getCallState()
Which
SipStream.CallState the call is in. |
long |
getDuration()
The duration for a
SipStream is calculated differently depending
on what the stream is capturing. |
SDP |
getInviteSDP()
Convenience method for returning the
SDP found on the first INVITE request. |
List<SipPacket> |
getPackets()
|
long |
getPostDialDelay()
Post Dial Delay (PDD) is defined as the time it takes between the INVITE
and until some sort of ringing signal is received (18x responses).
|
StreamId |
getStreamIdentifier()
Get the identifier used for grouping the
SipPackets together. |
boolean |
handshakeComplete()
Indicates whether the INVITE handshake was completed.
|
boolean |
isTerminated()
Check whether this
SipStream is in the terminated state, which it is if any of the following is true:
For INVITE streams:
If the initial handshake failed with an error
response (which will include CANCEL scenarios)
If the call was successfully established and a BYE
request and the corresponding final response has been processed
|
boolean |
reTranmitsDetected()
Indicates whether there were retransmissions detected.
|
void |
save(OutputStream out)
Save this
SipStream to the specified OutputStream. |
void |
save(String filename)
Save this
SipStream to the specified file. |
getTimeOfFirstPacket, getTimeOfLastPacket, writeList<SipPacket> getPackets()
getPackets in interface Stream<SipPacket>boolean isTerminated()
SipStream is in the terminated state, which it is if any of the following is true:
For INVITE streams:
long getPostDialDelay()
throws SipPacketParseException
SipStream is not an
INVITE scenario.SipPacketParseException - in case anything goes wrong while trying to calculate the
PDD.SDP getInviteSDP() throws SipPacketParseException
SDP found on the first INVITE request. Note, if
you want to find the SDP for a re-invite, then you will have to getPackets() and
find the particular INVITE you are looking for.SipPacketParseExceptionSDP get200OkSDP() throws SipPacketParseException
SDP found on the 200 OK to the first INVITE
request.
Note, if you want to find the SDP for 200 OK to a re-invite, then you will have to
getPackets() and find the particular response you are looking for.SipPacketParseExceptionStreamId getStreamIdentifier()
SipPackets together. Currently, this is the
same as the call-id.
Note, perhaps this should be a dialog id instead since ideally that is what we should be
using for grouping together SipStreams. On the other hand, using the dialog-id as an
identifier can make things messy for forked dialogs etc. This works and keeps things simple
so we will stick with it for now.getStreamIdentifier in interface Stream<SipPacket>long getDuration()
SipStream is calculated differently depending
on what the stream is capturing. For dialogs (INVITE, SUBSCRIBE, REFER)
the duration is equal to the duration of the dialog. As such, any
re-transmissions of the terminating event etc will NOT be taken into
consideration when calculating the duration. However, if the underlying
sip stream is not a dialog, then the duration will simply be the time
between the first and last message that we recorded. Get the duration in microseconds of the stream. Note, see comment on
Packet.getArrivalTime() regarding the microsecond precision.
Depending on the underlying protocol this can be as simple as the time
between the first to the last packet, which is what the RtpStream
does. Or, it can be more complicated as with a SipStream that
checks the duration of the dialog (if one was established).getDuration in interface Stream<SipPacket>Stream. If the
duration cannot be calulated for whatever reason (no packets at
all? Only one packet?), then -1 (negative one) will be returned.SipStream.CallState getCallState()
SipStream.CallState the call is in.
NOTE: this only applies to INVITE dialogs.SipStream.CallState.boolean handshakeComplete()
boolean reTranmitsDetected()
void save(String filename) throws FileNotFoundException, IOException
SipStream to the specified file.filename - FileNotFoundExceptionIOExceptionvoid save(OutputStream out) throws IOException
SipStream to the specified OutputStream. The
difference between this method and Stream.write(OutputStream) is that
the latter assumes that the pcap headers etc already have been written to
the stream. However, this method will write this SipStream as a
standalone pcap.out - IOExceptionSipStream createEmptyClone()
SipStream. What this means is that
you get a SipStream with the same StreamId and underlying
PcapGlobalHeader (which you really do not need to know) but
otherwise it is empty. I.e., it doesn't contain any SipPackets.
Use this method when you e.g. have a SipStream that you want to
split in two. A typical scenario is if you have a SipStream that
went through a SIP Proxy but you want to split this stream in one "left"
side and one "right" side. You do so by figuring out which message
belongs to each side and then create two empty clones and then drive the
traffic from each side through the new SipStreams. This will then
give you two separate SipStream but that still will have the
stats available.void addMessage(SipPacket message) throws IllegalArgumentException, SipPacketParseException
SipPacket to this SipStream. By doing so you will
force the SipStream to move its internal state machine along
since it just "received" a new SipPacket.message - IllegalArgumentException - in case the message you are trying to add does not have the
same StreamId.SipPacketParseException - in case something goes wrong while parsing the
SipPacketCopyright © 2021. All Rights Reserved.