📄 sipclientconnection.html
字号:
<A NAME="method_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipClientConnection.html#enableRefresh(javax.microedition.sip.SipRefreshListener)">enableRefresh</A></B>(<A HREF="../../../javax/microedition/sip/SipRefreshListener.html" title="interface in javax.microedition.sip">SipRefreshListener</A> srl)</CODE>
<BR>
Enables the refresh for the request to be sent.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipClientConnection.html#initAck()">initAck</A></B>()</CODE>
<BR>
Convenience method to initialize <tt>SipClientConnection</tt> with SIP request method ACK.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> <A HREF="../../../javax/microedition/sip/SipClientConnection.html" title="interface in javax.microedition.sip">SipClientConnection</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipClientConnection.html#initCancel()">initCancel</A></B>()</CODE>
<BR>
Convenience method to initialize <tt>SipClientConnection</tt> with SIP request method CANCEL.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipClientConnection.html#initRequest(java.lang.String, javax.microedition.sip.SipConnectionNotifier)">initRequest</A></B>(java.lang.String method, <A HREF="../../../javax/microedition/sip/SipConnectionNotifier.html" title="interface in javax.microedition.sip">SipConnectionNotifier</A> scn)</CODE>
<BR>
Initializes <tt>SipClientConnection</tt> to a specific SIP request method (REGISTER, INVITE, MESSAGE, REFER, ...).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipClientConnection.html#receive(long)">receive</A></B>(long timeout)</CODE>
<BR>
Receives SIP response message.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipClientConnection.html#setCredentials(java.lang.String[], java.lang.String[], java.lang.String[])">setCredentials</A></B>(java.lang.String[] usernames, java.lang.String[] passwords, java.lang.String[] realms)</CODE>
<BR>
Sets multiple credential triplets for possible digest authentication.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipClientConnection.html#setCredentials(java.lang.String, java.lang.String, java.lang.String)">setCredentials</A></B>(java.lang.String username, java.lang.String password, java.lang.String realm)</CODE>
<BR>
Sets credentials for possible digest authentication.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipClientConnection.html#setListener(javax.microedition.sip.SipClientConnectionListener)">setListener</A></B>(<A HREF="../../../javax/microedition/sip/SipClientConnectionListener.html" title="interface in javax.microedition.sip">SipClientConnectionListener</A> sccl)</CODE>
<BR>
Sets the listener for incoming responses.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipClientConnection.html#setRequestURI(java.lang.String)">setRequestURI</A></B>(java.lang.String URI)</CODE>
<BR>
Sets Request-URI explicitly.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_javax.microedition.sip.SipConnection"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from interface javax.microedition.sip.<A HREF="../../../javax/microedition/sip/SipConnection.html" title="interface in javax.microedition.sip">SipConnection</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../javax/microedition/sip/SipConnection.html#addHeader(java.lang.String, java.lang.String)">addHeader</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#getDialog()">getDialog</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#getHeader(java.lang.String)">getHeader</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#getHeaders(java.lang.String)">getHeaders</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#getMethod()">getMethod</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#getReasonPhrase()">getReasonPhrase</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#getRequestURI()">getRequestURI</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#getStatusCode()">getStatusCode</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#openContentInputStream()">openContentInputStream</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#openContentOutputStream()">openContentOutputStream</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#removeHeader(java.lang.String)">removeHeader</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#send()">send</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#setErrorListener(javax.microedition.sip.SipErrorListener)">setErrorListener</A>, <A HREF="../../../javax/microedition/sip/SipConnection.html#setHeader(java.lang.String, java.lang.String)">setHeader</A></CODE></TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_javax.microedition.io.Connection"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from interface javax.microedition.io.Connection</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>close</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="initRequest(java.lang.String, javax.microedition.sip.SipConnectionNotifier)"><!-- --></A><H3>
initRequest</H3>
<PRE>
public void <B>initRequest</B>(java.lang.String method, <A HREF="../../../javax/microedition/sip/SipConnectionNotifier.html" title="interface in javax.microedition.sip">SipConnectionNotifier</A> scn) throws <A HREF="../../../javax/microedition/sip/SipException.html" title="class in javax.microedition.sip">SipException</A></PRE>
<DL>
<DD>Initializes <tt>SipClientConnection</tt> to a specific SIP request method (REGISTER, INVITE, MESSAGE, REFER, ...). The methods are defined in the RFC 3261 [1] and extensional specifications from SIP WG and SIMPLE WG [2][3][4][5][6]. Methods belonging to an already established dialog (BYE, NOTIFY, PRACK, UPDATE) should be created using <tt>SipDialog.getNewClientConnection()</tt> instead of this method. <p>The default RequestURI and headers will be initialized automatically. After this the <tt>SipClientConnection</tt> is in <em>Initialized</em> state. <p>The initialized request can be associated with an opened <tt>SipConnectionNotifier</tt>. Initialization of some headers depends on how the associated <tt>SipConnectionNotifier</tt> is initialized.<br><br> <UL> <LI>Associating <tt>SipConnectionNotifier</tt> in <em><b>shared</b></em> mode. <p>If <tt>SipConnectionNotifier</tt> is given as the second parameter and it is in <em>shared</em> mode the headers <tt>From, Contact</tt> are set according to the terminal SIP settings and the currently active SIP user identity.<br>Example values: <pre> From: "Mr. Watson" <sip:watson@worcester.bell.com> Contact: "Mr. Watson" <sip:watson@172.21.55.69:5060> </pre> <LI>Associating <tt>SipConnectionNotifier</tt> in <em><b>dedicated</b></em> mode. <p>If <tt>SipConnectionNotifier</tt> is in <em>dedicated</em> mode the SIP identity is not known by the system. Therefore the header <tt>From</tt> is preset to an anonymous URI. The header <tt>Contact</tt> will be preset according to the <tt>SipConnectionNotifier</tt> properties, where the user part is set to some some default value selected by the system.<br>Example values: <pre> From: "Anonymous" sip:thisis@anonymous.invalid Contact: sip:user@172.21.55.69:5060 </pre> As a generic rule if the <tt>SipConnectionNotifier</tt> is in <em>dedicated</em> mode or not set at all (<tt>= null</tt>) the user is responsible of managing the SIP identity and thus also the SIP registration. The user SHOULD overwrite the default values of <tt>From</tt> for all requests and <tt>Contact</tt> header for requests like INVITE, SUBSCRIBE, REGISTER and REFER. </UL> <p>See also chapter <A HREF="SipConnection.html#SERVERURI">"<tt>SipConnection:</tt> Opening new server connection"</A> for more details. <p>Headers that will be initialized are as follows:<br> <pre> To // To address constructed from SIP URI given in Connector.open() From // Set by the system. If SipConnectionNotifier is given and it is in shared mode the value will be set according the terminal SIP settings (see <A HREF="SipConnection.html#SERVERURI">Opening new server connection</A> for more details). If the SipConnectionNotifier is not given (= null) or it is in dedicated mode the From header MUST be set to a default value e.g. anonymous URI (see RFC 3261 [1], chapter 8.1.1.3 From). CSeq // Set by the system Call-ID // Set by the system Max-Forwards // Set by the system Via // Set by the system Contact // If SipConnectionNotifier is given the value is set by the system for REGISTER, INVITE, SUBSCRIBE and REFER. The value will be set according to the terminal IP settings and the SipConnectionNotifier properties. So the new request is associated with the SipConnectionNotifier. If the associated SipConnectionNotifier is in the dedicated mode the user part is set to some default value e.g. user. Example (dedicated mode), Contact: sip:user@172.21.55.69:5060 Example (shared mode), Contact: "Mr X" <sip:mrx@172.21.55.69:5060> </pre> <p> These headers will be set on behalf of the user by the implementation the latest when sending the request. It implies that the header values may not be available for reading right after the <tt>initRequest</tt> method returns. The user may also set (overwrite) these headers, in this case the values set by the user take precedence over the values set by the implementation. <p> If the application is using shared connections then it must set the Accept-Contact header to all outgoing request except CANCEL and ACK. For more details on how the message routing is handled based on the Accept-Contact header see <A HREF="SipConnection.html#SIPID">"<tt>SipConnection:</tt> SIP Identity"</A> and <A HREF="SipConnection.html#ROUTING">"<tt>SipConnection:</tt> Routing the incoming request"</A>. <p> Reference RFC 3261 [1] p.35 (8.1.1 Generating the Request) and p.159 (20 Header Fields)
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>method</CODE> - Name of the method<DD><CODE>scn</CODE> - <tt>SipConnectionNotifier</tt> to which the request will be associated. If <tt>scn</tt> is <tt>null</tt> the request will not be associated to any user defined listening point.<DT><B>Throws:</B><DD><CODE>java.lang.NullPointerException</CODE> - if method is null<DD><CODE>java.lang.IllegalArgumentException</CODE> - if the method is invalid<DD><CODE><A HREF="../../../javax/microedition/sip/SipException.html" title="class in javax.microedition.sip">SipException</A></CODE> - INVALID_STATE if the request can not be set, because of wrong state in <tt>SipClientConnection</tt>. Furthermore, ACK and CANCEL methods can not be initialized in <em>Created</em> state.<DD><CODE><A HREF="../../../javax/microedition/sip/SipException.html" title="class in javax.microedition.sip">SipException</A></CODE> - INVALID_OPERATION if the <tt>method</tt> argument is one of {BYE, NOTIFY, PRACK, UPDATE}.<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/sip/SipConnectionNotifier.html" title="interface in javax.microedition.sip"><CODE>SipConnectionNotifier</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setRequestURI(java.lang.String)"><!-- --></A><H3>
setRequestURI</H3>
<PRE>
public void <B>setRequestURI</B>(java.lang.String URI) throws <A HREF="../../../javax/microedition/sip/SipException.html" title="class in javax.microedition.sip">SipException</A></PRE>
<DL>
<DD>Sets Request-URI explicitly. If this operation is supported, Request-URI can be set only in <em>Initialized</em> state. Empty or null argument removes Request-URI if set previously.<p> It is not mandated that this operation be supported, an implementation may throw <tt>SipException.INVALID_OPERATION</tt> in any state.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>URI</CODE> - Request-URI<DT><B>Throws:</B><DD><CODE>java.lang.IllegalArgumentException</CODE> - MAY be thrown if the URI is invalid<DD><CODE><A HREF="../../../javax/microedition/sip/SipException.html" title="class in javax.microedition.sip">SipException</A></CODE> - INVALID_STATE if the Request-URI can not be set, because of wrong state, INVALID_OPERATION if the Request-URI is not allowed to be set.</DL>
</DD>
</DL>
<HR>
<A NAME="initAck()"><!-- --></A><H3>
initAck</H3>
<PRE>
public void <B>initAck</B>()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -