|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.cafesip.sipunit.SipStack
public class SipStack
This class is the starting point for a SipUnit test. Before establishing any SIP sessions, the test program must instantiate this class. Each SipStack object establishes the SIP protocol binding on the specified TCP/UDP port. This port is used to communicate with external SIP agents (a SIP proxy server, for example). A SipStack object may contain one or more SipPhone objects and each SipPhone object may contain one (or more, in future) SipCall objects and a buddy list. The getXxxFactory() methods of this class are used in conjunction with JAIN-SIP Request/Response classes for dealing with low level message, address and header content, needed when dealing at the SipSession level.
| Field Summary | |
|---|---|
static int |
DEFAULT_PORT
|
static java.lang.String |
DEFAULT_PROTOCOL
|
static java.lang.String |
PROTOCOL_TCP
PROTOCOL_TCP Specifies TCP/IP transport. |
static java.lang.String |
PROTOCOL_UDP
PROTOCOL_UDP Specifies UDP/IP transport. |
| Constructor Summary | |
|---|---|
SipStack(java.lang.String proto,
int port)
Equivalent to the other constructor without any properties specified. |
|
SipStack(java.lang.String proto,
int port,
java.util.Properties props)
A constructor for this class. |
|
| Method Summary | |
|---|---|
SipPhone |
createSipPhone(java.lang.String me)
This method is the equivalent to the other createSipPhone() methods but without a proxy server. |
SipPhone |
createSipPhone(java.lang.String host,
java.lang.String me)
This method is the equivalent to the other createSipPhone() method, but using the default transport (UDP/IP) and the default SIP port number (5060). |
SipPhone |
createSipPhone(java.lang.String proxyHost,
java.lang.String proxyProto,
int proxyPort,
java.lang.String me)
This method is used to create a SipPhone object. |
void |
dispose()
This method is used to tear down the SipStack object. |
static void |
dumpMessage(java.lang.String informationalHeader,
javax.sip.message.Message msg)
Outputs to console the provided header string followed by the message. |
javax.sip.address.AddressFactory |
getAddressFactory()
This method returns the JAIN-SIP AddressFactory associated with the SipStack. |
javax.sip.header.HeaderFactory |
getHeaderFactory()
This method returns the JAIN-SIP HeaderFactory associated with the SipStack. |
javax.sip.message.MessageFactory |
getMessageFactory()
This method returns the JAIN-SIP MessageFactory associated with the SipStack. |
javax.sip.SipProvider |
getSipProvider()
This method returns the JAIN-SIP SipProvider associated with the SipStack. |
javax.sip.SipStack |
getSipStack()
This method returns the JAIN-SIP SipStack associated with this JUnit SipStack. |
static boolean |
isTraceEnabled()
Indicates if the SipUnit stack trace has been enabled. |
void |
processDialogTerminated(javax.sip.DialogTerminatedEvent arg0)
|
void |
processIOException(javax.sip.IOExceptionEvent arg0)
|
void |
processRequest(javax.sip.RequestEvent arg0)
FOR INTERNAL USE ONLY. |
void |
processResponse(javax.sip.ResponseEvent arg0)
FOR INTERNAL USE ONLY. |
void |
processTimeout(javax.sip.TimeoutEvent arg0)
FOR INTERNAL USE ONLY. |
void |
processTransactionTerminated(javax.sip.TransactionTerminatedEvent arg0)
|
static void |
setTraceEnabled(boolean traceEnabled)
Turn on or off the SipUnit stack tracing. |
static void |
trace(java.lang.String msg)
Outputs the given string to console, if SipStack.setTraceEnabled(true) has been called. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String PROTOCOL_TCP
PROTOCOL_TCP Specifies TCP/IP transport.
public static final java.lang.String PROTOCOL_UDP
PROTOCOL_UDP Specifies UDP/IP transport.
public static final int DEFAULT_PORT
public static final java.lang.String DEFAULT_PROTOCOL
| Constructor Detail |
|---|
public SipStack(java.lang.String proto,
int port,
java.util.Properties props)
throws java.lang.Exception
proto - SIP transport protocol, "tcp" or "udp" (default is "udp").port - port on which this stack listens for messages (default is
5060).props - properties of the SIP stack. These properties are the same as
that defined for JAIN-SIP SipStack. If this parameter has a
null value, we pick default values for you.
java.lang.Exception
public SipStack(java.lang.String proto,
int port)
throws java.lang.Exception
proto - SIP transport protocol (default is UDP).port - port on which this stack listens for messages (default is
5060).
java.lang.Exception| Method Detail |
|---|
public SipPhone createSipPhone(java.lang.String proxyHost,
java.lang.String proxyProto,
int proxyPort,
java.lang.String me)
throws javax.sip.InvalidArgumentException,
java.text.ParseException
proxyHost - host name or address of the SIP proxy to use. The proxy is
used for registering and outbound calling on a per-call basis.
If this parameter is a null value, any registration requests
will be sent to the "host" part of the "me" parameter (see
below) and any attempt to make an outbound call via proxy will
fail. If a host name is given here, it must resolve to a
valid, reachable DNS address.proxyProto - used to specify the protocol for communicating with the proxy
server - "udp" or "tcp".proxyPort - port number into with the proxy server listens to for SIP
messages and connections.me - "Address of Record" URI of the phone user. Each SipPhone is
associated with one user. This parameter is used in the "from"
header field.
javax.sip.InvalidArgumentException
java.text.ParseException
public SipPhone createSipPhone(java.lang.String me)
throws javax.sip.InvalidArgumentException,
java.text.ParseException
me - "Address of Record" URI of the phone user. Each SipPhone is
associated with one user. This parameter is used in the "from"
header field.
javax.sip.InvalidArgumentException
java.text.ParseException
public SipPhone createSipPhone(java.lang.String host,
java.lang.String me)
throws javax.sip.InvalidArgumentException,
java.text.ParseException
host - host name or address of the SIP proxy to use. The proxy is
used for registering and outbound calling on a per-call basis.
If this parameter is a null value, any registration requests
will be sent to the "host" part of the "me" parameter (see
below) and any attempt to make an outbound call via proxy will
fail. If a host name is given here, it must resolve to a
valid, reachable DNS address.me - "Address of Record" URI of the phone user. Each SipPhone is
associated with one user. This parameter is used in the "from"
header field.
javax.sip.InvalidArgumentException
java.text.ParseExceptionpublic void dispose()
public static boolean isTraceEnabled()
public static void setTraceEnabled(boolean traceEnabled)
traceEnabled - true to turn on the tracing, false to turn it off.public void processRequest(javax.sip.RequestEvent arg0)
processRequest in interface javax.sip.SipListenerpublic void processResponse(javax.sip.ResponseEvent arg0)
processResponse in interface javax.sip.SipListenerpublic void processTimeout(javax.sip.TimeoutEvent arg0)
processTimeout in interface javax.sip.SipListenerpublic javax.sip.address.AddressFactory getAddressFactory()
public javax.sip.header.HeaderFactory getHeaderFactory()
public javax.sip.message.MessageFactory getMessageFactory()
public javax.sip.SipProvider getSipProvider()
public javax.sip.SipStack getSipStack()
public static void trace(java.lang.String msg)
msg - String to output to console.
public static void dumpMessage(java.lang.String informationalHeader,
javax.sip.message.Message msg)
informationalHeader - msg - public void processIOException(javax.sip.IOExceptionEvent arg0)
processIOException in interface javax.sip.SipListenerpublic void processTransactionTerminated(javax.sip.TransactionTerminatedEvent arg0)
processTransactionTerminated in interface javax.sip.SipListenerpublic void processDialogTerminated(javax.sip.DialogTerminatedEvent arg0)
processDialogTerminated in interface javax.sip.SipListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||