Methods Summary |
---|
protected void | checkForPermission(java.lang.String name, java.lang.String protocol, int permission)Checks for the required permission.
Scheduler scheduler;
MIDletSuite midletSuite;
scheduler = Scheduler.getScheduler();
midletSuite = scheduler.getMIDletSuite();
// there is no suite running when installing from the command line
if (midletSuite == null) {
return;
}
name = protocol + ":" + name;
try {
midletSuite.checkForPermission(permission, name);
} catch (InterruptedException ie) {
throw new InterruptedIOException(
"Interrupted while trying to ask the user permission");
}
|
public boolean | isProtocolSupported(java.lang.String protocol)Checks if transport protocol is supported.
if (protocol == null) {
return false;
} else {
return protocol.equalsIgnoreCase(SIPConstants.TRANSPORT_UDP) ||
protocol.equalsIgnoreCase(SIPConstants.TRANSPORT_TCP);
}
|
protected Connection | openConn(java.lang.String name, java.lang.String scheme)Open a client or server socket connection.
The name string for this protocol should be:
{scheme}:[{target}][{params}]
where:
scheme is SIP(S) scheme supported by the system sip
target is user network address in form
of {user_name}@{target_host}[:{port}]
or {telephone_number}, see examples below.
params stands for additional SIP URI parameters like ;transport=udp
Opening new client connection (SipClientConnection):
If the target host is included a, SipClientConnection will be returned.
Examples:
sip:bob@biloxi.com?sips:alice@10.128.0.8:5060
sip:alice@company.com:5060;transport=tcp
sip:+358-555-1234567;postd=pp22@foo.com;user=phone
Opening new server connection (SipConnectionNotifier):
Three forms of SIP URIs are allowed where the target host is omitted:
sips:nnnn, returns SipConnectionNotifier listening to incoming SIP
requests on port number nnnn.
sip:, returns SipConnectionNotifier listening to incoming SIP requests
on a port number allocated by the system.
sip:[nnnn];type=application/x-type,
returns SipConnectionNotifier listening to incoming SIP requests that
match to the MIME type application/x-type
(specified in the URI parameter type). Port number is optional.
Examples of opening a SIP connection:
SipClientConnection scn = (SipClientConnection)
Connector.open(sips:bob@biloxi.com);
SipClientConnection scn= (SipClientConnection)
Connector.open(sip:alice@company.com:5060;transport=tcp);
SipConnectionNotifier scn = (SipConnectionNotifier)
Connector.open(sip:5060);
SipConnectionNotifier scn = (SipConnectionNotifier)
Connector.open(sip:5080);
SipConnectionNotifier scn = (SipConnectionNotifier)
Connector.open(sip:);
Connection retval = null;
URLParser parser = new URLParser(scheme + ":" + name);
SipURI inputURI = null;
try {
inputURI = (SipURI)parser.parseWholeString();
} catch (ParseException exc) {
throw new IllegalArgumentException(exc.getMessage());
}
String transport = inputURI.getTransportParam();
if (transport == null) { // get default transport name
transport = SIPConstants.TRANSPORT_UDP;
} else if (!transport.equalsIgnoreCase(SIPConstants.TRANSPORT_UDP) &&
!transport.equalsIgnoreCase(SIPConstants.TRANSPORT_TCP)) {
throw new SipException(SipException.TRANSPORT_NOT_SUPPORTED);
}
if (transport == null) { // get default transport name
transport = SIPConstants.TRANSPORT_UDP;
}
int portNum = inputURI.getPort();
boolean isSecure = inputURI.isSecure();
StackConnector stackConnector =
StackConnector.getInstance(classSecurityToken);
if (inputURI.isServer()) { // server URI
String mimeType = inputURI.getTypeParam();
if (inputURI.isShared()) { // sip:*;type="application/..."
if (mimeType == null) { // no type parameter
throw new IllegalArgumentException("No type parameter "
+ "in shared URI");
}
retval = (Connection)stackConnector.
createSharedSipConnectionNotifier(
isSecure,
transport,
mimeType);
} else { // dedicated sip:5060;...
retval = (Connection)stackConnector.
createSipConnectionNotifier(
portNum,
isSecure,
transport,
mimeType);
}
} else { // client URI
if (portNum == -1) { // set default port
inputURI.setPort(SIPConstants.DEFAULT_NONTLS_PORT);
}
retval = (Connection) stackConnector.
createSipClientConnection(inputURI);
}
return retval;
|
public java.io.DataInputStream | openDataInputStream()Throw IOException on call openInputStream() method.
throw new IOException("SIP connection doesn't support input stream");
|
public java.io.DataOutputStream | openDataOutputStream()Throw IOException on call openInputStream() method.
throw new IOException("SIP connection doesn't support output stream");
|
public java.io.InputStream | openInputStream()Throw IOException on call openInputStream() method.
throw new IOException("SIP connection doesn't support input stream");
|
public java.io.OutputStream | openOutputStream()Throw IOException on call openInputStream() method.
throw new IOException("SIP connection doesn't support output stream");
|
public abstract Connection | openPrim(java.lang.String name, int mode, boolean timeouts)Sets up the state of the connection, but
does not actually connect to the server until there's something
to do.
|