public abstract class SipTransportCO extends java.lang.Object implements SipTransport
Modifier and Type | Field and Description |
---|---|
protected java.util.Hashtable |
connections
Table of active connections (Hashtable of
ConnectionId ,SipTransportConnection ) |
protected SipTransportListener |
listener
SipTransport listener
|
protected Logger |
logger
Event Logger
|
protected SipTransportConnectionListener |
this_conn_listener
SipTransportConnection listener
|
Constructor and Description |
---|
SipTransportCO(int local_port,
int nmax_connections,
Logger logger)
Creates a new SipTransportCO
|
Modifier and Type | Method and Description |
---|---|
SipTransportConnection |
addConnection(IpAddress remote_ipaddr,
int remote_port)
Adds a new transport connection.
|
void |
addConnection(SipTransportConnection conn)
Adds a new transport connection.
|
protected abstract SipTransportConnection |
createTransportConnection(SocketAddress remote_soaddr)
Creates a proper transport connection to the remote end-point.
|
abstract java.lang.String |
getProtocol()
Gets protocol type
|
void |
halt()
Stops running
|
boolean |
isForceSentBySet()
Whether the "force-sent-by" mode is set.
|
protected void |
processConnectionTerminated(SipTransportConnection conn,
java.lang.Exception error)
When SipTransportConnection terminates.
|
protected void |
processReceivedMessage(SipTransportConnection conn,
SipMessage msg)
When a new SIP message is received.
|
void |
removeConnection(ConnectionId connection_id)
Removes a transport connection
|
ConnectionId |
sendMessage(SipMessage msg,
IpAddress dest_ipaddr,
int dest_port,
int ttl)
From SipTransport.
|
SipTransportConnection |
sendMessageCO(SipMessage msg)
Sends the message msg using active connection specified by the connection-id of the given message.
|
void |
setForceSentBy(boolean force_sent_by)
Whether setting the Via protocol, sent-by, and port values according to the transport connection ("force-sent-by" mode).
|
void |
setListener(SipTransportListener listener)
Sets transport listener
|
void |
setManualConnectionMode(boolean manual)
Sets manual connection only mode.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLocalPort, toString
protected Logger logger
protected java.util.Hashtable connections
ConnectionId
,SipTransportConnection
)protected SipTransportListener listener
protected SipTransportConnectionListener this_conn_listener
public SipTransportCO(int local_port, int nmax_connections, Logger logger) throws java.io.IOException
java.io.IOException
public void setManualConnectionMode(boolean manual)
addConnection(IpAddress,int)
or addConnection(SipTransportConnection)
methods.public void setForceSentBy(boolean force_sent_by)
force_sent_by
- whether changing Via protocol, sent-by, and port values according to the transport connectionpublic boolean isForceSentBySet()
setForceSentBy(boolean)
for more details.public abstract java.lang.String getProtocol()
getProtocol
in interface SipTransport
protected abstract SipTransportConnection createTransportConnection(SocketAddress remote_soaddr) throws java.io.IOException
java.io.IOException
public void setListener(SipTransportListener listener)
setListener
in interface SipTransport
public ConnectionId sendMessage(SipMessage msg, IpAddress dest_ipaddr, int dest_port, int ttl) throws java.io.IOException
If the transport protocol is Connection Oriented (CO), this method first looks for a proper active connection; if no active connection is found, a new connection is opened.
If the transport protocol is Connection Less (CL) the message is simply sent to the remote point.
sendMessage
in interface SipTransport
java.io.IOException
public SipTransportConnection sendMessageCO(SipMessage msg) throws java.io.IOException
If connection-id is null, or if no active connection is found for such connection-id, an IOException is thrown.
java.io.IOException
public void halt()
halt
in interface SipTransport
protected void processReceivedMessage(SipTransportConnection conn, SipMessage msg)
protected void processConnectionTerminated(SipTransportConnection conn, java.lang.Exception error)
public SipTransportConnection addConnection(IpAddress remote_ipaddr, int remote_port) throws java.io.IOException
java.io.IOException
public void addConnection(SipTransportConnection conn)
public void removeConnection(ConnectionId connection_id)