⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sipdialog.html

📁 sipapi 说明文档.用于JAVA的SIP开发及应用.
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_10) on Wed Feb 28 12:31:09 CET 2007 -->
<TITLE>
SipDialog (JSR180 SIP API for J2ME)
</TITLE>

<META NAME="keywords" CONTENT="javax.microedition.sip.SipDialog interface">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="SipDialog (JSR180 SIP API for J2ME)";
}
</SCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">

<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../javax/microedition/sip/SipConnectionNotifier.html" title="interface in javax.microedition.sip"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../javax/microedition/sip/SipErrorListener.html" title="interface in javax.microedition.sip"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="SipDialog.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
javax.microedition.sip</FONT>
<BR>
Interface SipDialog</H2>
<HR>
<DL>
<DT>public interface <B>SipDialog</B></DL>

<P>
<tt>SipDialog</tt> represents one SIP Dialog. The <tt>SipDialog</tt> can be retrieved from a <tt>SipConnection</tt> object, when it is available (at earliest after provisional 101-199 response). <p> Three SIP requests can open a dialog: INVITE, SUBSCRIBE/NOTIFY and  REFER/NOTIFY. An implementation compliant to this specification must  support all of the following ways of creating dialogs: <br> <UL> <LI> INVITE-1xx-2xx-ACK will open a dialog. Subsequent  <A HREF="./SipClientConnection.html"><code>SipClientConnection</code></A> in the same dialog can be obtained by calling <A HREF="./SipDialog.html#getNewClientConnection(java.lang.String)"> <code>getNewClientConnection(String method)</code></A> method. The dialog  is terminated when the transaction BYE-200 OK is completed. For more information please refer to RFC 3261 [1], Chapter 12. <br> <LI> SUBSCRIBE-200 OK(or matching NOTIFY) will open a dialog. Subsequent  <code>SipClientConnection</code> in the same dialog can be obtained by calling <A HREF="./SipDialog.html#getNewClientConnection(java.lang.String)"> <code>getNewClientConnection(String method)</code></A> method. The dialog  is terminated when a notifier sends a NOTIFY request with a "Subscription-State" of "terminated" and there are no other subscriptions alive in this dialog. For more information please refer to RFC 3265 [2], Chapter 3.3.4. <br> <LI> REFER-matching NOTIFY will open a dialog. Subsequent  <code>SipClientConnection</code> in the same dialog can be obtained by calling <A HREF="./SipDialog.html#getNewClientConnection(java.lang.String)"> <code>getNewClientConnection(String method)</code></A> method. The dialog  is terminated when a notifier sends a NOTIFY request with a "Subscription-State" of "terminated" and there are no other subscriptions alive in this dialog. For more information please refer to RFC 3515 [6]. </UL> <p> <tt>SipDialog</tt> has following states (for both client and server side): <p> <UL> <li><em>Initialized</em>, internal state where the dialog has been created.  This state is not visible to the user, since the dialog can be fetched  earliest in the <em>Early</em> state. <br><br> <li><em>Early</em>, provisional 101-199 response received (or sent)</li> <br>All methods available. <br><br> <li><em>Confirmed</em>, final 2xx response received (or sent) for the original  request. Or NOTIFY confirming the subscription received (or sent).</li> <br>All methods available. <br><br> <li><em>Terminated</em>, no response or error response (3xx-6xx) received  (or sent). Also if the dialog is terminated with BYE or un-SUBSCRIBE.</li> <br>Method <code>getNewClientConnection()</code> can not be called in this state. </UL> The <tt>SipDialog</tt> (client side) has following state diagram:<br><br> <img src="./jsr180-dialog-state-diagram-client.gif"> <br> The <tt>SipDialog</tt> (server side) has following state diagram:<br><br> <img src="./jsr180-dialog-state-diagram-server.gif"> <br><br> Following code example shows a simple example of using  <code>SipDialog</code> in conjunction with <code>SipClientConnection</code>  and <code>SipServerConnection</code>. <code>SipDialog</code> is used to  send subsequent SUBSCRIBE request as well as detecting if received NOTIFY  belongs to the same dialog (i.e. subscription). Further dialog information  like "Call-ID" or "remote tag" can be read from the subsequent  <code>SipClientConnection</code> as demonstrated.   <p> <pre> class SipDialogExample implements SipServerConnectionListener {     SipDialog dialog;    SipClientConnection scc;    SipConnectionNotifier scn;    String callID;    String remoteTag;    public void sendSubscribe() {         try {            scn = (SipConnectionNotifier) Connector.open("sip:");           scn.setListener(this);           scc = (SipClientConnection)	         Connector.open("sip:UserB@host.com");           scc.initRequest("SUBSCRIBE", scn);           scc.setHeader("From", "sip:UserA@host.com");           scc.setHeader("Accept", "application/pidf+xml");           scc.setHeader("Event", "presence");           scc.setHeader("Expires", "950");           String contact = new String("sip:user@"+scn.getLocalAddress()                            +":"+scn.getLocalPort());           scc.setHeader("Contact", contact);           scc.send();            boolean resp = scc.receive(10000); // wait 10 secs for response            if(resp) {               if(scc.getStatusCode() == 200) {                   dialog = scc.getDialog();                   // initialize new SipClientConnection                   scc = dialog.getNewClientConnection("SUBSCRIBE");                   // read dialog Call-ID                   callID = scc.getHeader("Call-ID");                   // read remote tag                   SipHeader sh = new SipHeader("To", scc.getHeader("To"));                   remoteTag = sh.getParameter("tag");                   // unSUBSCRIBE                   scc.setHeader("Expires", "0");                   scc.send();               }           } else {               // didn't receive any response in given time           }        } catch(Exception ex) {             // handle Exceptions         }     }     public void notifyRequest(SipConnectionNotifier scn) {         try {            SipServerConnection ssc;           // retrieve the request received            ssc = scn.acceptAndOpen();           // check if the received request is NOTIFY and it belongs            // to our dialog           if(ssc.getMethod().equals("NOTIFY") &&               dialog.isSameDialog(ssc)) {               ssc.initResponse(200);               ssc.send();           }else {                // send 481 "Subscription does not exist"               ssc.initResponse(481);               ssc.send();           }        } catch(Exception ex) {             // handle Exceptions         }     } } </pre>
<P>

<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../javax/microedition/sip/SipConnection.html#getDialog()"><CODE>SipConnection.getDialog()</CODE></A></DL>
<HR>

<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->

<A NAME="field_summary"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipDialog.html#CONFIRMED">CONFIRMED</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipDialog.html#EARLY">EARLY</A></B></CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;byte</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../javax/microedition/sip/SipDialog.html#TERMINATED">TERMINATED</A></B></CODE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -